feat: fail-closed guard against proprietary source in this public repo - #160
Conversation
marc-n-dream
left a comment
There was a problem hiding this comment.
⚪ No Jira key on the branch or PR — reviewed on the PR body alone.
Nothing blocking. I ran the guard instead of trusting its comment block: clean full-tree scan, all 19 deny paths blocked, all 10 accepted paths passed, delete-only commit survives set -u on stock bash 3.2, and the allowlist currently rescues exactly one file (itself). Four things to look at — the pick of them being a fail-open in a script headed "fail-closed".
Scope note: the "What" section lists four files; the diff touches eleven. The .serena/** untracking and the .gitignore rewrite appear nowhere in the body — flagged inline.
marc-n-dream
left a comment
There was a problem hiding this comment.
⚪ No Jira key on the branch or PR — reviewed on the PR body alone.
Second pass at the same commit; the four findings from the earlier review still stand and are not repeated. Three new ones, and the headline is that .mm sits on the accepted list while 2,493 lines of native Objective-C++ already ship in this public repo under it — legitimately, as it turns out, which is precisely what the documentation neglects to say.
Verified this round beyond the last pass: the gate genuinely runs and passes in CI (No proprietary source green on both the push and pull_request events for this head), the generated deny regex is well-formed, DENY_PATTERN/DENY_REASON are 13/13 so no reason-drift, and there is no Java or Kotlin anywhere in the tree — tracked, untracked, or ignored. The Android half of the boundary holds: native ships as unityandroidlibrary.aar and WebViewPlugin-*.aar.tmpl.
33a9c7d to
e706cce
Compare
- .githooks/pre-commit: fail closed when the checker script is missing (was exit 0)
- .githooks/pre-merge-commit: new — the guard now runs on merge commits too
- .github/workflows/no-proprietary-source.yml: scope GITHUB_TOKEN to contents: read
- scripts/check-proprietary-source.sh: deny *.iml / .idea/{modules,misc,gradle}.xml
- AGENTS.md + script header: document the .mm exception (upstream unity-webview,
zlib licence) instead of leaving it an unexplained gap in the private-source claim
- .gitignore: restore trailing newline
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Block native (Java/Kotlin) source, the private Gradle build system, and the private build pipeline from this public repo. Native code ships only as compiled .aar/.unitypackage/.bundle artifacts; the source lives in the private airconsole-unity-android-plugin and airconsole-unity-webview repos. Denylist (scripts/check-proprietary-source.sh, bash 3.2 safe): - *.java/*.kt/*.kts, *.gradle, *.pro, gradle wrapper/properties - *.sh/Rakefile/*.rake build scripts, *.toml version catalogs - AndroidManifest.xml, src/main/res/, .gitmodules - source patterns also match backup/merge suffixes (.orig/.bak/~/.txt) Allowlist: Unity gradle templates, this script, content-free *.meta. Layers: - .githooks/pre-commit: fast local gate (git config core.hooksPath .githooks) - .github/workflows/no-proprietary-source.yml: authoritative CI gate on every push (any branch) and PR, plus a submodule-gitlink rejection - .gitignore: ignore *.orig/*.bak/*~ so leaked source is not staged at all - AGENTS.md: contributor rules + hook install Denylist and layering verified against an adversarial red-team of the two private repos' full file inventory (10 confirmed gaps closed). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- .githooks/pre-commit: fail closed when the checker script is missing (was exit 0)
- .githooks/pre-merge-commit: new — the guard now runs on merge commits too
- .github/workflows/no-proprietary-source.yml: scope GITHUB_TOKEN to contents: read
- scripts/check-proprietary-source.sh: deny *.iml / .idea/{modules,misc,gradle}.xml
- AGENTS.md + script header: document the .mm exception (upstream unity-webview,
zlib licence) instead of leaving it an unexplained gap in the private-source claim
- .gitignore: restore trailing newline
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
e8ee4ed to
835e708
Compare
Why
This repository is public. The Android and webview repos that feed it are private, and only
compiled artifacts (
.aar,.aar.tmpl,.unitypackage,.bundle) plus accepted glue(
.cs,.jslib,.mm) are supposed to cross the boundary. A leak of native source here isirreversible, so the bar is "a routine mistake cannot leak it" — not "reviewers will notice".
What
scripts/check-proprietary-source.sh— denylist guard, bash 3.2 safe. Blocks*.java/*.kt(plus
.orig/.bak/~variants),*.gradle,*.pro,*.sh,*.toml,Rakefile/*.rake,the gradle wrapper,
.gitmodules,AndroidManifest.xmlandsrc/main/res/. Allowlists Unitygradle templates, the guard script itself, and content-free
*.meta..githooks/pre-commit— local gate. Enable withgit config core.hooksPath .githooks..github/workflows/no-proprietary-source.yml— the authoritative gate. Runs on every push andPR, and additionally rejects submodule gitlinks so the private repos can never be referenced
from here.
AGENTS.md— documents the boundary.Limits
The guard is path-based. It cannot catch native source pasted into an accepted file (
.cs,.md).Documented rather than fixed.
Verification
Guard block/allow paths exercised directly, and again through the cross-repo webview sync with a
planted
.javain the payload — the sync aborts. An adversarial review pass closed 10 bypassesbefore this branch.
🤖 Generated with Claude Code
https://claude.ai/code/session_01ShCMtnweyHuUEJQn2EH5d6