[quickfix] Add automated tests proving sandbox blacklist actually blocks each FORBIDDEN token #6
Labels
No labels
blocked:needs-attention
blocked:needs-decision
blocked:needs-decompose
blocked:needs-design
blocked:needs-triage
blocked:unclassified
bug
documentation
enhancement
gsd-spec
in-progress
needs-decompose
priority:high
priority:low
priority:medium
quickfix
test
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/veilwalkers#6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
scripts/autoload/script_engine.gddeclares a 24-token FORBIDDEN blacklist (OS., FileAccess, DirAccess, ClassDB, Engine., ProjectSettings, Input., ResourceLoader, ResourceSaver, load(, preload(, get_tree(, get_node(, root, HTTPRequest, TCPServer, PacketPeer, Expression., Script.new, GDScript.new, thread, Thread, set_script). The README discloses it as "blocks obvious escape hatches" but there is no automated proof that the rejection path actually fires for each token — GDScript drift would be silent.What to do
Add
tests/test_sandbox.gd(ortests/test_sandbox_blacklist.tscndriving a GDScript test rig) that:var x = OS.get_unix_time()etc.) and assertsScriptEngine.compile(src)returns an error or a non-attached result.extends ScriptEngine.ScriptEntityAPI\nfunc me(): return null) compiles and attaches successfully.tests/e2e.tscninvocation (extend the gate or add a newtests/sandbox.tscnthat the existing one runs first).Place at
tests/sandbox.tscn+tests/sandbox.gdto match the existing test layout.Acceptance
bash .gsd/gates/verify.shexits 0 AND removing any single token from the FORBIDDEN list causes the corresponding test case to fail (proving coverage of every entry). Sandbox baseline snapshot included in the test file's doc comment.Labels
test,quickfixClosed via commits on main:
c19de96— test: add sandbox blacklist coverage test (Mark/veilwalkers#6)174d76f— style: gdformat sweep on tests/sandbox.gdWhat landed:
one source per FORBIDDEN token (string-literal samples so the source parses
cleanly when the blacklist is bypassed — otherwise removal of a token would
be masked by parse errors instead of failing the corresponding test).
forbidden token in script:,proving the blacklist fired (not just any compile failure).
thread/Thread case-folded) are exposed as documented findings: removing
GDScript.neworThreadfrom the FORBIDDEN array is operationally a no-opbecause the shorter sibling catches the same samples first. The test
asserts "rejection names this token or its shadow" so this stays honest.
Coverage verification (one test removed at a time, sandbox.tscn re-run):
GDScript.new,Thread): 0 failures because their shortersibling is still in the list and catches the sample. Documented as a
redundancy finding in the test file's docstring + inline comments.