[fix] STAR-5 (BOX-04): converge Policy across script modules, surface, and Check#24
Conversation
…, and Check
Independent review (2026-06-20) found the A4 load gate was not the single
source of truth it claims to be:
- P0-1: AddModuleScript modules were written to the virtual FS and added to
modNames without the policy gate, so a zero Policy{} (default-deny) still
let a script load() a host-injected script module. Now each script module
is gated by s.policyAllows(fp) (its registered .star name); a denied one is
not materialized.
- P0-2: DescribeSurface and Check (predeclaredNames) enumerated modules
without the gate, so they reported / accepted a larger surface than a real
Run would load. DescribeSurface's add() and predeclaredNames now filter by
s.policyAllows, so the reported surface and the static-check predeclared set
match the runnable set.
Non-policy boxes are unaffected (policyAllows is true when no policy is set).
Tests (test-first, reproduced both bugs before the fix):
- TestPolicyGatesScriptModule: zero policy denies; explicit .star-name allow
loads; nested path gated by its full key.
- TestPolicySurfaceCheckConverge: filtered DescribeSurface lists only math;
Check flags a withheld name (file) and passes a permitted one.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 20 |
| Duplication | 0 |
🟢 Coverage 100.00% diff coverage · +0.01% coverage variation
Metric Results Coverage variation ✅ +0.01% coverage variation (-1.00%) Diff coverage ✅ 100.00% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (fc75a79) 1147 1138 99.22% Head commit (5ed0300) 1155 (+8) 1146 (+8) 99.22% (+0.01%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#24) 18 18 100.00% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #24 +/- ##
=======================================
Coverage 98.95% 98.95%
=======================================
Files 12 12
Lines 859 864 +5
=======================================
+ Hits 850 855 +5
Misses 5 5
Partials 4 4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Release blockers P0-1 + P0-2 (independent review 2026-06-20)
The A4 load gate was not the single source of truth it claims to be. Two bypasses, both fixed here (test-first — each repro confirmed failing before the fix).
P0-1 —
Policy{}default-deny bypassed byAddModuleScriptprepareEnvwrote eachAddModuleScriptmodule into the virtual FS and appended it tomodNameswithout the policy gate, so a zeroPolicy{}still let a scriptload()a host-injected script module.Fix: each script module is gated by
s.policyAllows(fp)(its registered.starname); a denied module is not materialized at all.P0-2 —
DescribeSurface/Checkdid not converge with PolicyBoth enumerated modules without the gate, so they reported (surface) / accepted (static check) a larger set than a real
Runwould load.Fix:
DescribeSurface'sadd()andCheck'spredeclaredNamesnow filter bys.policyAllows, so the reported surface and the predeclared set match the runnable set.Non-policy boxes are unaffected —
policyAllowsreturns true when no policy is set.Tests
TestPolicyGatesScriptModule— zero policy denies; explicit.star-name allow loads; nested path gated by its full key.TestPolicySurfaceCheckConverge— filteredDescribeSurfacelists onlymath(nofile/re);Checkflags a withheld name (file) as undefined and passes a permitted one (math.pi).prepareEnv/DescribeSurface/predeclaredNamesat 100%; overall 99.3%.gofmt/vetclean,-race -count=2and Dockergolang:1.19floor green.