Skip to content

Security Test Plan

mavrovde edited this page Nov 8, 2026 · 2 revisions

Security Test Plan

The test design for security and licence enforcement: the authentication and authorisation matrix, the licence gate matrix, leak tests, abuse cases from the threat model, and the automated scans. Part of the Testing Strategy. Requirements: TEST-006, TEST-008, TEST-013 on Spec: Conformance and Acceptance; SEC on Spec: Authentication and Authorisation; NFR-SEC and the OWASP mapping on Spec: Non-Functional Requirements; THR on Spec: Threat Model; SSC on Spec: Secure SDLC and Supply Chain.

All security tests run against CI-started instances, the test stack or staging, with generated vf_test_ keys and synthetic data. None targets the production API.

1. Authentication matrix

Each row is one handler test per operation class (data, service, OPTIONS) and one end-to-end case.

Credential Expected Requirement
none 401 missing-key with WWW-Authenticate SEC-001, ERR-006
Authorization: Bearer with a valid key 200 SEC-001
X-API-Key with a valid key 200 SEC-001
key in the query string or form body 400 key-in-query, key not checked, flagged SEC-002
malformed key, bad checksum, unknown id, wrong secret identical 401 invalid-key bodies; no timing difference significant at p < 0.01 over 10 000 tries SEC-003, QAS-SEC-03
expired key 401 key-expired SEC-040
revoked key 401 key-revoked on every instance within the propagation target SEC-042, QAS-SEC-04
rotated key, previous secret within overlap / after overlap 200 / 401 SEC-041
vf_test_ key on a production-configured instance, and the reverse refused SEC-004
repeated failures from one address 429 rate-limited after auth.failure_limit SEC-052

2. Authorisation and licence gate matrix

The full product of scope × plan × use class × source family × terms acceptance over the fictional families of the fixture set (Test Data Management), which cover every licence class.

Condition Expected Requirement
key lacks the operation's scope 403 scope-denied, checked before parameters SEC-020
family not in the plan items of that family never returned SEC-030
use class not permitted by the family's terms items never returned; restricted-purpose note verbatim when permitted SEC-030, LIC-006
terms not accepted, or accepted for an old terms version items never returned SEC-034
some families permitted, some not only permitted items, partial warning SEC-033
no family permitted 403 source-not-permitted SEC-033
a forbidden row planted in storage post-check aborts with 500 internal, violation metric incremented, nothing served SEC-032
plan change effective within auth.key_cache_ttl SEC-022

