ci: fail the build on new internal references in this public repo #24

Merged
mohlec merged 1 commit from ci/internal-ref-audit into ncw/main 2026-09-01 18:33:04 +00:00
Owner

Refs #23, #14.

Adds a CI gate so internal references cannot land in this public repo unnoticed.

Why

The rule in REPO-CONVENTIONS -- no hostnames, usernames, internal IPs, domain names or
credentials in public repos -- has been breaking silently. Three separate leaks turned up just
by reading files this week:

  • an internal push hostname hardcoded in Kotlin (#23)
  • the default server URL and a live dev crash webhook in assets/base/config.json (#14)
  • Apple account addresses and an absolute build-Mac path naming its account holder in
    fastlane/.env.ncw

Finding these by reading is not a control.

What

scripts/check-no-internal-refs.sh, modelled on slash-server's scripts/check-branding.sh:
FLAG-ALL-MINUS-ALLOWLIST over five classes (hostname, email, private-ip, ct-ref,
home-path), so anything new fails by default instead of having to be predicted.

Two allowlists, deliberately separate:

  • PERMANENT, in the script -- genuinely public values that must never be flagged:
    www.ncwcom.com (required in the App Store listing), 10.0.2.2 (Android emulator host
    alias), hosted CI runner homes.
  • scripts/internal-refs-baseline.txt -- the 11 leaks that exist today, each with a reason
    and an issue where one exists. The check also fails on a baseline entry that no longer
    matches
    , so fixing a leak forces its line to be deleted rather than quietly rotting.

To be explicit: this PR does not fix any existing leak. It stops new ones and turns the
existing ones into a visible, itemised list.

Scoping decisions worth reviewing

  • private-ip covers only 172.16/12 and 10/8, the ranges REPO-CONVENTIONS actually names.
    192.168/16 is excluded: not NCW space, and upstream uses it for generic example addresses in
    its own tests, so including it produced only false positives.
  • home-path matches /Users/<name>/ but not /home/<name>/, which collides with this repo's
    own module paths (@screens/home/search/...). The exposure that matters is the shared build
    Mac.
  • The workflow runs on pull_request as well as push, because build-android.yml only
    triggers on pushes to ncw/main -- a leak introduced in a PR would otherwise not surface
    until it had already been merged and published.

Verification

Table-tested both directions on the Linux host, using the same
git clone http://127.0.0.1:3000/... the runner uses:

input result
172.16.0.55, 172.31.9.9, 10.104.0.5 fail
chat.ncwcom.com, someone@ncwcom.com, CT#137, /Users/somebody/ fail
10.0.2.2, 192.168.1.10, www.ncwcom.com, version strings like 2.41.0 pass

Clean against the baseline as committed (exit 0, 11 exceptions tracked); a probe leak fails
with exit 1. The committed script is mode 100755 with LF endings.

One caveat: I could not lint the workflow YAML locally (no pyyaml available), so its first real
run is the check. It mirrors the structure of the existing Android workflow, and the runner has
python3 3.13.5.

After the upstream rebase

ADR-0003 notes this repo has no DIVERGENCE.md and no drift discipline. This check is a small
piece of that gap closed; the baseline will need re-verifying once the Expo Router rebase moves
files around.

Refs #23, #14. Adds a CI gate so internal references cannot land in this **public** repo unnoticed. ### Why The rule in REPO-CONVENTIONS -- no hostnames, usernames, internal IPs, domain names or credentials in public repos -- has been breaking silently. Three separate leaks turned up just by reading files this week: - an internal push hostname hardcoded in Kotlin (#23) - the default server URL and a **live** dev crash webhook in `assets/base/config.json` (#14) - Apple account addresses and an absolute build-Mac path naming its account holder in `fastlane/.env.ncw` Finding these by reading is not a control. ### What `scripts/check-no-internal-refs.sh`, modelled on slash-server's `scripts/check-branding.sh`: FLAG-ALL-MINUS-ALLOWLIST over five classes (`hostname`, `email`, `private-ip`, `ct-ref`, `home-path`), so anything new fails by default instead of having to be predicted. Two allowlists, deliberately separate: - **PERMANENT**, in the script -- genuinely public values that must never be flagged: `www.ncwcom.com` (required in the App Store listing), `10.0.2.2` (Android emulator host alias), hosted CI runner homes. - **`scripts/internal-refs-baseline.txt`** -- the 11 leaks that exist today, each with a reason and an issue where one exists. The check **also fails on a baseline entry that no longer matches**, so fixing a leak forces its line to be deleted rather than quietly rotting. To be explicit: this PR does not fix any existing leak. It stops new ones and turns the existing ones into a visible, itemised list. ### Scoping decisions worth reviewing - `private-ip` covers only `172.16/12` and `10/8`, the ranges REPO-CONVENTIONS actually names. `192.168/16` is excluded: not NCW space, and upstream uses it for generic example addresses in its own tests, so including it produced only false positives. - `home-path` matches `/Users/<name>/` but not `/home/<name>/`, which collides with this repo's own module paths (`@screens/home/search/...`). The exposure that matters is the shared build Mac. - The workflow runs on `pull_request` as well as `push`, because `build-android.yml` only triggers on pushes to `ncw/main` -- a leak introduced in a PR would otherwise not surface until it had already been merged and published. ### Verification Table-tested both directions on the Linux host, using the same `git clone http://127.0.0.1:3000/...` the runner uses: | input | result | |---|---| | `172.16.0.55`, `172.31.9.9`, `10.104.0.5` | fail | | `chat.ncwcom.com`, `someone@ncwcom.com`, `CT#137`, `/Users/somebody/` | fail | | `10.0.2.2`, `192.168.1.10`, `www.ncwcom.com`, version strings like `2.41.0` | pass | Clean against the baseline as committed (`exit 0`, 11 exceptions tracked); a probe leak fails with `exit 1`. The committed script is mode `100755` with LF endings. One caveat: I could not lint the workflow YAML locally (no pyyaml available), so its first real run is the check. It mirrors the structure of the existing Android workflow, and the runner has python3 3.13.5. ### After the upstream rebase ADR-0003 notes this repo has no `DIVERGENCE.md` and no drift discipline. This check is a small piece of that gap closed; the baseline will need re-verifying once the Expo Router rebase moves files around.
ci: fail the build on new internal references in this public repo
All checks were successful
Internal-reference audit / internal-refs (pull_request) Successful in 15s
33b28e400f
This repo is public. REPO-CONVENTIONS.md forbids hostnames, usernames,
internal IPs, domain names and credentials here, and the rule has been
breaking silently: an internal push hostname is hardcoded in Kotlin, the
default server URL and a live dev webhook sit in assets/base/config.json,
and fastlane/.env.ncw carries Apple account addresses plus an absolute
path naming the build-Mac account. Three separate leaks found by reading,
which is not a control.

Adds scripts/check-no-internal-refs.sh, modelled on slash-server's
scripts/check-branding.sh: FLAG-ALL-MINUS-ALLOWLIST across five classes
(hostname, email, private-ip, ct-ref, home-path), so anything new fails by
default rather than needing to be predicted in advance.

Two allowlists, kept apart on purpose:

  - PERMANENT, in the script: values that are genuinely public and must
    never be flagged - www.ncwcom.com (required in the App Store listing),
    10.0.2.2 (Android emulator host alias), hosted CI runner homes.
  - scripts/internal-refs-baseline.txt: the 11 leaks that exist today,
    each with a reason and, where one exists, an issue. The check also
    fails on a baseline entry that no longer matches, so fixing a leak
    forces its line to be deleted instead of quietly rotting.

Scoping decisions worth recording:

  - private-ip covers only 172.16/12 and 10/8, the ranges the conventions
    document actually names. 192.168/16 is excluded: it is not NCW space
    and upstream uses it for generic example addresses in its own tests,
    so matching it produced only false positives.
  - home-path matches /Users/<name>/ but not /home/<name>/, which collides
    with this repo's own module paths (@screens/home/search/...). The
    exposure that matters is the shared build Mac.

The workflow runs on pull_request as well as push, because build-android.yml
only triggers on pushes to ncw/main - a leak introduced in a PR would
otherwise go unnoticed until it had already been merged and published.

Verified by table-testing both directions: 172.16.0.55, 172.31.9.9,
10.104.0.5, chat.ncwcom.com, someone@ncwcom.com, CT#137 and
/Users/somebody/ all fail; 10.0.2.2, 192.168.1.10, www.ncwcom.com and
version strings like 2.41.0 all pass. The tree is clean against the
baseline as committed.
mohlec merged commit 88599f06a5 into ncw/main 2026-09-01 18:33:04 +00:00
mohlec deleted branch ci/internal-ref-audit 2026-09-01 18:33:04 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
slash/slash-mobile!24
No description provided.