fix: address 3 critical security issues (fixes #15, #16, #17)#19
Open
SuperInstance wants to merge 1 commit intomainfrom
Open
fix: address 3 critical security issues (fixes #15, #16, #17)#19SuperInstance wants to merge 1 commit intomainfrom
SuperInstance wants to merge 1 commit intomainfrom
Conversation
Comment on lines
+151
to
+154
| Raises | ||
| ------ | ||
| ValueError | ||
| If *capability_match* or *behavior_signature* is NaN. |
There was a problem hiding this comment.
🟡 Docstring omits latency_ms from Raises section despite NaN check in code
The record_interaction docstring's Raises section states If *capability_match* or *behavior_signature* is NaN, but the code at src/flux/a2a/trust.py:165-168 also raises ValueError when latency_ms is NaN. A caller relying on the docstring to understand which parameters are validated would not know that NaN latency_ms also raises. The test test_nan_latency_raises at tests/test_security.py:199-207 confirms this behavior exists, making the docstring inaccurate.
Suggested change
| Raises | |
| ------ | |
| ValueError | |
| If *capability_match* or *behavior_signature* is NaN. | |
| Raises | |
| ------ | |
| ValueError | |
| If *capability_match*, *behavior_signature*, or *latency_ms* is NaN. |
Was this helpful? React with 👍 or 👎 to provide feedback.
Debug
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
#15: Zero Bytecode Verification
verify_bytecode()static method toInterpreterclassValueErrorMAX_BYTECODE_SIZE)execute()before the fetch-decode loop#16: CAP Opcodes Unenforced
capabilities: set[int]attribute to the VM interpreterCAP_GRANT(reg): adds capability ID to the set, writes 0 (success) to R0CAP_REVOKE(reg): removes capability ID from the set, writes 0 (success) to R0CAP_REQUIRE(reg): checks if capability is in the set; raisesVMA2AErrorif missingCAP_REQUEST(reg): forwarded to external A2A handler (no auto-grant)reset()#17: NaN Trust Poison
math.isnan()inrecord_interaction()forcapability_match,behavior_signature, andlatency_mscheck_trust()forthresholdValueErrorwith descriptive messagecapability_matchclamped to [0.0, 1.0] on inputthresholdclamped to [0.0, 1.0] on inputTesting
tests/test_security.pyFiles Changed
src/flux/vm/interpreter.py— bytecode verification + CAP enforcementsrc/flux/a2a/trust.py— NaN protection + clampingtests/test_security.py— regression tests for all 3 fixes