Skip to content

feat: fail-closed guard against proprietary source in this public repo - #160

Merged
marc-n-dream merged 4 commits into
masterfrom
feat/proprietary-source-guard
Aug 5, 2026
Merged

feat: fail-closed guard against proprietary source in this public repo#160
marc-n-dream merged 4 commits into
masterfrom
feat/proprietary-source-guard

Conversation

@marc-n-dream

Copy link
Copy Markdown
Collaborator

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 is
irreversible, 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.xml and src/main/res/. Allowlists Unity
    gradle templates, the guard script itself, and content-free *.meta.
  • .githooks/pre-commit — local gate. Enable with git config core.hooksPath .githooks.
  • .github/workflows/no-proprietary-source.yml — the authoritative gate. Runs on every push and
    PR, 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 .java in the payload — the sync aborts. An adversarial review pass closed 10 bypasses
before this branch.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ShCMtnweyHuUEJQn2EH5d6

@marc-n-dream marc-n-dream left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ 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.

Comment thread .githooks/pre-commit Outdated
Comment thread .github/workflows/no-proprietary-source.yml
Comment thread scripts/check-proprietary-source.sh
Comment thread .gitignore Outdated

@marc-n-dream marc-n-dream left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ 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.

Comment thread AGENTS.md Outdated
Comment thread .github/workflows/no-proprietary-source.yml
Comment thread .githooks/pre-commit Outdated
@marc-n-dream
marc-n-dream force-pushed the feat/proprietary-source-guard branch from 33a9c7d to e706cce Compare August 5, 2026 19:58
marc-n-dream added a commit that referenced this pull request Aug 5, 2026
- .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>
marc-n-dream and others added 4 commits August 5, 2026 22:37
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>
@marc-n-dream
marc-n-dream force-pushed the feat/proprietary-source-guard branch from e8ee4ed to 835e708 Compare August 5, 2026 20:37
@marc-n-dream
marc-n-dream merged commit 28bccbb into master Aug 5, 2026
3 checks passed
@marc-n-dream
marc-n-dream deleted the feat/proprietary-source-guard branch August 5, 2026 20:39
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