Skip to content

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

Open
cx-sumit-morchhale wants to merge 4 commits into
mainfrom
bug/AST-188620-gitConfigRepoUrl
Open

cx-sumit-morchhale wants to merge 4 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

⚠️ Potential secret(s) detected (unverified)

@cx-sumit-morchhale — TruffleHog found 12 potential secret(s) in this PR (0 verified, 12 unverified).

Secret Type Status Commit File Path View
URI ⚠️ unverified 0996fc220b internal/commands/gitmetadata_test.go 🔎 View secret
URI ⚠️ unverified 0996fc220b internal/commands/gitmetadata_test.go 🔎 View secret
URI ⚠️ unverified 0996fc220b internal/commands/gitmetadata_test.go 🔎 View secret
URI ⚠️ unverified 0996fc220b internal/commands/gitmetadata_test.go 🔎 View secret
URI ⚠️ unverified 0996fc220b internal/commands/gitmetadata_test.go 🔎 View secret
URI ⚠️ unverified 0996fc220b internal/commands/gitmetadata_test.go 🔎 View secret
URI ⚠️ unverified 6fb5248d7e internal/commands/gitmetadata_test.go 🔎 View secret
URI ⚠️ unverified 6fb5248d7e internal/commands/gitmetadata_test.go 🔎 View secret
URI ⚠️ unverified 6fb5248d7e internal/commands/gitmetadata_test.go 🔎 View secret
URI ⚠️ unverified 6fb5248d7e internal/commands/gitmetadata_test.go 🔎 View secret
URI ⚠️ unverified 6fb5248d7e internal/commands/gitmetadata_test.go 🔎 View secret
URI ⚠️ unverified 6fb5248d7e internal/commands/gitmetadata_test.go 🔎 View secret

🛠 Guidelines to remediate hardcoded secrets

To avoid such incidents in the future consider:

  • Following the best practices for managing and storing secrets, including API keys and other credentials.
  • Re-scan after cleanup before merging.

⚠️ These are unverified matches and do not block the merge — please review and confirm they are not real secrets.

This branch has not been deployed

No deployments
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