Skip to content

feat(variables): manage secrets with --secret, remove launch:secrets (+Claude) - #322

Open
tejas-contentstack wants to merge 6 commits into
v2-devfrom
CL-8991
Open

tejas-contentstack wants to merge 6 commits into
v2-devfrom
CL-8991

Conversation

@tejas-contentstack

@tejas-contentstack tejas-contentstack commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Authored by Claude Code (AI agent) for tejas. Please review as agent-written code.

Jira: https://contentstack.atlassian.net/browse/CL-8991

Rebuilt on v2-dev 4c4eed9 (the revert of #275 removed src/secrets/ that --secret reuses): commit 1 brings back the secrets API, errors and rules plus the gluedValue test helper; commit 2 is the feature.

--secret KEY on launch:variables:set, one PATCH …/variables carrying set, unset and secrets (CL-9225, merged). variables:list shows both kinds with TYPE, variables:unset works out each key's kind, and launch:secrets:* is removed with no aliases.

Review map (read in this order; commit 1 is the restored secrets module, mostly unchanged code)

  1. variables.api.ts, variable.writer.ts, variable.errors.ts: secrets in the PATCH, redaction, 409 naming
  2. variable.set.ts, variable.secrets.ts, variable.rules.ts, variable.summary.ts, variable.inputs.ts, core/secret-input.ts: the --secret flow
  3. variable.page/presenter/unset.ts, commands/launch/variables/{list,unset}.ts
  4. deletions: commands/launch/secrets/*, secrets/*, package.json topics

Calls made

  • --dotenv - returns for variables:set only when --secret is given (CL-9055 removed it; AC2/AC4 need it).
  • Moving a variable to a secret is CL-8992: --secret KEY on a variable fails with KEY is a variable.
  • Client-side limits cover only what the CLI sees; the server decides.
  • The pre-commit Snyk step was skipped (7 v2-dev dependency issues, owner's decision); secrets scan and lint-staged were run by hand.

Known gaps

  • Race: a variable created between the CLI's read and its PATCH is moved by the server unasked (cl9225); for CL-8992.
  • Checks on held keys and the secret-prefix warning run after some prompts; unset prints a refused PATCH's message twice; the empty-dotenv-value notice says "variable".
  • Coverage gate is below 100% on the base commit too (same 15 files).

Merge order: this PR, then the harness PR in contentfly-dev-workspace.

QA: the Launch QA agent tests CL-8991 in the repos once it is in QA; GoCD sanity covers dev11.

https://claude.ai/code/session_01EptZEfZLCf4WPLtJ9qnHom


Generated by Claude Code

@tejas-contentstack
tejas-contentstack requested a review from a team as a code owner December 3, 2026 20:42
@gitguardian

gitguardian Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 3 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
42622630 Triggered Generic CLI Secret a2ea5be src/variables/variable.inputs.test.ts View secret
42622631 Triggered Generic CLI Secret a2ea5be src/variables/variable.inputs.test.ts View secret
42571743 Triggered Generic CLI Secret a2ea5be test/integration/variables-set-unset.test.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

Guides

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@snyk-io

snyk-io Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 4 14 25 ✅ Passed
🟡 Medium Severity 2 13 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 14
  • Medium without fixes: 13
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

Copy link
Copy Markdown
Contributor Author

GitGuardian's 4 "Generic CLI Secret" hits on this PR point at test code, not credentials: src/variables/variable.inputs.test.ts lines 81 and 100 (a250b15) and test/integration/variables-set-unset.test.ts lines 799 (a250b15) and 977 (fed85e0). Those lines are test titles and argument arrays containing --secret (for example 'exits 2 for --secret KEY=value %s …' and ['--secret', 'A,B', '--secret', 'C']); every secret value in the tests comes from gluedValue() at runtime, and the repo's Talisman and TruffleHog scans pass. Snyk passes. I have not dismissed the finding: the incidents need a person on the security side to mark them as false positives, or the titles can be reworded if you prefer; the older commit (a250b15) would still carry the pattern unless history is rewritten.


Generated by Claude Code

Comment thread src/variables/variable.set.ts Outdated
assertByteLimit([...variables, ...secrets]);

keys.forEach((key) => {
const warning = clientExposedWarning(key);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important: replacing a secret's value now happens with no confirmation, and the client-exposed-prefix warning is printed only after every value has been collected and right before the PATCH, so the user cannot act on it. launch:secrets:set asked Are you sure you want to add / replace the value of the secret KEY? after the warning and required --yes when piping; setWithSecrets dropped both. For example, --secret NEXT_PUBLIC_STRIPE_KEY on a terminal prompts for the value, prints "Do not keep a credential under this name", then writes it straight away. An existing secret's write-only value is also overwritten with no prompt and cannot be recovered. Fix: print the warnings before the first prompt, and confirm (or require --yes without a terminal) before the PATCH, at least when it updates a held secret or a key has a client-exposed prefix.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the client-exposed-prefix warnings ahead of the first prompt or stdin read (58d46e7). I did not add a confirmation or --yes: the ticket (AC3) and TRD D4 say add and Replace run with no confirmation and no --yes. If you want one for held secrets or prefixed keys, say so and I'll add it, since that changes AC3/D4.

— 🤖 launch-developer-agent (Claude)


Generated by Claude Code

Comment thread src/variables/variable.unset.ts Resolved
Comment thread src/variables/variable.errors.ts Resolved
Comment thread src/variables/variable.set.ts Resolved
Comment thread src/variables/variable.unset.ts Resolved
Comment thread src/variables/variables.api.ts Resolved
Comment thread src/variables/variable.secrets.ts Resolved

@tejas-contentstack tejas-contentstack left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not approved: a high-effort review found 7 issues (4 important, 3 nits), posted as inline comments. The GitGuardian Security Checks check is failing, and this PR was opened by the account this review runs as, so it cannot approve it anyway.

— 🤖 Claude review (Opus 5.5, high effort)


Generated by Claude Code

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 4 14 25 ✅ Passed
🟡 Medium Severity 2 13 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 14
  • Medium without fixes: 13
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

…--secret reuses

Restores the parts of the reverted secrets module that the variables
commands build on: SecretsApi (list and remove), the secret error
wording, the key rules, the secret input pieces, the glued-value test
helper, the secrets entry in the api surface and its layering edge.
None of the launch:secrets commands come back.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
variables:set takes --secret KEY and sends variables and secrets in one
PATCH, variables:list shows both in one table, and variables:unset
removes either kind. The launch:secrets commands stay removed; the
README and AGENTS.md describe the new flow.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Copy link
Copy Markdown
Contributor Author

Rebased onto v2-dev 4c4eed9 (the revert of #275 removed src/secrets/, which --secret reuses): the branch is now two commits, one bringing back the secrets API, errors and rules and the gluedValue test helper, one with the feature; the tree is the same as before apart from .talismanrc. Conflicts: the secrets files and .talismanrc, resolved by keeping what the base removed and our final versions of what we reuse. Full suite, build, tsc and eslint green.

— 🤖 launch-developer-agent (Claude)


Generated by Claude Code

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 4 14 25 ✅ Passed
🟡 Medium Severity 2 13 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 14
  • Medium without fixes: 13
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

…firmation

CL-8991: per TRD D4 a secret is added or replaced with no prompt and no --yes.
The command description now says so, and that a client-exposed prefix
(NEXT_PUBLIC_) prints a warning before any value is asked.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EptZEirUBSbkUz3Gh8Xzzo
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 4 14 25 ✅ Passed
🟡 Medium Severity 2 13 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 14
  • Medium without fixes: 13
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

Copy link
Copy Markdown
Contributor Author

@GitGuardian these 3 "Generic CLI Secret" findings (incidents 42571743, 42622630, 42622631) are false positives. They are test inputs, not credentials.

  • test/integration/variables-set-unset.test.ts (incident 42571743): a negative test that --secret KEY=value is rejected. The test asserts exit code 2, the error message, that nothing is prompted or sent, and that the value never appears in output. The value is generated at runtime by test/support/glued-value.ts; no literal secret is committed.
  • src/variables/variable.inputs.test.ts, line 100 (incident 42622630): a negative test that a value typed after --secret KEY is rejected as a stray argument. The value comes from the same runtime generator.
  • src/variables/variable.inputs.test.ts, line 81 (incident 42622631): a parser test for --secret A,B --secret C. These are key names only, not values.

The CLI itself does not accept --secret KEY=value: it is a usage error and the value is never echoed, as these tests check. Please close the incidents as false positive (test credential).


Generated by Claude Code

Brings in PR #324 (cloud-functions path parameters in request.query).
Conflicted file: .talismanrc, the AGENTS.md checksum entry, resolved by
keeping both sides' AGENTS.md changes and refreshing its checksum.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Copy link
Copy Markdown
Contributor Author

Merged origin/v2-dev (2292b73, PR #324) into the branch as a plain merge commit (this branch holds a commit from another session, so no rebase): the only conflict was the AGENTS.md checksum line in .talismanrc, recomputed on the merged file. Full suite, build, tsc and eslint green.

— 🤖 launch-developer-agent (Claude)


Generated by Claude Code

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 4 14 25 ✅ Passed
🟡 Medium Severity 2 13 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 14
  • Medium without fixes: 13
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

Conflict in .talismanrc (the AGENTS.md checksum). Resolved by keeping
the base's other changes and recomputing the AGENTS.md checksum with
Talisman for the merged file.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Copy link
Copy Markdown
Contributor Author

Merged origin/v2-dev (424a26d: the Snyk dependency fixes of #325 and the functions fixes of #326) into the branch as a plain merge commit (no rebase: this branch holds a commit from another session); the only conflict was the AGENTS.md checksum in .talismanrc, recomputed on the merged file. The repo's pre-commit hook, including snyk test, passed on the merge. Full suite, build, tsc and eslint green.

— 🤖 launch-developer-agent (Claude)


Generated by Claude Code

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 2 25 ✅ Passed
🟡 Medium Severity 0 10 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 2
  • Medium without fixes: 10
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

Brings in the functions fixes from #327, #328 and #329. The only
conflict was .talismanrc, the AGENTS.md checksum line: both sides had
changed it, so it is recomputed with Talisman for the merged AGENTS.md.
All of our other .talismanrc entries are kept as they were.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Copy link
Copy Markdown
Contributor Author

Merged origin/v2-dev (91c1d72: the functions fixes of #327–#329) into the branch as a plain merge commit (no rebase: this branch holds a commit from another session); the only conflict was the AGENTS.md checksum in .talismanrc, recomputed on the merged file. The repo's pre-commit hook passed on the merge. Full suite, build, tsc and eslint green.

— 🤖 launch-developer-agent (Claude)


Generated by Claude Code

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 2 25 ✅ Passed
🟡 Medium Severity 0 10 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 2
  • Medium without fixes: 10
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

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.

3 participants