Skip to content

SECURITY: Fix multiple engine bypasses (empty strings, missing timestamps, negative cost) - #4

Open
iQodeIT wants to merge 2 commits into
kindrat86:mainfrom
iQodeIT:fix/security-bypasses
Open

SECURITY: Fix multiple engine bypasses (empty strings, missing timestamps, negative cost)#4
iQodeIT wants to merge 2 commits into
kindrat86:mainfrom
iQodeIT:fix/security-bypasses

Conversation

@iQodeIT

@iQodeIT iQodeIT commented Aug 11, 2026

Copy link
Copy Markdown

Summary

This PR addresses multiple security bypasses identified in the AgentShield rules engine as part of the $1,000 security challenge.

Vulnerabilities Fixed

  1. Merchant/Category Allowlist Bypass: Empty strings or None values were incorrectly handled, allowing transactions to bypass enforcement.
  2. Missing Timestamp Bypass: Transactions without a timestamp field bypassed velocity and budget checks. Now defaults to now() if missing.
  3. Negative Cost Bypass: The session_budget rule did not validate that amount was positive, allowing "negative cost" transactions to artificially increase a user's remaining budget.
  4. Invalid Amount Parsing: Added robust Decimal parsing for the amount field to prevent silent failures.

Verification

  • Added a formal verification suite in tests/bounty_tests.py covering all identified bypass vectors.
  • Verified that all original tests still pass.
  • Local reproduction scripts confirmed the bypasses were successful before the fix and blocked after.

kindrat86 pushed a commit that referenced this pull request Aug 12, 2026
…LinWang312 #1)

Fixes 2 bugs reported by @LinWang312 on issue #1:

Bug #3 (DoS): _fmt() crashes on Decimal.quantize() when amount has >28
significant digits (e.g. 1e50, 1e27). Wrapped in try/except InvalidOperation,
falls back to scientific notation instead of crashing the pipeline.

Bug #5 (False Positive): 'if agent_id and ...' treats None as falsy,
skipping the agent filter when current txn has no agent_id. This causes
unrelated agents' priors to be counted in velocity, daily_total, and
session_budget. Fixed: 'if prior.get("agent_id") != agent_id: continue'
treats None != "agent_a" correctly.

Note: Bugs #1 (already fixed), #2 (defensible design), #4 (correct behavior)
were not bugs per source code review.

Eval gym: 69/69 passed (4 new scenarios: #66-69)
@iQodeIT
iQodeIT force-pushed the fix/security-bypasses branch from 03297d5 to 72cdff9 Compare August 24, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant