Skip to content

Exclude .git/config and sanitize remote urls in metadata.json(AST-188620) - #1598

Merged
cx-sumit-morchhale merged 13 commits into
mainfrom
bug/AST-188620-gitConfigRepoUrl
Oct 27, 2026
Merged

cx-sumit-morchhale merged 13 commits into
mainfrom
bug/AST-188620-gitConfigRepoUrl

Conversation

@cx-sumit-morchhale

Copy link
Copy Markdown
Contributor

Summary

  • Implement credential stripping for git remote URLs in metadata.json
  • Prevents exposure of embedded tokens, PATs, and passwords
  • Manager's sanitizeRepoURL() approach with comprehensive test coverage

Changes

  • Added sanitizeRepoURL() function handling HTTP(S), SSH, and SCP-style URLs
  • Applied to both go-git and system git fallback paths
  • 14 new test cases covering all 16 URL pattern scenarios
  • All 30 existing tests pass with zero regressions

Supported Platforms

✅ GitHub, GitLab, Azure DevOps, Bitbucket, self-hosted Git, SSH

Test Plan

  • Unit tests: 14 new sanitizeRepoURL test cases
  • Integration tests: End-to-end credential stripping verification
  • Regression testing: All 30 existing tests passing
  • Manual testing: Verified on GitHub, GitLab, Azure DevOps, Bitbucket

@cx-sumit-morchhale
cx-sumit-morchhale requested a review from a team October 23, 2026 11:26
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

✅ No secrets detected

TruffleHog found no secrets in the current commits of this PR.

cx-rakesh-kadu
cx-rakesh-kadu previously approved these changes Oct 26, 2026
@cx-aniket-shinde
cx-aniket-shinde self-requested a review October 27, 2026 08:32
cx-sumit-morchhale and others added 2 commits October 27, 2026 14:03
Revert the TruffleHog comment suppressions that were added as a temporary
workaround. The security-hardened sanitizeRepoURL() function properly
sanitizes credentials before they reach logs, making these suppressions
unnecessary.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Move hardcoded .git/config file exclusion logic into BaseExcludedFiles array
in params/filters.go. Refactor scan.go to loop through this array for file
filtering, making it easy to add more excluded credential files in the future
without modifying scan.go logic. No change in functionality - maintains exact
original behavior for .git/config exclusion.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

@cx-anurag-dalke cx-anurag-dalke left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ok

Comment thread internal/commands/scan.go Resolved
Comment thread internal/params/filters.go Resolved
@stepsecurity-app

stepsecurity-app Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

✅ Resolved — a later workflow run passed this policy check.

Original alert (resolved)

Security Policy Alert: Secret Policy Violation

This workflow run has been blocked by StepSecurity's secrets policy because it accesses secrets and the workflow file differs from the default branch.

Secret references detected:

  • secrets.CX_BASE_URI at line 222
  • secrets.CX_CLIENT_ID at line 223
  • secrets.CX_CLIENT_SECRET at line 224
  • secrets.CX_BASE_AUTH_URI at line 225
  • secrets.CX_AST_USERNAME at line 226
  • secrets.CX_AST_PASSWORD at line 227
  • secrets.CX_APIKEY at line 228
  • secrets.CX_TENANT at line 229
  • secrets.CX_SCAN_SSH_KEY at line 230
  • secrets.ECHO_LIBRARIES_ACCESS_KEY at line 232
  • secrets.PERSONAL_ACCESS_TOKEN at line 234
  • secrets.PROXY_USER at line 237
  • secrets.PROXY_PASSWORD at line 238
  • secrets.PR_GITLAB_TOKEN at line 243
  • secrets.PR_GITLAB_NAMESPACE at line 244
  • secrets.PR_GITLAB_REPO_NAME at line 245
  • secrets.PR_GITLAB_PROJECT_ID at line 246
  • secrets.PR_GITLAB_IID at line 247
  • secrets.AZURE_ORG at line 248
  • secrets.AZURE_PROJECT at line 249
  • secrets.AZURE_REPOS at line 250
  • secrets.AZURE_TOKEN at line 251
  • secrets.BITBUCKET_WORKSPACE at line 253
  • secrets.BITBUCKET_REPOS at line 254
  • secrets.BITBUCKET_USERNAME at line 255
  • secrets.BITBUCKET_PASSWORD at line 256
  • secrets.GITLAB_TOKEN at line 257
  • secrets.PR_BITBUCKET_TOKEN at line 259
  • secrets.MS_TEAMS_WEBHOOK_URL_INTEGRATION_TESTS at line 438

To approve this workflow, please add the workflows-approved label to this PR.

Note: The label must be added by someone other than the PR author (cx-sumit-morchhale) or automation bots to ensure proper security review.

After the label is added, you can re-run the blocked workflow to proceed.

This workflow will be automatically approved once merged into the default branch.

For more information, see StepSecurity's Secret Exfiltration Policy documentation.

cx-rahul-pidde
cx-rahul-pidde previously approved these changes Oct 27, 2026
@cx-kedar-bhujade
cx-kedar-bhujade self-requested a review October 27, 2026 09:54
Request bodies are dumped JSON-encoded, so the newlines of an SSH private
key passed via --ssh-key appear as \n and the raw-value match in
sanitizeLogs never fired, leaking the full key to --debug, --log-file and
--log-file-console output. Mask each sensitive value's JSON-escaped form
as well as its raw form.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192KJFhBn6ugdPZATtdadJm
@cx-atish-jadhav
cx-atish-jadhav self-requested a review October 27, 2026 10:36
@cx-sumit-morchhale
cx-sumit-morchhale merged commit cbf2720 into main Oct 27, 2026
26 of 32 checks passed

This branch had an error being deployed

1 failed deployment
release — f3bda0c3 Deployed Oct 27, 2026 by cx-sumit-morchhale via Build, Sign & Publish Release #1035
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.

8 participants