Skip to content

Owner allowlist + two-tier menu + clear vite/esbuild Dependabot alerts#2

Merged
hyperpolymath merged 2 commits intomainfrom
claude/safety-checks-script-org-OtyYv
Apr 16, 2026
Merged

Owner allowlist + two-tier menu + clear vite/esbuild Dependabot alerts#2
hyperpolymath merged 2 commits intomainfrom
claude/safety-checks-script-org-OtyYv

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Summary

  • Ownership safety guard: scripts now refuse to touch repositories owned by anyone outside a configured allowlist (defaults to hyperpolymath; edit config/owners.config or set GIT_SCRIPTS_ALLOWED_OWNERS to add personal / family / additional org accounts). Implemented in parallel for bash (scripts/lib/ownership_guard.sh) and Elixir (lib/script_manager/ownership_guard.ex) sharing the same config.
  • Two-tier menu with clearer item names in the TUI: top-level lettered categories [A]–[F] (Audits & Reports, Repository Maintenance, GitHub Operations, Estate-Wide Deployment, External Tools, Coming Soon) each open a sub-menu of numbered items. Names rewritten to describe what each item actually does (e.g. Use GH CLIGitHub CLI Helper, VerifyVerify Local-vs-Remote Sync, Audit ScriptsSecurity Audit (Secrets & Dependabot)).
  • Fixes 2 moderate Dependabot alerts by upgrading ui/ vite 5.4 → 8.0.8: clears GHSA-67mh-4wv8-2f99 (esbuild dev server CORS) and GHSA-4w7w-66w2-5vf9 (Vite path traversal in optimized deps .map handling). Vite 8 also drops esbuild for rolldown, so the esbuild advisory is structurally gone.

Where the guard is enforced

