fix(scoring): apply 1.3x multiplier only to findings from executable files#122
Open
tcconnally wants to merge 1 commit into
Open
fix(scoring): apply 1.3x multiplier only to findings from executable files#122tcconnally wants to merge 1 commit into
tcconnally wants to merge 1 commit into
Conversation
…files Previously the risk score multiplied ALL findings by 1.3x if any executable script existed in the skill, punishing documentation and teaching content that mentions attack patterns for educational or deny-list purposes. This change: - Builds a file-executable lookup from component_metadata - Applies 1.3x only to findings from executable files (.py, .sh, .js, etc.) - Leaves non-executable-file findings at base severity weight - No change when component_metadata is unavailable (backward compatible) Added test: doc_findings_no_multiplier verifies markdown findings are not inflated by the executable multiplier. Addresses the scoring concern in NVIDIA#103 Signed-off-by: Perseus Computing <51974392+tcconnally@users.noreply.github.com>
rng1995
approved these changes
Jun 21, 2026
rng1995
left a comment
Collaborator
There was a problem hiding this comment.
APPROVE — applying the 1.3x multiplier per-finding based on component_metadata executable flags (rather than to the whole score) is a sensible refinement, and the two new tests cover both the executable and the documentation cases.
Minor / optional (non-blocking):
- Path matching: the multiplier relies on
file_executable.get(f.file)matching thepathincomponent_metadataexactly. If findings ever store a path with different normalization than the metadata (absolute vs relative, leading./, OS separators), the lookup silently misses and the multiplier will not apply. A comment or a normalization step would keep them aligned. - Behavior when metadata is None: in that case no finding gets the multiplier even if
has_executable_scriptsis true — a minor behavior change from the previous whole-score multiply. Fine sincereport()always passes metadata, but worth noting for any other callers of this private helper. - The score math changed from
int(sum * 1.3)tosum(int(weight * 1.3))(per-finding flooring), so totals can differ slightly (e.g. 65 → 64). The test update reflects this; just confirming it is intentional.
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
Addresses the scoring concern in #103: the 1.3x executable-script multiplier was applied globally to ALL findings when any executable file existed. This meant documentation, teaching content, deny-lists, and anti-examples in .md files received the same score inflation as actual executable code — making thoroughly documented security skills appear MORE dangerous.
Fix
_compute_risk_score()now accepts optionalcomponent_metadataand builds a file-path lookup. The 1.3x multiplier is applied only to findings whose file is marked as executable in the component metadata. Findings from markdown, text, json, yaml, and toml files receive base severity weight (no multiplier).Before
After
Testing
test_report_doc_findings_no_multiplier)component_metadatais None, behavior is unchanged