feat(secrets): consume SOPS SDK payload - #167
Conversation
There was a problem hiding this comment.
🟡 Not ready to approve
The secrets wrapper should explicitly reject symlinked ciphertext inputs and use jq (already required) instead of a regex grep to validate the JSON filestatus encryption flag.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR updates the repository’s live-test secrets workflow to be provider-agnostic by consuming a maintainer-supplied SOPS ciphertext file, validating an exact SDK payload contract, and rendering a safe, ignored .env.local with strict permissions.
Changes:
- Replaced the prior provider-specific secret export flow with a
sops+jq-validated JSON payload that renders a quoted dotenv file at mode0600. - Added a deterministic shell test (
test:secrets) that exercises validation failures and output hardening, and wired it intopnpm run verify. - Updated contributor/testing docs and
.env.exampleto document the new SOPS-based setup input (PUTIO_SDK_TYPESCRIPT_SOPS_FILE).
File summaries
| File | Description |
|---|---|
| scripts/secrets-setup.sh | Implements SOPS ciphertext inspection/decrypt, contract validation, and safe .env.local rendering. |
| scripts/secrets-setup.test.sh | Adds deterministic, secret-free integration tests for the setup wrapper and its failure modes. |
| package.json | Adds test:secrets and runs it as part of verify. |
| docs/TESTING.md | Updates live-test setup guidance to SOPS-based workflow. |
| CONTRIBUTING.md | Updates contributor instructions for secrets setup prerequisites and env input. |
| AGENTS.md | Updates agent routing notes to reference the SOPS ciphertext input. |
| .env.example | Replaces provider-specific setup hints with SOPS ciphertext input hint. |
Review details
Suppressed comments (1)
scripts/secrets-setup.sh:31
sops filestatusreturns JSON, but the script uses a regexgrepto detect encryption status. Sincejqis already a required dependency here, parsing the JSON withjq -eis more robust and avoids false positives/formatting edge cases.
status="$(sops filestatus "$ciphertext" 2>/dev/null)" \
|| fail "SOPS could not inspect ciphertext input"
printf '%s\n' "$status" | grep -Eq '"encrypted"[[:space:]]*:[[:space:]]*true' \
|| fail "ciphertext input is not encrypted"
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
There was a problem hiding this comment.
Review completed against the latest diff
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 5 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Final verificationInput
Output
Proof
|
## [11.1.0](v11.0.2...v11.1.0) (2026-08-02) ### Features * **secrets:** consume SOPS SDK payload ([#167](#167)) ([9db1adf](9db1adf))
|
🎉 This PR is included in version 11.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
Changed
PUTIO_SDK_TYPESCRIPT_SOPS_FILEis the only setup inputpnpm secrets:setuprequires encrypted SOPS input, validates exact keys and formats, renders dotenv safely, and writes mode0600Review aids
Input
Output
The output is gitignored, mode
0600, and contains the existing nine-key live SDK contract. Secret values are never accepted as command arguments or written to logs.Flow
Risks
secrets:setupandsecrets:cleancommand names and.env.localconsumer behavior are preserved.Verification
pnpm run verify— 24 files / 142 tests, coverage, formatting, lint, build, route validation, and synthetic SOPS contract testspnpm test:live:fresh -- test/live/account.test.ts test/live/tunnel.test.ts— 2 files / 9 tests passed; fresh first-party token cleanup completedpublintpassed; direct packed-tarballattw --profile esm-onlypassedshellcheck scripts/secrets-setup.sh scripts/secrets-setup.test.shComplexity
Moderate: one security-boundary shell wrapper, one synthetic contract test, and five documentation/config updates.
Summary by cubic
Switched
pnpm secrets:setupto consume a SOPS-encrypted SDK payload instead of provider-specific exports, with stricter validation and safer.env.localrendering. This makes setup provider-agnostic and keeps secrets ignored and0600.New Features
pnpm secrets:setupreadsPUTIO_SDK_TYPESCRIPT_SOPS_FILE, verifies exact keys and formats, and writes.env.localat mode0600.scripts/secrets-setup.test.shandtest:secrets; wired intoverify. Docs and.env.exampleupdated to SOPS-based setup.Bug Fixes
sops filestatus, reject symlinked ciphertext, and enforce repo-relative ignored output..env.localmode check portable across Linux and macOS.Written for commit d632bad. Summary will update on new commits.