Skip to content

fix: replace hardcoded secret literals in test fixtures with approved placeholders - #2743

Merged
cs-raj merged 2 commits into
developmentfrom
fix/hardcoded-secrets-test-fixtures
Oct 30, 2026
Merged

cs-raj merged 2 commits into
developmentfrom
fix/hardcoded-secrets-test-fixtures

Conversation

@cs-raj

@cs-raj cs-raj commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Snyk Code flagged hardcoded values in unit-test fixtures ("Hardcoded Non-Cryptographic Secret" and "Use of Hardcoded Passwords"). All of them were dummy test values, not real credentials. This replaces them with the approved placeholders from the team's "Standard Approved Dummy Secrets" doc.

Snyk Code on development before: 15 findings. After this change: 10 test-file findings cleared; 5 remain, all in src/ (see Notes).

Changes (test files only, no source changes)

Property Placeholder
apiKey API_KEY / STACK_API_KEY (kept distinct in tokens-remove.test.ts)
access_token ACCESS_TOKEN
password PASSWORD
MFA test secrets (valid base32 required) SECRET / TOKEN
  • Assertions that depended on the old values (expected token option strings in tokens-remove.test.ts) are updated with them.
  • pnpm-lock.yaml refreshed.

Testing

@contentstack/cli-utilities: 199 passing with the changes. @contentstack/cli-auth tests are run separately (needs cli-command built).
Snyk Code (snyk test --code --all-project) confirms the 10 test findings are gone.

Notes / out of scope

The 5 remaining findings are in source code and intentionally untouched here:

  • contentstack-utilities/src/encrypter.ts:14 and :27 (default encryption key and scrypt salt; changing them would break decryption of existing stored data)
  • contentstack-utilities/src/helpers.ts:119 and :121 (error-message label map, false positive)
  • contentstack-utilities/src/auth-handler.ts:147 (http.createServer for the local OAuth callback)

🤖 Generated with Claude Code

… placeholders

Replace Snyk-flagged dummy values in unit-test fixtures with the approved placeholders: apiKey -> API_KEY / STACK_API_KEY, access_token -> ACCESS_TOKEN, password -> PASSWORD, MFA test secrets -> SECRET / TOKEN. Coupled assertions updated. Test-only change, plus refreshed pnpm-lock.yaml. No source changes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cs-raj
cs-raj requested a review from a team as a code owner October 30, 2026 03:18
@snyk-io

snyk-io Bot commented Oct 30, 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

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 90 25 ✅ Passed
🟡 Medium Severity 1 79 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

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 1 90 / 365 days ⚠️ Warning
🔵 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: 90
  • Medium without fixes: 79
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

mfa-handler requires >=16 char base32 secrets; the placeholder values were too short and failed CI.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

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 90 25 ✅ Passed
🟡 Medium Severity 1 79 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

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 1 90 / 365 days ⚠️ Warning
🔵 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: 90
  • Medium without fixes: 79
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

@cs-raj
cs-raj merged commit 0d2f7ad into development Oct 30, 2026
11 checks passed
@cs-raj
cs-raj deleted the fix/hardcoded-secrets-test-fixtures branch October 30, 2026 05:20
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