From 5661525343a80440f6e451661698260618072de6 Mon Sep 17 00:00:00 2001 From: ThePlenkov <6381507+ThePlenkov@users.noreply.github.com> Date: Fri, 20 Nov 2026 17:01:29 +0100 Subject: [PATCH] Revert "chore(agents): enforce OSS isolation with a mechanical pre-push guard (#369)" This reverts commit cb6705fa7c2da8af4b1abacca225c73eec06bcc6. --- .agents/rules/git/oss-isolation.md | 71 ------------------------- .gitignore | 1 - AGENTS.md | 16 ------ scripts/oss-github-guard.sh | 84 ------------------------------ 4 files changed, 172 deletions(-) delete mode 100644 .agents/rules/git/oss-isolation.md delete mode 100755 scripts/oss-github-guard.sh diff --git a/.agents/rules/git/oss-isolation.md b/.agents/rules/git/oss-isolation.md deleted file mode 100644 index 4d89f648d..000000000 --- a/.agents/rules/git/oss-isolation.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -trigger: always_on -description: Zero internal context in any public GitHub contribution. Mandatory preflight before publishing to github.com. ---- - -# OSS Isolation Rule (public GitHub) - -## The rule - -**Public GitHub remotes (`origin`, `github.com`) and internal development -remotes are two separate worlds.** No internal context may ever appear in any -public GitHub artifact — not even as "evidence" or "provenance". - -This applies to **every** contribution channel, for **every** agent runtime -(Cursor, Claude Code, Codex, and any CLI agent): - -- PR titles, bodies, comments, and code-review replies -- Issues and issue comments -- Branch names and commit messages -- Author / committer emails (use the personal public identity, never a - corporate address) -- Code comments, test fixtures, documentation, changelogs - -## Forbidden patterns - -Never write or paste into anything destined for GitHub: - -| Pattern class | Example of the leak | -| --------------------------------------------------------- | -------------------------------------- | -| Corporate host names and internal group paths | shadow-MR / pipeline / work-item links | -| Corporate email domains in author metadata | commit author `@corp.example` | -| Internal system codenames | release train / environment names | -| Internal MR/pipeline/job numbers tied to internal systems | "!105", "builder 3029698363" | - -The concrete patterns for this organization live in -`scripts/.oss-guard-local.patterns` (local, untracked — never commit it). The -mechanical guard reads that file and adds its patterns to the generic scan. - -Generic engineering words (`canary`, `draft`, `shadow review`) are fine. -Internal _system names_ and _links_ are not. When unsure, drop the sentence — -the public PR must stand on its own without internal evidence. - -## Mandatory preflight (mechanical gate) - -Before **any** of these actions targeting a public remote: - -- `git push` to a `github.com` remote -- `gh pr create` / `gh pr edit` / `gh pr comment` / `gh issue create` - -run: - -```sh -scripts/oss-github-guard.sh # scans outgoing commits + branch name -scripts/oss-github-guard.sh --pr # scans live PR text via gh -``` - -The guard exits non-zero on any forbidden pattern. **A non-zero exit is a hard -stop** — fix the text, do not bypass, do not `--no-verify`. - -## Summarizing internal work for a public PR - -Rewrite from scratch in public terms: what the bug was, what changed, which -local tests pass. Internal MR numbers, pipelines, jobs, and system names are -never part of that story. If a commit message or prior PR body already -contains internal references, do not copy it — sanitize first. - -## Why this exists - -Prose alone failed: public contributions kept picking up internal links, -system codenames and corporate emails. The guard script plus this always-on -rule are the enforced baseline. diff --git a/.gitignore b/.gitignore index a7c7b6fd4..10a001f5f 100644 --- a/.gitignore +++ b/.gitignore @@ -190,4 +190,3 @@ gascity/AGENTS.md .beads-credential-key .beads/proxieddb/ *.gate.lock* -scripts/.oss-guard-local.patterns diff --git a/AGENTS.md b/AGENTS.md index fc839e2b8..d5b0573f6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -114,19 +114,3 @@ bd prime # Refresh Beads context **Architecture in one line:** issues live in a local Dolt DB; sync uses `refs/dolt/data` on your git remote; `.beads/issues.jsonl` is a passive export. See https://github.com/gastownhall/beads/blob/main/docs/core-concepts/sync-concepts.md for details and anti-patterns. - -## OSS isolation (mandatory) - -Public GitHub remotes and internal development remotes are separate worlds. -**Zero internal context in any public contribution** — titles, bodies, -comments, reviews, issues, branch names, commit messages, author/committer -emails, code comments and docs. - -The concrete forbidden patterns are organization-specific and live in -`scripts/.oss-guard-local.patterns` (local, untracked; see -`.agents/rules/git/oss-isolation.md`). - -Before any `git push` to a public remote or `gh pr create/edit/comment`: -run `scripts/oss-github-guard.sh` (the pre-push hook enforces this; a -non-zero exit is a hard stop). Full rule: -`.agents/rules/git/oss-isolation.md`. diff --git a/scripts/oss-github-guard.sh b/scripts/oss-github-guard.sh deleted file mode 100755 index 0af09fe53..000000000 --- a/scripts/oss-github-guard.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env sh -# oss-github-guard.sh — block non-public internal context from reaching public GitHub. -# -# Usage: -# scripts/oss-github-guard.sh # scan outgoing commits + branch name (pre-push mode or HEAD) -# scripts/oss-github-guard.sh --pr # scan a live PR's title/body/comments via gh -# scripts/oss-github-guard.sh --file # scan an arbitrary text file (e.g. a draft PR body) -# -# Exit 0 = clean, exit 1 = forbidden context found, exit 2 = usage/infra error. -# Installed as a pre-push hook it only fires for github.com remotes. - -set -u - -# Generic fallback patterns safe to publish. Organization-specific patterns -# live in scripts/.oss-guard-local.patterns (local, untracked): one regex -# fragment per line, OR-joined into the scan. Without that file only the -# generic patterns apply. -PATTERNS='@(corp|internal)\.example' -LABEL='internal / non-public context' -PATTERN_FILE="$(dirname "$0")/.oss-guard-local.patterns" -if [ -f "$PATTERN_FILE" ]; then - LOCAL=$(grep -vE '^\s*(#|$)' "$PATTERN_FILE" | paste -sd '|' -) - [ -n "$LOCAL" ] && PATTERNS="$PATTERNS|$LOCAL" -fi -TMP=$(mktemp) || exit 2 -trap 'rm -f "$TMP"' EXIT - -die() { - echo "OSS-GUARD: forbidden $LABEL detected in [$1]:" >&2 - grep -Ein "$PATTERNS" "$TMP" | sed 's/^/ /' >&2 - echo "OSS-GUARD: sanitize the text before publishing to github.com (see .agents/rules/git/oss-isolation.md)." >&2 - exit 1 -} - -scan() { # scan