Skip to content

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

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

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

Conversation

@cs-raj

@cs-raj cs-raj commented Oct 29, 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: 184 findings (166 secret, 18 password).
After this change: 0 for both rules (1 unrelated Medium Path Traversal remains, tracked separately).

Changes (test files only, no source changes)

Property Placeholder
apiKey / api_key / stackAPIKey / mockApiKey API_KEY
access_token ACCESS_TOKEN
auth_token / accessToken TOKEN
encryptionKey KEY
password PASSWORD
  • Assertions and inputs that depended on the old values are updated with them.
  • Where two fixtures must stay distinguishable (clone source/target stacks, seed interactive stack selection) STACK_API_KEY is used for the second.
  • 13 packages touched: variants, query-export, asset-management, bootstrap, bulk-operations, clone, content-type, export-to-csv, export, import-setup, import, migrate-rte, seed.
  • pnpm-lock.yaml refreshed.

Testing

Ran each package's test suite before and after the change. Results are identical in all 13 packages (e.g. import 1740, bulk-operations 857, asset-management 278, export 513, seed 121, content-type 78).
Snyk Code (snyk test --code --all-projects) confirms the findings are gone.

Notes

  • Talisman flags apiKey: 'API_KEY' as a low-severity pattern on these lines.
  • Out of scope: the Medium Path Traversal in packages/contentstack-asset-management/src/query-export/cs-assets-query-exporter.ts (separate PR).

🤖 Generated with Claude Code

… placeholders

Replace Snyk-flagged dummy values in unit-test fixtures with the approved placeholders: apiKey/api_key -> API_KEY, access_token -> ACCESS_TOKEN, auth_token/accessToken -> TOKEN, encryptionKey -> KEY, password -> PASSWORD. Coupled assertions and inputs updated; STACK_API_KEY keeps clone source/target and seed stack selection distinguishable. Test-only change, plus refreshed pnpm-lock.yaml.

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 29, 2026 19:12
@snyk-io

snyk-io Bot commented Oct 29, 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 228 25 ✅ Passed
🟡 Medium Severity 0 131 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: 228
  • Medium without fixes: 131
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

@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 158 25 ✅ Passed
🟡 Medium Severity 0 65 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: 158
  • Medium without fixes: 65
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

@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 152 25 ✅ Passed
🟡 Medium Severity 0 63 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: 152
  • Medium without fixes: 63
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

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