Skip to content

fix(security): enforce SSH-only git remotes estate-wide (standards#69)#147

Merged
hyperpolymath merged 2 commits into
mainfrom
fix/ssh-remote-enforcement
May 19, 2026
Merged

fix(security): enforce SSH-only git remotes estate-wide (standards#69)#147
hyperpolymath merged 2 commits into
mainfrom
fix/ssh-remote-enforcement

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Summary

  • Wires token-in-URL detection into governance-reusable.yml (security-policy job) as a new SSH-remote policy step: scans every .git/config present in the checkout tree for x-access-token:, gho_, ghp_, ghs_, and github_pat_ credentials embedded in HTTPS remote URLs; fails hard on any hit. All downstream repos that call the governance bundle inherit this check automatically via the single uses: delegation.
  • Updates REMOTE-URL-POLICY.adoc (→ v1.1.0): records the 2026-05-19 recursive audit (1 offender found and remediated locally), upgrades the detection one-liner to recurse all .git trees rather than just ~/dev/*/, and expands the Enforcement section with the CI gate reference, a recommended pre-push hook, and provisioning guidance.

Audit result (2026-05-19)

Full recursive sweep of ~130 .git/config files under /home/hyperpolymath/dev (repos, scratch, tools, worktrees, audit clones):

Repo Remote Masked URL Action
dev/repos/file-soup origin https://x-access-token:gho_****@github.com/hyperpolymath/file-soup Switched to git@github.com:hyperpolymath/file-soup.git (local .git/config only)

All other repos were already on SSH or plain HTTPS (no embedded credential).

Outstanding owner action (EXTERNAL — not resolved by this PR)

Token rotation required.
The token gho_**** (prefix gho_1q9dB2…) was found in dev/repos/file-soup/.git/config. A token that has appeared in a URL is considered compromised regardless of whether it was pushed. The owner must revoke/rotate it at:
https://github.com/settings/tokens

This is a manual browser action; it cannot be automated here.

Test plan

  • CI passes on this PR (governance-reusable SSH-remote policy step shows ✅)
  • Manually verify git remote -v in dev/repos/file-soup shows SSH form
  • Owner rotates the exposed token at github.com/settings/tokens
  • Human review + merge (no --admin; Refs not Closes)

Refs #69

Wire token-in-URL detection into the estate CI gate (governance-reusable.yml
security-policy job) so any `.git/config` containing an x-access-token/gho_/
ghp_/ghs_/github_pat_ HTTPS credential fails the PR check immediately.

Update REMOTE-URL-POLICY.adoc (→ v1.1.0) to:
- record the 2026-05-19 recursive audit result (1 offender: file-soup, now fixed)
- upgrade the detection one-liner to recurse all .git trees (not just ~/dev/*/)
- expand the Enforcement section: CI gate reference, recommended pre-push hook,
  provisioning guidance

The local remediation (file-soup origin → SSH) was applied directly to the
.git/config; it is a local change, not a commit.

Outstanding owner action: rotate token gho_**** (found in file-soup/.git/config)
at https://github.com/settings/tokens — see REMOTE-URL-POLICY.adoc §4.

Refs #69

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hyperpolymath hyperpolymath marked this pull request as ready for review May 19, 2026 21:32
@hyperpolymath hyperpolymath merged commit d3bcc83 into main May 19, 2026
14 of 16 checks passed
@hyperpolymath hyperpolymath deleted the fix/ssh-remote-enforcement branch May 19, 2026 21:33
@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 101 issues detected

Severity Count
🔴 Critical 63
🟠 High 28
🟡 Medium 10

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance-reusable.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Python file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/standards/standards/a2ml-templates/state-scm-to-v2.py",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/standards/standards/a2ml/bindings/deno/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/standards/standards/lol/test/vitest.config.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/standards/standards/k9-svc/bindings/deno/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
    "type": "believe_me",
    "file": "/home/runner/work/standards/standards/lol/src/abi/Locale.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  },
  {
    "reason": "Wildcard CORS -- restrict to specific origins or use env var (1 occurrences, CWE-942)",
    "type": "js_wildcard_cors",
    "file": "/home/runner/work/standards/standards/consent-aware-http/examples/reference-implementations/deno/aibdp_middleware.js",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

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