The expected value of each cell comes from an independent table reviewed by the owner, not from the table the code reads, so that a wrong rule cannot make both sides agree. Pass criterion: zero forbidden items across the whole matrix (QAS-SEC-01). Mutation testing covers the gate code (issue #17).

3. Leak tests

Test Method Pass
Planted-secret sweep keys, the pepper and a canary secret are planted in headers, query strings, bodies and induced errors; every log sink, trace, metric label, error body and /v1/meta is searched zero occurrences (NFR-OBS-004, QAS-SEC-05, CFG-007)
Address truncation requests from planted addresses; logs and access-store contents searched only truncated prefixes (NFR-PRIV-002, RATE-015)
Error detail induced storage, parsing and internal faults no stack trace, statement text, storage name, hostname or key material in any problem (ERR-004)
Version disclosure response headers on every status no server or framework version (PROT-032)
Scope lint the repository, the OpenAPI document and payload snapshots no collection vocabulary, no internal storage names (LIC-010, DEV-044)

4. OWASP API Security Top 10 (2023) test mapping

Risk Test cases Level
API1 Broken object level authorisation opaque ids cannot be enumerated into data a plan may not see: every id-based operation run with keys of every plan over the gate matrix Handler, Security
API2 Broken authentication the authentication matrix (section 1); key format fuzzing (issue #16) Handler, Security
API3 Broken object property level authorisation fields cannot add members; response schemas forbid additional properties; no storage name in any payload Contract
API4 Unrestricted resource consumption every size limit (NFR-SIZE-001) at and above its bound; huge areas and long windows refused before work; page caps; overload scenario Handler, Load
API5 Broken function level authorisation no administrative function reachable on the public listener; metrics only on the operator listener End to end, Security
API6 Unrestricted access to sensitive business flows quota exhaustion and history-depth limits; bulk extraction by paging stopped by quota Handler, Load
API7 Server-side request forgery no parameter is used as an outbound address: URL-shaped values in every string parameter cause no outbound connection (egress denied and observed) Security
API8 Security misconfiguration security headers on every status (NFR-SEC-001); boot refusal of invalid configuration (CFG-003); TLS configuration scan of staging; CORS allow-list Handler, Config, Security
API9 Improper inventory management the served document equals the released one minus disabled operations (FR-SVC-005); disabled operations answer 404 feature-disabled and are absent from the document Contract
API10 Unsafe consumption of APIs code maps are total, unknown codes become other with a metric (ENV-051); the post-check on every item Integration

5. Threat model coverage

Every THR row has at least one test (TM-003, TEST-013).

Threat Test
THR-001 stolen key revocation propagation test; secret-scanning pattern test with a planted vf_test_ key
THR-002 man in the middle TLS scan of staging; HSTS header test
THR-003 volumetric flood per-IP bucket test before key validation; spike scenario
THR-004 key guessing uniform 401 and timing test; failure limit
THR-005 cursor or parameter manipulation tamper corpus refused at 100 % (QAS-SEC-02); negative-direction contract suite; area bounds
THR-006 repudiation metering per key and hour recorded; audit record written in the same transaction as each lifecycle action
THR-007 data outside its licence the licence gate matrix and the post-check
THR-008 internal names in errors error-detail leak test; scope lint
THR-009 keys in logs planted-secret sweep
THR-010 expensive queries size, area and window limits; deadline and cancellation tests
THR-011 cache poisoning or blow-up cache key includes the permitted-family set: two keys with different plans never share an entry; byte bound test
THR-012 calling outside scope scope checked before parameters
THR-013 metrics exposed metrics path answers 404 on the public listener
THR-014 injection writes read-only role write refused; SQL metacharacters in every parameter cause no error beyond 400; static rule for parameterised statements (NFR-SEC-003)
THR-015 store starvation connection and statement limits of the role asserted; load scenario holds at most db.pool_max
THR-016 key table theft only MACs in the access store; pepper absent from it
THR-017 audit tampering update and delete of audit rows refused for the service role
THR-018 unauthorised key issue operator tool refuses without the access-store role; every action audited
THR-019 supply chain dependency review, pinned actions lint, SBOM and signature verification at deploy, planted vulnerable dependency turns the pull request red
THR-020 key in a browser app CORS allow-list tests; per-key quota limits damage

6. Abuse cases

Abuse case Expected
Enumerate all places by paging through a broad search stopped by page caps and quota; no generic filter language (ENV-030)
Replay a cursor with widened filters 400 invalid-cursor
Send a route of maximum points and length on every request refused above geo.max_route_points or geo.max_route_km; admission refuses before storage when the budget is spent
Request the same expensive answer concurrently from many keys single-flight and per-key in-flight limit
Rotate keys rapidly to reset quotas quotas belong to the key id, not the secret
Strip attribution with fields or the GeoJSON variant attribution and notes still present (LIC-004)

7. Automated scans

Tools and thresholds are owned by issue #12; this plan states their place in testing.

Category Examples When Blocks
SAST CodeQL, SonarCloud every pull request, weekly on main high or critical
Secret scanning push protection, gitleaks always any finding
Dependencies Dependabot, govulncheck, Snyk, dependency review with licence policy every pull request, weekly high or critical; disallowed licence (SSC-003)
Container Trivy, Hadolint every pull request, release critical
DAST OWASP ZAP baseline per pull request, full scan weekly, against a CI-started instance per pull request and weekly high
Schema-driven fuzzing Schemathesis per pull request, long run nightly any 5xx or schema violation
Repository OpenSSF Scorecard weekly below 7.0 (SSC-012)

One tool per kind of check: a second tool reporting the same class of finding is not added (Spec: Secure SDLC and Supply Chain). Each scan fails closed: a scan that read zero files, zero dependencies or zero endpoints is a failure (TST-011). Remediation deadlines are those of SSC-015.

Home

About

Design

Data Model

Technical specification

Testing

Engineering

Technology choice

Reference

Clone this wiki locally