Repository navigation
Description
Task
T-109· Milestone M7 — API · Size S · Priority P1 · Epic #7Implements NFR-SEC-001 · NFR-SEC-003
Branch
test/t-109-security-test-suite-path-traversal— one task = one branch = one PR (doc 32 §6)
Summary
Add tests/security/ mapping each STRIDE mitigation of doc 31 §3 to an automated test: artefact traversal, bundle ../ and symlink extraction, billion-laughs YAML, oversized upload, constraint expressions attempting attribute access/imports, missing/wrong token, CORS from disallowed origin, secrets absent from logs and /meta.
Context / motivation
Doc 31 §4: every derived security requirement must be verified by a test.
Scope
In scope
- Traceability table
docs/evidence/security-tests.md(threat → test id).
Implementation guidance
- Directory
backend/tests/security/with one module per threat group; marker@pytest.mark.security; step appended to the integration stage ofci.yml. - Coverage map (doc 31 §3): TM-01 bind/token tests (reuse T-080c fixtures); TM-02 billion-laughs and
!!python/objectYAML; TM-03 constraint expressions (__import__('os'), attribute access, lambdas, comprehensions, huge exponents) rejected by the T-022 evaluator; TM-04 artefact traversal; TM-05 label XSS escaped in the HTML report; TM-06 form-encoded/cross-origin POST rejected; TM-08 scenario values with shell metacharacters only reach YAML files (Gazebo materialiser golden test); TM-13 upload/budget/resolution caps; TM-14 malicious bundle (absolute path,.., symlink, hardlink) rejected by T-014 import; TM-15 manifests contain hashed hostnames. docs/evidence/security-tests.mdtable: threat id → test node id → status;scripts/check_security_map.pyfails CI if a TM row lacks an entry.- Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff
PLR2004); public APIs typed (mypy strict) and documented.
Acceptance criteria
- Every TM-xx row in doc 31 §3 has at least one passing test or an explicit, justified N/A.
- Job runs in CI integration stage.
- Coverage-map checker green.
- All payload fixtures < 10 KB.
- Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
- Docs, config reference and CHANGELOG
Unreleasedupdated where behaviour, keys or interfaces changed. - Definition of Done (doc 32 §3) satisfied.
Tests required
- The suite.
scripts/check_security_map.pyunit test.
Dependencies
Blocked by: #144 (T-080c), #146 (T-081a), #150 (T-081e), #35 (T-022), #125 (T-014)
Blocks: no other task (leaf)
Parallelization notes
Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:
backend/tests/security/**docs/evidence/security-tests.md
Test-only.
Definition of Done
Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-109 (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.
References
Design docs: doc 31 §3 · doc 31 §4 · doc 21 §1
Requirements: NFR-SEC-001 · NFR-SEC-003 (traceability: doc 28)
External:
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsBacklog
Activity
?token=#144.tar.zst, JSON Lines + artefacts) with safe extraction #125