Skip to content

fix: replace hardcoded credentials in tests with generated values (Snyk) - #218

Open
reeshika-h wants to merge 1 commit into
developmentfrom
fix/snyk-hardcoded-credentials-tests
Open

reeshika-h wants to merge 1 commit into
developmentfrom
fix/snyk-hardcoded-credentials-tests

Conversation

@reeshika-h

Copy link
Copy Markdown
Contributor

Summary

Resolves the Snyk Code NoHardcodedCredentials findings in this repo (91 findings, test code only).

  • Added a small TestSecrets helper to Contentstack.Management.Core.Tests and Contentstack.Management.Core.Unit.Tests that generates per-run values (password, email-shaped username, API-key-shaped value, token, valid/invalid base32 secret). None are real credentials.
  • Replaced the flagged literals in new NetworkCredential(...), API key / client secret / token variables and MFA secrets with TestSecrets. const strings became static readonly.
  • LoginServiceTest asserts the exact request body, so its username/password are now shared fields used in the expected strings.
  • Removed the // deepcode ignore suppression comments from the test projects (suppression is not an approved fix).
  • Intentionally left deliberate invalid-input cases (empty/whitespace username, <EMAIL>) as literals; they are not credentials.

No changes to Contentstack.Management.Core or Contentstack.Management.ASPNETCore, so no version bump / changelog entry is needed (the version-bump check ignores the test projects).

Verification

  • snyk code test --org=contentstack-developer-ecosystem: 0 issues (was 91).
  • Unit tests: 1350 passed, 0 failed.
  • Integration test project builds. Not run: it needs a local appSettings.json and live credentials; its login-failure scenarios use random credentials and should behave the same.

🤖 Generated with Claude Code

Replace hardcoded credentials, passwords, API keys and MFA secrets in the
unit and integration tests with per-run generated values (TestSecrets
helper) and remove the deepcode ignore suppression comments. Clears the
Snyk Code NoHardcodedCredentials findings. Tests only; no change to the
published package.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@reeshika-h
reeshika-h requested a review from a team as a code owner October 26, 2026 08:42
@snyk-io

snyk-io Bot commented Oct 26, 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 0 25 ✅ Passed
🟡 Medium Severity 0 0 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

✅ 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.

1 participant