{
  "schema": "vedokrok.public-item.v1",
  "release_id": "MHC-RPUB-20260920-75ad787a",
  "url": "/knowledge/block-secrets-before-they-become-repository-history",
  "id": "MHC-D-RESEARCH-0664",
  "version": "0.1.0",
  "title": "Block secrets before they become repository history",
  "summary": "Deleting a secret after merge is slower than never committing it.",
  "kind": "protocol",
  "body": "Keep real secrets out of prompts and repositories, and enable pre-push or equivalent secret detection where available. Exclude sensitive files from agent context when the tool supports it. If a detector fires, remove the credential from the change and investigate why it entered the agent's path.",
  "limits": [
    "Secret scanning has coverage gaps and bypass paths; prevention still starts with credential handling and least privilege."
  ],
  "topics": [
    "union-ai-assisted-coding-safeguards"
  ],
  "intents": [],
  "source_ids": [
    "RS-5513871E336DE735",
    "RS-1C68AE8325C384C0"
  ],
  "evidence": [
    {
      "claim": "GitHub push protection can block supported secret patterns before they reach protected repositories, while GitHub notes that scanning coverage has limits.",
      "source_id": "RS-5513871E336DE735",
      "role": "supports",
      "note": "Not all secrets or encodings are detected, and bypass mechanisms exist.",
      "locator": "What is push protection; supported behavior"
    },
    {
      "claim": "OWASP's current secure-coding-with-AI guidance treats repository content, issues, PRs, comments, fetched pages, logs and tool responses as potential indirect prompt-injection inputs for coding agents.",
      "source_id": "RS-1C68AE8325C384C0",
      "role": "supports",
      "note": "Threat likelihood depends on who can influence the content and what permissions the agent has.",
      "locator": "Indirect Prompt Injection in the Development Loop"
    }
  ],
  "use_when": [
    "A coding agent may see local configuration, examples or logs containing credentials."
  ],
  "avoid_when": [
    "Secret scanning has coverage gaps and bypass paths; prevention still starts with credential handling and least privilege."
  ],
  "example": "A generated test accidentally includes a live API token; push protection blocks the commit and the team replaces it with a test fixture.",
  "check": "Supported secrets are stopped before the protected repository receives them.",
  "steps": [
    "Secrets stored outside source.",
    "Sensitive context exclusions configured.",
    "Pre-push scanning enabled where available.",
    "Blocked secret investigated.",
    "Bypasses are exceptional and reviewed."
  ],
  "sources": [
    {
      "id": "RS-5513871E336DE735",
      "title": "Push protection",
      "url": "https://docs.github.com/en/code-security/concepts/secret-security/push-protection"
    },
    {
      "id": "RS-1C68AE8325C384C0",
      "title": "Secure Coding with AI Cheat Sheet",
      "url": "https://cheatsheetseries.owasp.org/cheatsheets/Secure_Coding_with_AI_Cheat_Sheet.html"
    }
  ],
  "relations": [
    {
      "from": "MHC-D-RESEARCH-0664",
      "to": "MHC-D-RESEARCH-0665",
      "type": "use_before",
      "url": "/knowledge/rotate-an-exposed-credential-even-after-the-text-is-removed"
    }
  ],
  "collections": [
    {
      "id": "RC-E25DB1788236EF13",
      "title": "Let coding agents move fast inside a reviewable security boundary",
      "url": "/collections/let-coding-agents-move-fast-inside-a-reviewable-security-boundary"
    }
  ]
}
