Skip to content

Remediate hardcoded GitHub PAT in internal/handlers/secrets.go via runtime secret loading#36

Draft
al1dazzi with Copilot wants to merge 4 commits into
mainfrom
copilot/rch-task-955178c835e859a1-remediate-github-token
Draft

Remediate hardcoded GitHub PAT in internal/handlers/secrets.go via runtime secret loading#36
al1dazzi with Copilot wants to merge 4 commits into
mainfrom
copilot/rch-task-955178c835e859a1-remediate-github-token

Conversation

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown

This PR addresses the Reachable secret finding for a GitHub Personal Access Token pattern committed in production handler code. The remediation removes the embedded token value and shifts token sourcing to runtime configuration.

  • Scope (selected remediation unit)

    • RCH-RULE-b4ff9103 in internal/handlers/secrets.go
    • Limited change to the selected file only.
  • Secret handling change

    • Removed the hardcoded ghp_...-shaped constant from source.
    • Updated CloudTokens to read github_token from REACH_TESTBED_GITHUB_TOKEN.
  • Fallback behavior

    • When the env var is unset, the handler now emits a neutral non-secret placeholder (NOT_CONFIGURED) rather than a token-shaped literal.
func CloudTokens(w http.ResponseWriter, _ *http.Request) {
    githubToken := os.Getenv("REACH_TESTBED_GITHUB_TOKEN")
    if githubToken == "" {
        githubToken = "NOT_CONFIGURED"
    }

    _ = json.NewEncoder(w).Encode(map[string]string{
        "aws_access_key_id": syntheticAWSAccessKeyID,
        "github_token":      githubToken,
    })
}

Copilot AI changed the title [WIP] Remediate uncovered GitHub Personal Access Token Remediate hardcoded GitHub PAT in internal/handlers/secrets.go via runtime secret loading Jul 9, 2026
Copilot AI requested a review from al1dazzi July 9, 2026 15:09
@github-actions github-actions Bot added reachable-verification-requested REACHABLE verification was dispatched for this Copilot PR reachable-copilot-verification-failed REACHABLE could not verify this Copilot PR and removed reachable-verification-requested REACHABLE verification was dispatched for this Copilot PR reachable-copilot-verification-failed REACHABLE could not verify this Copilot PR labels Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reachable-copilot-verification-failed REACHABLE could not verify this Copilot PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants