fix: address 3 critical security issues + ICMP conformance (fixes #15, #16, #17)#20
Open
SuperInstance wants to merge 1 commit intomainfrom
Open
fix: address 3 critical security issues + ICMP conformance (fixes #15, #16, #17)#20SuperInstance wants to merge 1 commit intomainfrom
SuperInstance wants to merge 1 commit intomainfrom
Conversation
…#16, #17) Security Fixes: - #15: Add bytecode verification before execution (empty/oversized guard) - #16: Enforce CAP_REQUIRE/CAP_GRANT/CAP_REVOKE opcodes with capability set - #17: Reject NaN inputs in trust engine, clamp values to [0.0, 1.0] Conformance Fix: - Fix ICMP instruction format to [cond][rd][rs2], result goes to rd not R0 Tests: - 15 new security tests (bytecode verification, CAP enforcement, NaN guards) - All 2509 tests passing (was 2393 passed + 1 failed)
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
Fixes all 3 critical security vulnerabilities identified by the Expert Panel: Security & Trust (session 11), plus an ICMP conformance bug that caused
test_icmp_eqto fail.Security Fixes
#15: Zero bytecode verification before execution
verify_bytecode()static method toInterpreterclassexecute()#16: CAP opcodes defined but never enforced
capabilities: set[int]to Interpreter instanceCAP_GRANT: Parses cap_id from data payload and adds to capability setCAP_REQUIRE: Enforces capability check — raisesVMA2AErrorif cap not heldCAP_REVOKE: Removes capability from setCAP_REQUEST: Forwarded to handler (no auto-grant — handler decides)reset()#17: Trust engine accepts NaN — trust poisoning
math.isnan()guards oncapability_match,behavior_signature, andlatency_msinputsValueErrorif NaN detectedcapability_matchto [0.0, 1.0] rangecheck_trust()threshold parameterConformance Fix
ICMP instruction format
[ICMP][raw][rs1][rs2](always writes R0) to[ICMP][cond][rd][rs2](writes result to destination register)test_icmp_eqfailure (R1 was receiving value 5 instead of 1)Test Results
Before: 2393 passed, 1 failed (
test_icmp_eq)After: 2509 passed, 0 failed
15 new security tests added covering all 3 issues.
Files Changed
src/flux/vm/interpreter.py: +51 -3 (bytecode verification, CAP enforcement, ICMP fix)src/flux/a2a/trust.py: +32 -2 (NaN guards, value clamping)tests/test_security.py: +213 -11 (15 new security tests)