SkillSpector icon indicating copy to clipboard operation
SkillSpector copied to clipboard

fix(scoring): apply 1.3x multiplier only to findings from executable files

Open tcconnally opened this issue 5 months ago • 1 comments

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 optional component_metadata and 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

score = sum(severity_weights)
if has_executable_scripts:
    score = int(score * 1.3)  # inflates ALL findings

After

for each finding:
    weight = severity_weight
    if has_executable_scripts AND finding's file is executable:
        weight = int(weight * 1.3)  # only executable-file findings
    score += weight

Testing

  • 622 tests pass (all existing + new test_report_doc_findings_no_multiplier)
  • Backward compatible: when component_metadata is None, behavior is unchanged

tcconnally avatar Jun 20 '26 21:06 tcconnally

Please resolve merge conflicts.

rng1995 avatar Jun 23 '26 12:06 rng1995

Rebased on current upstream/main — merge commit replaced with a clean linear history. Resolved the conflict in _compute_risk_score: upstream added severity-rank sorting in the same region; the rebased commit now includes both the sort and the per-file executable lookup, in that order.

tcconnally avatar Jun 26 '26 16:06 tcconnally