T09 · Insecure Skill Coding Practices
Error
- Location
- tools/score_task.py:36
- Finding
- Irreversible Tasks Are Assigned an Incorrectly Low Risk Score<![CDATA[ ## Vulnerability Details **File Location**: `tools/score_task.py:36-42`, `tools/score_task.py:54-61`, and `tools/score_task.py:86-109` **Vulnerability Type**: Incorrect security-sensitive risk calculation and approval-policy enforcement **Risk Level**: High ### Vulnerable Code ```python def score_to_autonomy(scores): risk = (scores["criticality"] + (6 - scores["reversibility"]) + scores["subjectivity"]) / 3 if risk >= 4: return "atomic" elif risk >= 2.5: return "bounded" return "open-ended" ``` ```python def needs_human_approval(scores): if scores["reversibility"] >= 4 and scores["criticality"] >= 3: return True, "Irreversible action with significant consequences" if scores["contextuality"] >= 4: return True, "Involves sensitive/private data" if scores["criticality"] >= 5: return True, "Critical task — failure would be severe" return False, None ``` ```python def calculate_recommendation(scores, description=""): tier, reason = select_agent_tier(scores, description) autonomy = score_to_autonomy(scores) monitoring = score_to_monitoring(scores) human_req, human_reason = needs_human_approval(scores) risk = ( scores["criticality"] * 0.3 + (6 - scores["reversibility"]) * 0.25 + scores["complexity"] * 0.2 + scores["contextuality"] * 0.15 + scores["subjectivity"] * 0.1 ) return { "agent_tier": tier, "agent_examples": AGENT_TIERS[tier]["examples"], "agent_reason": reason, "autonomy": autonomy, "monitoring": monitoring, "human_approval_required": human_req, "human_approval_reason": human_reason, "risk_level": "HIGH" if risk >= 4 else "MEDIUM" if risk >= 2.5 else "LOW", "risk_score": round(risk, 2), "scores": scores, } ``` ### Technical Analysis The documented scale defines `reversibility` as follows: - `1`: fully reversible - `5`: ...[truncated 3014 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Use the documented irreversibility score directly in all risk calculations: ```python def score_to_autonomy(scores): risk = ( scores["criticality"] + scores["reversibility"] + scores["subjectivity"] ) / 3 if risk >= 4: return "atomic" if risk >= 2.5: return "bounded" return "open-ended" ``` ```python risk = ( scores["criticality"] * 0.3 + scores["reversibility"] * 0.25 + scores["complexity"] * 0.2 + scores["contextuality"] * 0.15 + scores["subjectivity"] * 0.1 ) ``` 2. Align human-approval enforcement with the documented policy: ```python def needs_human_approval(scores): if scores["reversibility"] >= 4: return True, "Action is difficult or impossible to reverse" if scores["criticality"] >= 4: return True, "High-criticality task" if scores["contextuality"] >= 4: return True, "Involves sensitive/private data" return False, None ``` 3. Treat approval checks as independent hard safety gates rather than relying only on a weighted aggregate score. 4. Add parameterized tests proving monotonic behavior: - Increasing irreversibility must never reduce risk. - Scores of `4` or `5` for irreversibility must require approval. - Irreversible tasks must not receive `open-ended` autonomy. - Fully reversible tasks must not receive a larger reversibility-risk contribution than irreversible tasks. 5. Add regression tests comparing the implementation against the policy in `SKILL.md`. 6. Consider renaming the field from `reversibility` to `irreversibility` so that higher values and higher risk have the same semantic direction. ]]>
