T09 · Insecure Skill Coding Practices
- Location
scripts/classifier.py:7- Finding
Fail-Open Handling of Contradictory ACMG Evidence
- Content
View full analysis
str: pv = pathogenic.get("very_strong", 0) ps = pathogenic.get("strong", 0) pm = pathogenic.get("moderate", 0) pp = pathogenic.get("supporting", 0) ba = benign.get("standalone", 0) bs = benign.get("strong", 0) bp = benign.get("supporting", 0) if conflict and (pv or ps or pm or pp) and (ba or bs or bp): return "VUS" if ba >= 1: return "Benign" if bs >= 2: return "Benign" ``` ### Technical Analysis The classifier receives pathogenic and benign evidence simultaneously but does not derive the presence of a conflict from those inputs. Instead, conflict handling depends on the caller supplying a separate `conflict` Boolean, which defaults to `False`. If the flag is omitted or incorrectly set to `False`, the VUS safeguard is bypassed even when both evidence groups contain nonzero criteria. The function then evaluates benign rules first and pathogenic rules later, allowing contradictory evidence to produce an overconfident `Benign`, `Pathogenic`, or `Likely Pathogenic` result. This behavior conflicts with the documented workflow, which requires explicit conflict analysis and states that unresolved conflicts should generally remain VUS. It is also a fail-open design: an omitted safety signal permits a more definitive classification rather than a conservative result. ### Attack Path 1. Provide input containing at least one pathogenic criterion and at least one benign criterion. 2. Omit the optional `conflict` argument or explicitly set it to `False`. 3. The condition on lines 16–17 is not activated. 4. Classification proceeds using ordinary precedence rules. 5. For example, a nonzero `benign[" ...[truncated 946 chars]- Remediation
View remediation
0 for value in (pv, ps, pm, pp)) has_benign = any(value > 0 for value in (ba, bs, bp)) if has_pathogenic and has_benign: return "VUS" ``` 2. If resolved conflicts must be supported, replace the Boolean with a structured resolution record that identifies which criteria were rejected or downgraded and why. Recalculate classification only from the remaining accepted criteria. 3. Validate all evidence counts before classification: - Require integers. - Reject Boolean values, negative numbers, strings, and unexpected keys. - Define reasonable upper bounds where appropriate. 4. Add regression tests covering: - BA1 combined with any pathogenic evidence. - Strong benign evidence combined with pathogenic evidence. - Contradictory evidence when the conflict argument is omitted. - Contradictory evidence when the conflict argument is explicitly false. - Properly resolved conflicts after unsupported criteria are removed. 5. Return structured output containing the classification, detected conflicts, applied rules, and evidence counts so reviewers can verify how the result was reached. 6. Preserve the documented requirement for expert manual review and ensure downstream systems cannot treat the provisional result as an unsupervised clinical diagnosis. ]]>
