security: add authoritative worker core - #18
Merged
Merged
Conversation
Owner
Author
|
Post-CI exact-head review completed for
Remote branch SHA equals the reviewed PR head. All configured checks are green, |
Owner
Author
|
Post-CI remediation review completed for
Validation evidence:
The PR remains Draft. This note does not approve workflow activation or merge. |
stacknil
marked this pull request as ready for review
September 14, 2026 13:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add the data-only trusted worker core for the future authoritative Repo Sentinel gate.
The worker composes the already-reviewed acquisition, logical reader, and portable materializer boundaries without adding GitHub event parsing or authority publication:
This PR is intentionally draft because it changes a security boundary and exceeds 500 substantive lines.
Design decision
Use immutable
Snapshotvalues as the only base/head comparison input. D1 maps exact logical paths to(mode, blob_oid), reports added/modified/mode-changed paths separately from deletions, performs no rename inference, and remains O(n log n).Reject protected policy changes before materialization or scanner launch. Materialize only the admitted head snapshot, execute the pinned scanner from a separate trusted directory, and return fixed verdicts plus bounded metadata. The worker never publishes GitHub status.
Protected control plane
Changed or deleted paths are rejected for:
.reposentinel.tomland.reposentinel-baseline.json;.github/workflows/**and.github/actions/**;Protected matching uses the portable-v1 ASCII alias rule:
A-Zmaps toa-z, and every other code point remains unchanged. Exact-path and subtree boundaries remain distinct; general Unicode lowercasing or case folding is not used.The exact
repo-sentinel-lite==0.8.1source-suppression behavior was inspected. A touched file containing its inline allow directive in either base or head is conservatively treated as a protected policy change.Scanner, config, and baseline
python -I -m repo_sentinel, argument array,shell=False.repo-sentinel 0.8.1.0A949A4D00C6E6AE37EBA60A6CB74E4E15BC3EC5FCE2F1D4C99AA0EF309B36E3.0.8.1reads only<scan-root>/.reposentinel.toml; no parent, home, or environment-selected alternate config.repo_sentinel.py,sitecustomize.py,usercustomize.py,*.pth, executable bits, and workflow files remain inert data.Evidence and failure model
Results expose only a fixed verdict, validated repository/PR/OID identity, changed/deleted counts, report size and SHA-256, scanner version, and fixed refusal code. Invalid identity is not reflected into refusal results.
Scanner stdout/stderr are captured with byte caps. Raw report text, filenames, parser output, and workflow-command-shaped content are never printed. Reports are bounded, validated, persisted exclusively outside the target/trusted checkout, and never overwritten.
The worker distinguishes
PASS,SCANNER_FINDING,INFRASTRUCTURE_REFUSAL, andPROTECTED_CONTROL_CHANGE. Acquisition, reader, materializer, scanner, malformed-report, timeout, size, and cleanup failures fail closed.Validation
Local environment:
3.14.32.55.0.windows.50.16.74.5.10.8.1Exact test results:
git diff --check: passedMutation evidence
Each mutation was applied locally, produced the expected failing regression, and was restored before submission:
.reposentinel.tomlallowed;The two remediation mutations failed their focused real-scanner regressions and were restored before final validation.
242-file probe
The exact public PR #15 head was acquired and processed through the new worker with its immediate trusted parent as the D1 base:
2f7b7a9bef43715141086b0d79bacbe67a178288960dc6c6496f1260f6fab74b64f26408024cd5fbad39acf89d0826ce2651ed14d12e143d7f0a8b5cb6b2eb219b46895688f45d0aMain risk
The source-suppression rule is intentionally conservative: editing a file that already contains a legitimate inline suppression is blocked for control-plane review. The scanner is isolated from target imports but is not a general sandbox; the interpreter, installed package, runner, and caller-owned roots remain trusted preconditions.
Compatibility impact
The change is additive. It does not modify acquisition, reader, materializer, scanner semantics, report schemas, baseline behavior, existing workflow YAML, workflow permissions, or repository rules. The current unprivileged pull-request workflow remains informational and unchanged.
Rollback path
Revert the PR branch commits. No persisted schema, workflow activation, GitHub App installation, secret, branch rule, or external service must be migrated or removed.
Out of scope
This PR does not add a production signer, App credentials, installation tokens, Commit Status or Checks API calls,
pull_request_target, workflow activation, branch protection, or ruleset changes.