Skip to content

fix: resolve security, performance and output backlog#265

Merged
n24q02m merged 5 commits into
mainfrom
claude/ecstatic-noether-bvorH
May 22, 2026
Merged

fix: resolve security, performance and output backlog#265
n24q02m merged 5 commits into
mainfrom
claude/ecstatic-noether-bvorH

Conversation

@n24q02m
Copy link
Copy Markdown
Owner

@n24q02m n24q02m commented May 22, 2026

Summary

Consolidates the distinct substantive changes from the open bot/Renovate PR backlog into clean, tested commits.

  • fix: path traversal in sync-state file pathsStatePathFor concatenated target into the path unsanitized (only id was sanitized), letting ../ escape ~/.skret/sync-state. Both target and id are now sanitized, and sanitizeID collapses .., neutralizes NUL bytes / separators, and rejects empty/dot-only results.
  • feat: reduce allocations in RedactingHandler.Handle (preallocated attr slice + variadic AddAttrs) and in the local-provider / import batch paths.
  • fix: valid empty outputlist --format=json and env --format=json/yaml now emit the valid empty structure ([] / {}) on stdout while routing the human hint to stderr.
  • fix: bump cloudflare/wrangler-action to v4.

New tests cover 8 path-traversal vectors (target + id), end-to-end traversal containment, the redaction handler with many/zero attrs, and empty machine-readable output.

Supersedes bot PRs #255, #258, #260, #261, #262, #263, #264 and Renovate PR #257.

Test plan

  • go build ./...
  • go test -race ./... — all packages pass
  • golangci-lint run ./... (v2.12.2 / go1.26) — 0 issues
  • go vet ./... / gofmt -l clean

https://claude.ai/code/session_01USTAfaQs3ZtdhxvBrz44DJ


Generated by Claude Code

claude added 4 commits May 22, 2026 03:07
The target argument was concatenated into the sync-state file path
without sanitization while only id was sanitized, letting untrusted
input (e.g. ../) escape the ~/.skret/sync-state directory. Sanitize
both target and id, and harden sanitizeID to collapse .. sequences,
neutralize NUL bytes and path separators, and reject empty/dot-only
results.
Preallocate the attribute slice in RedactingHandler.Handle using
NumAttrs() and add attributes with a single variadic AddAttrs call
instead of a per-attribute loop. Preallocate slices with known
capacity in local provider GetBatch and the import dedup path.
When no secrets are found, list --format=json and env --format=json/yaml
now still emit the valid empty structure ([] or {}) on stdout while
routing the human-readable hint to stderr, so scripts parsing the
output keep working. Also preallocate the filter/env-pair slices.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

The skret run command replaces the process image via syscall.Exec on
Unix, so executing it inline terminated the test binary and silently
skipped every cli test ordered after it. Drive it from a re-exec of the
test binary instead, and back the env empty-state test with a dedicated
empty local store rather than a path filter the env command does not
apply.
@n24q02m n24q02m merged commit f00be26 into main May 22, 2026
23 checks passed
@n24q02m n24q02m deleted the claude/ecstatic-noether-bvorH branch May 22, 2026 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants