T09 · Insecure Skill Coding Practices
- Location
geo_push_policy.py:101- Finding
Maximum Push Limit and Cooldown Can Be Bypassed by Reusing a High-Scoring Event
- Content
View full analysis
= policy.threshold_high and push_count > 0: return True, f"Event upgrade during cooldown, score {total_score}" return False, f"Within cooldown ({elapsed_minutes:.0f}/{cooldown} minutes)" except Exception as e: print(f"Failed to parse time: {e}") # Check the number of pushes if push_count >= policy.max_push_count: return False, "Maximum push count reached" ``` ### Technical Analysis The function returns a successful push decision during the cooldown whenever both of the following conditions are true: 1. The current score is at least the high-priority threshold. 2. The event has previously been pushed at least once. It does not verify that the event actually transitioned from a lower severity to high severity. Consequently, an event that was already high severity is repeatedly treated as an upgrade. In addition, the maximum-push-count check occurs after this successful return. An event whose `push_count` is already equal to or greater than `policy.max_push_count` can therefore still be ap ...[truncated 1508 chars]- Remediation
View remediation
= policy.max_push_count: return False, "Maximum push count reached" ``` 2. Replace the score-only cooldown exception with a genuine state transition check: ```python if elapsed_minutes < cooldown: if check_event_upgrade(event_dict, state): return True, f"Event upgraded during cooldown, score {total_score}" return False, f"Within cooldown ({elapsed_minutes:.0f}/{cooldown} minutes)" ``` 3. Record the previous score and severity explicitly, and define upgrade conditions as transitions rather than static threshold checks. 4. Apply the push-count check again in the delivery/update layer so a caller cannot bypass the policy by submitting an event directly to the push list. 5. Add regression tests covering: - An already-high event during cooldown. - An event with exactly three prior pushes. - An event with more than three prior pushes. - A genuine transition from medium to high priority. - Repeated calls with an unchanged high score. ]]>