Layer What it does
branch-protection-apply.sh, wiki-audit.sh, project-tabs-audit.sh assert_owner_allowed at script start — refuse to run against a non-allowlisted org.
audit_script.sh Per-repo filter; the Dependabot URL now uses the repo's actual owner instead of hard-coded hyperpolymath.
update_repos.sh Per-repo filter before any push; rejected repos surfaced in the run summary.
standardize_readmes.sh, md_to_adoc_converter.sh Per-repo filter before mutating files.
ScriptManager.PRProcessor assert_owner_allowed! on the org argument.
ScriptManager.GitSyncer filter_allowed_verbose/1 on discovered repos before pushing.
ScriptManager.EstateDeployer filter_allowed_verbose/1 before deploying contractiles / K9-SVC / accessibility / VPAT / pre-commit.
ScriptManager.DependencyFixer Refuses to patch lithoglyph / RGTV source if the enclosing repo's owner is foreign.
ScriptManager.RepoCleanup Surfaces a clear warning that the external /var/mnt/eclipse/cleanup_scripts/* are NOT bound by the allowlist.

Owner extractor — host-agnostic

Works for GitHub, GitLab, Bitbucket, Gitea, codeberg, self-hosted servers, SSH-style URLs (git@host:owner/repo), HTTP(S) URLs (with creds, ports, and arbitrary path prefixes). Verified end-to-end with 6 unit tests + 6 URL-format tests.

One follow-up step on your side

Run mix escript.build in the repo root to rebuild script_manager so the Elixir-side guard and the new menu are live. The bash-side guard is active immediately for any shell script that runs.

Test plan

  • bash -n syntax check on every modified shell script + ownership_guard.sh + owners.config — all clean.
  • Smoke tests of the bash guard: owner_allowed/assert_owner_allowed (allow / case-insensitive / disallow / empty / env-var override / exit code 78 on rejection) — all pass.
  • URL-parser tests across https://github.com/..., git@github.com:..., https://gitlab.com/..., ssh://git@codeberg.org/..., local-proxy URL, non-git path — all pass.
  • npm install + npx vite --version (reports 8.0.8) + npm audit (0 vulnerabilities) + vite.config.mjs parses unchanged.
  • Run mix escript.build to rebuild script_manager so the Elixir side picks up OwnershipGuard and the new TUI.
  • Walk the new two-tier menu in the TUI; confirm sub-menus and item names look right and [h]/[s] show the active allowlist.
  • Smoke-test one mutating action (e.g. [B] → [1] Update Repos) and confirm any non-allowlisted repos in repos.config are reported as skipped.

https://claude.ai/code/session_014ME3ph3UecQQAPQDKY2HPf

claude added 2 commits April 16, 2026 03:26
Adds an ownership safety guard so scripts NEVER touch repositories outside
a configured allowlist of owners (defaults to ["hyperpolymath"]; edit
config/owners.config or set GIT_SCRIPTS_ALLOWED_OWNERS to add personal /
family / additional org accounts). The guard is enforced in two parallel
implementations that share the same config:

  - scripts/lib/ownership_guard.sh — sourced by every shell script that
    targets a single org or pushes to remotes; provides
    owner_allowed/repo_allowed/assert_owner_allowed and a host-agnostic
    owner extractor (works for GitHub, GitLab, Bitbucket, Gitea,
    self-hosted, SSH-style, etc.).
  - lib/script_manager/ownership_guard.ex — the Elixir equivalent;
    exposes allowed_owners/0, owner_allowed?/1, repo_allowed?/1,
    filter_allowed/1, filter_allowed_verbose/1 and assert_owner_allowed!/1.

Wired into all the scripts/modules that can mutate or affect repos:
  shell: branch-protection-apply, wiki-audit, project-tabs-audit,
         audit_script (per-repo filter + uses derived owner for the
         Dependabot URL), update_repos (per-repo filter before push),
         standardize_readmes & md_to_adoc_converter (per-repo filter).
  elixir: PRProcessor.process_all/add_standard_comment (asserts org),
          GitSyncer.run (filters discovered repos before push),
          EstateDeployer.deploy_by_paths (filters before writing files),
          DependencyFixer.fix_lithoglyph/fix_rgtv (refuses to patch when
          enclosing repo is foreign-owned),
          RepoCleanup (warns the external cleanup scripts are NOT bound
          by the allowlist).

Also rewrites the TUI menu as two tiers with clearer item names:
  [A] Audits & Reports         — wiki, project metadata, contractiles,
                                 secrets/Dependabot, health dashboard,
                                 local-vs-remote sync verification
  [B] Repository Maintenance   — update repos, global git sync,
                                 standardise READMEs, MD→AsciiDoc,
                                 clean unicode, cleanup ops, dep fixes
  [C] GitHub Operations        — branch protection rulesets, mass PR
                                 processor, gh CLI helper
  [D] Estate-Wide Deployment   — deploy estate standards, link
                                 toolchains, find media repos
  [E] External Tools           — launch NQC, launch Invariant Path
  [F] Coming Soon              — dependency updater, release manager
The startup banner shows the active owner allowlist and the help and
system-status screens both surface it so it's obvious at a glance.

Note: rebuild the escript with `mix escript.build` to pick up the
Elixir-side changes; the bash-side guard is active immediately.

https://claude.ai/code/session_014ME3ph3UecQQAPQDKY2HPf
Resolves the two moderate-severity advisories Dependabot reports against
the ui/ project on the default branch:

  - GHSA-67mh-4wv8-2f99 (esbuild dev server CORS, CWE-346, CVSS 5.3) —
    transitive via vite 5.x's pinned esbuild 0.21.5.
  - GHSA-4w7w-66w2-5vf9 (Vite path traversal in optimized deps `.map`
    handling, CWE-22/CWE-200) — affects vite ≤ 6.4.1.

Both share the same fix path (vite ≥ 8.0.8). Vite 8 also drops esbuild
in favour of rolldown, so the esbuild advisory is structurally gone
rather than just patched.

Verified locally: `npm install` clean, `npx vite --version` reports
8.0.8, `npm audit` reports 0 vulnerabilities, and vite.config.mjs
(defineConfig with resolve.preserveSymlinks + server.proxy /api → 4077)
parses unchanged under the new version. Node engine requirement
(^20.19.0 || >=22.12.0) is satisfied by the existing toolchain.

https://claude.ai/code/session_014ME3ph3UecQQAPQDKY2HPf
@hyperpolymath hyperpolymath merged commit 2a4dc73 into main Apr 16, 2026
4 checks passed
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.

2 participants