Skip to content

docs(threat-model): one pass over automations' entries, each naming its mitigation and test - #612

Merged
adeelahmad merged 2 commits into
mainfrom
claude/project-thread-li6m25
Oct 18, 2026
Merged

adeelahmad merged 2 commits into
mainfrom
claude/project-thread-li6m25

Conversation

@adeelahmad

Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: the threat model's automation entries named their mitigations but not the tests that prove them. The cap of 1000 waiting timers per automation was in docs/automations.md but missing from the threat model.

After: each of the seven areas the studio brief lists names its mitigation and cites its tests:

Area Entry Tests cited (under fastapi_backend/tests/)
Inbound webhook triggers POST /automations/hooks/{token} row api/test_automation_hooks.py (hash only, size and rate caps, signatures and retries), api/test_automations.py (address made and dropped with its trigger)
Outbound http_request P-SSRF-GUARD api/test_actions_web.py (public addresses only, no redirects, 10 s and 64 KB, asks first)
The agent acting on outside text P-INJECTION-EGRESS, P-AUTOMATION-ACTOR api/test_actions_ai.py, domain/test_automation_nodes.py, api/test_automation_vars.py, domain/test_automation_runs.py, api/test_automation_tools.py
Approvals decided in chat rooms P-AUTOMATION-APPROVAL api/test_approvals_chat.py, api/test_approvals.py
Loop amplification P-AUTOMATION-LOOP domain/test_automation_runs.py
Timers and approvals flooding P-AUTOMATION-LOOP (the timer cap, added), P-AUTOMATION-APPROVAL domain/test_timers.py, api/test_approvals.py
Regular expression cost (matches) the matches paragraph and the /api/v1/automations row domain/test_match_ops.py

The citations are a "Tested by" note at the end of each row in the prose, and an x-tests list in the YAML and JSON. ci/validate_threat_model.py now fails when a cited test file or function no longer exists. The threat model workflow also runs when backend tests change, so renaming a cited test fails CI at once.

Motivation and Context

Workflow studio M12, Build step 2: "One pass over every module's entries ... Make sure each names its mitigation and test." It follows AGENTS.md's flywheel, where a broken rule becomes a test: a citation that goes stale now turns CI red.

Gaps found, none needing new behaviour, noted for later:

  • The 200-character limit on matches patterns is enforced and tested, but not documented.
  • "A decision is claimed once" is tested only in sequence, not with two decisions at the same moment.
  • The real cap values (100 approvals, 1000 timers, 64 KB and 60 calls a minute per hook) match the docs, but the tests use smaller monkeypatched numbers.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests: ci/test_validate_threat_model.py::test_cited_tests_must_exist.
  • My change requires documentation updates: threat-model.md, .yaml and .json.
  • CHANGELOG: n/a, the title says it.

Checks run:

  • python3 ci/validate_threat_model.py --base origin/main: "prose, YAML and JSON agree".
  • Its 9 tests pass.
  • Local CI pre-commit job passes.
  • The 12 cited backend test files: 120 passed.

Rebased on main: kept main's new P-APPROVAL wording beside these rows.

Done questions (AGENTS.md)

  • Goal: the M12 threat model pass; merged on green.
  • Agents: n/a, documentation and a CI check.
  • Zero setup: n/a.
  • Fewest clicks: n/a.
  • Configurable: n/a.
  • Light: n/a, CI only.
  • Private and secure: every automations surface names its mitigation and the test that proves it.
  • Cost: n/a.
  • User decides: n/a.
  • Upgrades: n/a.
  • Honest: it cites only tests that exist, and the validator keeps that true.
  • Tested and documented: validator test added.
  • Open: n/a.
  • Reported in the project thread. The gaps are listed above.
  • Reuse: the existing validator and workflow.

Generated by Claude Code

…ts mitigation and test

Workflow studio M12, item 2. Each automations entry now names its mitigation and the backend tests that prove it:

- inbound webhooks (POST /automations/hooks/{token}): test_automation_hooks.py
- outbound http_request (P-SSRF-GUARD): test_actions_web.py
- the agent acting on outside text (P-INJECTION-EGRESS, P-AUTOMATION-ACTOR): test_actions_ai.py,
  test_automation_nodes.py, test_automation_vars.py, test_automation_runs.py
- approvals decided in chat rooms and the 100-waiting cap (P-AUTOMATION-APPROVAL): test_approvals.py,
  test_approvals_chat.py
- loop amplification (P-AUTOMATION-LOOP): test_automation_runs.py
- timers flooding: the 1000-waiting cap per automation, missing from the model, is added to P-AUTOMATION-LOOP
  (test_timers.py)
- `matches` cost: the /api/v1/automations row now names the bound as its companions did; test_match_ops.py

The prose cites them as "Tested by"; the YAML and JSON carry them as x-tests. ci/validate_threat_model.py now fails
when a cited test file or function is gone, and the threat model workflow also runs when fastapi_backend/tests
changes, so a citation can't outlive its test.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AjJqXgjj1cNdKGRQbX5frb
@adeelahmad adeelahmad self-assigned this Oct 18, 2026
# Conflicts:
#	threat-model.md
@adeelahmad
adeelahmad merged commit 7968d39 into main Oct 18, 2026
10 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-li6m25 branch October 18, 2026 14:01
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.

2 participants