compound-agent 1.7.6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -1
- package/README.md +70 -47
- package/bin/ca +32 -0
- package/package.json +19 -78
- package/scripts/postinstall.cjs +221 -0
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -13158
- package/dist/cli.js.map +0 -1
- package/dist/index.d.ts +0 -3730
- package/dist/index.js +0 -3240
- package/dist/index.js.map +0 -1
- package/docs/research/AgenticAiCodebaseGuide.md +0 -1206
- package/docs/research/BuildingACCompilerAnthropic.md +0 -116
- package/docs/research/HarnessEngineeringOpenAi.md +0 -220
- package/docs/research/code-review/systematic-review-methodology.md +0 -409
- package/docs/research/index.md +0 -76
- package/docs/research/learning-systems/knowledge-compounding-for-agents.md +0 -695
- package/docs/research/property-testing/property-based-testing-and-invariants.md +0 -742
- package/docs/research/scenario-testing/advanced-and-emerging.md +0 -470
- package/docs/research/scenario-testing/core-foundations.md +0 -507
- package/docs/research/scenario-testing/domain-specific-and-human-factors.md +0 -474
- package/docs/research/security/auth-patterns.md +0 -138
- package/docs/research/security/data-exposure.md +0 -185
- package/docs/research/security/dependency-security.md +0 -91
- package/docs/research/security/injection-patterns.md +0 -249
- package/docs/research/security/overview.md +0 -81
- package/docs/research/security/secrets-checklist.md +0 -92
- package/docs/research/security/secure-coding-failure.md +0 -297
- package/docs/research/software_architecture/01-science-of-decomposition.md +0 -615
- package/docs/research/software_architecture/02-architecture-under-uncertainty.md +0 -649
- package/docs/research/software_architecture/03-emergent-behavior-in-composed-systems.md +0 -644
- package/docs/research/spec_design/decision_theory_specifications_and_multi_criteria_tradeoffs.md +0 -0
- package/docs/research/spec_design/design_by_contract.md +0 -251
- package/docs/research/spec_design/domain_driven_design_strategic_modeling.md +0 -183
- package/docs/research/spec_design/formal_specification_methods.md +0 -161
- package/docs/research/spec_design/logic_and_proof_theory_under_the_curry_howard_correspondence.md +0 -250
- package/docs/research/spec_design/natural_language_formal_semantics_abuguity_in_specifications.md +0 -259
- package/docs/research/spec_design/requirements_engineering.md +0 -234
- package/docs/research/spec_design/systems_engineering_specifications_emergent_behavior_interface_contracts.md +0 -149
- package/docs/research/spec_design/what_is_this_about.md +0 -305
- package/docs/research/tdd/test-driven-development-methodology.md +0 -547
- package/docs/research/test-optimization-strategies.md +0 -401
- package/scripts/postinstall.mjs +0 -102
|
@@ -1,474 +0,0 @@
|
|
|
1
|
-
# Scenario Testing for CS Development: Domain-Specific Applications & Human Factors
|
|
2
|
-
|
|
3
|
-
*2026-03-07*
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Abstract
|
|
8
|
-
|
|
9
|
-
This survey examines how scenario testing adapts when deployed within five high-stakes domains: safety-critical and embedded systems, distributed systems and microservices, security and adversarial contexts, real-time and performance engineering, and human-centered design. Where Paper 1 of this series established the combinatorial, model-based, and behavioral foundations of scenario testing, and Paper 2 addressed mutation testing, formal verification, AI-assisted generation, and chaos engineering, this paper argues a unifying thesis: the same foundational scenario primitives -- precondition, trigger, expected outcome -- are universally preserved across domains, but the surrounding constraints of regulation, failure consequence, adversarial intent, temporal precision, and cognitive process transform both the generation and evaluation of scenarios so fundamentally that domain-naive approaches fail systematically. Each domain imposes a distinct epistemological contract on what it means to have tested "enough."
|
|
10
|
-
|
|
11
|
-
The analysis proceeds by characterizing each domain's regulatory pressure, failure-consequence topology, and scenario-complexity drivers before examining specific tools, standards, and empirical evidence. Safety-critical domains demand exhaustive traceability and structural coverage proofs; distributed systems require contractual inter-service verification and resilience to partial failure; security demands adversarial imagination beyond what specification-driven processes naturally produce; real-time systems require statistical confidence in timing behavior that functional testing cannot provide; and human factors research reveals that every scenario set reflects the biases, blind spots, and social dynamics of the team that authored it. A cross-domain synthesis table and open problem enumeration conclude the survey.
|
|
12
|
-
|
|
13
|
-
The paper draws on standards bodies (RTCA, ISO, IEC, OWASP, MITRE), canonical academic literature in safety engineering, security engineering, distributed systems, performance modeling, and cognitive science, as well as industrial tool ecosystems. It is positioned as a practitioner-accessible but academically rigorous complement to Papers 1 and 2, grounding abstract testing theory in the irreducible messiness of real deployment domains.
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## 1. Introduction
|
|
18
|
-
|
|
19
|
-
### 1.1 The Insufficiency of Generic Scenario Testing
|
|
20
|
-
|
|
21
|
-
A scenario, in its most abstract form, is a description of a system traversal: a starting state, a sequence of stimuli, and a set of assertions about the resulting state or behavior. This abstraction is powerful precisely because it is domain-agnostic -- the same grammatical structure supports a login workflow, a fuel injection timing sequence, an HTTP contract between two microservices, and an SQL injection attack. Papers 1 and 2 in this series examined the structural and algorithmic machinery for generating, selecting, and evaluating such scenarios.
|
|
22
|
-
|
|
23
|
-
What those papers could not fully address is the question of *adequacy under constraint*. The aerospace engineer asking whether a flight management software has been tested well enough faces a legally binding answer encoded in RTCA DO-178C, where "well enough" means, among many other things, that every decision in the source code has been exercised with both true and false outcomes through at least one test case -- a property called Modified Condition/Decision Coverage (MC/DC) -- and that every requirement has a traceable test case, and that the DER (Designated Engineering Representative) can sign off on an evidence package. The security researcher asking the same question faces a fundamentally different epistemological problem: the adversary is not a random perturbation but an intelligent, adaptive agent whose scenario space is unbounded. The performance engineer faces yet a third regime: the system may pass all functional scenarios while still failing under load.
|
|
24
|
-
|
|
25
|
-
These are not superficial variations. They represent categorically different theories of what testing is for, what counts as coverage, and what constitutes evidence of quality.
|
|
26
|
-
|
|
27
|
-
### 1.2 Scope of This Survey
|
|
28
|
-
|
|
29
|
-
1. **Safety-Critical and Embedded Systems** -- DO-178C, ISO 26262, IEC 62304, IEC 61508; requirements-based testing; MC/DC coverage; HIL and SIL platforms.
|
|
30
|
-
2. **Distributed Systems and Microservices** -- Consumer-driven contract testing; service virtualization; saga testing; eventual consistency and partition scenarios.
|
|
31
|
-
3. **Security and Adversarial Scenarios** -- Threat modeling (STRIDE, PASTA); abuse cases; OWASP testing scenarios; fuzzing; MITRE ATT&CK; red team exercises.
|
|
32
|
-
4. **Real-Time and Performance Scenarios** -- Load profile design; SLA-driven scenarios; WCET analysis; scheduling theory.
|
|
33
|
-
5. **Human Factors in Scenario Design** -- Cognitive biases; collaborative discovery workshops; domain expert roles; scenario-based design.
|
|
34
|
-
|
|
35
|
-
### 1.3 Key Definitions
|
|
36
|
-
|
|
37
|
-
**Safety Integrity Level (SIL):** A discrete level (1-4 in IEC 61508) representing the required risk reduction. Analogous: DAL (DO-178C), ASIL (ISO 26262).
|
|
38
|
-
|
|
39
|
-
**Contract Testing:** Codifying service interactions as machine-verifiable contracts, allowing independent testing.
|
|
40
|
-
|
|
41
|
-
**Threat Model:** Structured representation of potential adversarial actions, including assets, threat actors, attack vectors, and mitigations.
|
|
42
|
-
|
|
43
|
-
**Load Profile:** Parameterized description of demand pattern for performance testing.
|
|
44
|
-
|
|
45
|
-
**Cognitive Bias:** Systematic deviation from rational judgment that causes coverage blind spots in scenario authoring.
|
|
46
|
-
|
|
47
|
-
### 1.4 The Domain Adaptation Thesis
|
|
48
|
-
|
|
49
|
-
The scenario primitive is universal, but the *generation oracle* (how we decide which scenarios to write), the *adequacy oracle* (how we decide when we have enough), and the *evaluation oracle* (how we judge whether a scenario passed) are all domain-specific constructs that must be engineered with the same rigor as the system under test itself.
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## 2. Foundations
|
|
54
|
-
|
|
55
|
-
### 2.1 Domain Engineering
|
|
56
|
-
|
|
57
|
-
Czarnecki and Eisenecker (2000) established the distinction between problem space and solution space. Every domain encodes its own problem-space ontology: "flight phase" is first-class in aviation testing; "saga" is central to microservice testing. Kang et al.'s FODA method (1990) showed that domain variability captured in feature models enables feature-model-driven test selection.
|
|
58
|
-
|
|
59
|
-
### 2.2 Safety Engineering
|
|
60
|
-
|
|
61
|
-
Leveson's "Engineering a Safer World" (2011) reframes safety as the enforcement of safety constraints on system behavior via STAMP (System-Theoretic Accident Model and Processes). STPA (System-Theoretic Process Analysis) generates safety constraints from a control-theoretic model and derives test scenarios as constraint-exercise requirements. Heimdahl and Leveson (1996) established formal criteria for requirements completeness at mode transitions.
|
|
62
|
-
|
|
63
|
-
### 2.3 Security Engineering
|
|
64
|
-
|
|
65
|
-
Anderson's "Security Engineering" (2008, 3rd ed. 2020) provides the attack tree formalism: adversarial goals decomposed recursively into executable attack scenarios. McGraw's "Software Security" (2006) introduced "evil user stories." Sindre and Opdahl (2005) formalized misuse cases.
|
|
66
|
-
|
|
67
|
-
### 2.4 Human Factors
|
|
68
|
-
|
|
69
|
-
Reason's Swiss Cheese Model (1990) explains multi-layered defense -- each scenario is a layer, gaps are the holes. Norman's "Design of Everyday Things" (1988, 2013) provides the Gulf of Evaluation concept. Carroll's "Making Use" (2000) established scenario-based design. Kahneman's "Thinking, Fast and Slow" (2011) provides the cognitive bias framework.
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## 3. Taxonomy of Domains
|
|
74
|
-
|
|
75
|
-
| Dimension | Safety-Critical | Distributed Systems | Security | Real-Time/Performance | Human Factors |
|
|
76
|
-
|---|---|---|---|---|---|
|
|
77
|
-
| **Regulatory pressure** | Extreme (legally binding) | Low (de facto) | Moderate (GDPR, PCI-DSS) | Low-Moderate (SLA) | Negligible |
|
|
78
|
-
| **Failure consequence** | Catastrophic (loss of life) | High (data loss, unavailability) | High-Extreme (breach, fraud) | Moderate-High (SLA breach) | Indirect (shipped defects) |
|
|
79
|
-
| **Complexity driver** | Mode interaction, rare events | Topology, partitions, consistency | Adversarial creativity | Concurrency, load distribution | Cognitive biases, tacit knowledge |
|
|
80
|
-
| **Test cycle duration** | Months to years | Hours to days | Days to weeks | Hours to days | Hours to weeks |
|
|
81
|
-
| **Tool maturity** | Very high (decades) | High-Medium (~10 years) | High (exploitation); medium (scenario libraries) | High (JMeter 20+ years) | Low (artisanal facilitation) |
|
|
82
|
-
| **Adequacy oracle** | Traceability + MC/DC | Contract compliance + saga invariants | ATT&CK coverage + vuln discovery rate | SLA thresholds + percentile targets | Team consensus + heuristics |
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## 4. Analysis
|
|
87
|
-
|
|
88
|
-
### 4.1 Safety-Critical and Embedded Systems
|
|
89
|
-
|
|
90
|
-
#### 4.1.1 Theory and Mechanism
|
|
91
|
-
|
|
92
|
-
**Requirements-based testing**: Every scenario must trace to a requirement; every requirement must be covered. The bidirectional traceability matrix is a primary deliverable.
|
|
93
|
-
|
|
94
|
-
**Structural coverage** by Development Assurance Level (DO-178C Table A-7):
|
|
95
|
-
- **DAL A** (catastrophic): MC/DC coverage required
|
|
96
|
-
- **DAL B** (hazardous): Decision coverage required
|
|
97
|
-
- **DAL C** (major): Statement coverage required
|
|
98
|
-
- **DAL D** (minor): No structural coverage required
|
|
99
|
-
|
|
100
|
-
**MC/DC** (Chilenski & Miller, 1994): Requires each condition to independently affect the decision outcome. For N conditions, typically N+1 test cases suffice (vs. 2^N for full Boolean coverage).
|
|
101
|
-
|
|
102
|
-
**Tool qualification**: Any tool used for certification evidence must be qualified under DO-330, adding recursive verification obligations.
|
|
103
|
-
|
|
104
|
-
**HIL and SIL**: SIL replaces target hardware with simulation (faster, higher volume, no hardware-specific timing). HIL retains actual hardware with simulated environment (real-time, detects hardware interaction defects, expensive).
|
|
105
|
-
|
|
106
|
-
#### 4.1.2 Literature Evidence
|
|
107
|
-
|
|
108
|
-
DO-178C (RTCA, 2011) with supplements DO-330 (tool qualification), DO-331 (model-based development), DO-333 (formal methods). ISO 26262 Part 6 Clause 9 mandates methods by ASIL. IEC 62304 mandates safety class assignment (A/B/C) with manufacturer-justified testing methods.
|
|
109
|
-
|
|
110
|
-
Leveson (2011, Chapter 14) argues the dominant failure mode is incomplete hazard identification -- scenarios written for imagined behaviors, not actual accident-causing ones. STPA addresses this systematically.
|
|
111
|
-
|
|
112
|
-
Hatton (1997) demonstrated that static analysis and testing in combination were both required for safety-critical C code.
|
|
113
|
-
|
|
114
|
-
#### 4.1.3 Implementations and Benchmarks
|
|
115
|
-
|
|
116
|
-
- **LDRA TBrun/TBvision**: Requirements traceability + MC/DC coverage. DO-178C/ISO 26262 certified.
|
|
117
|
-
- **VectorCAST**: C/C++/Ada unit and integration testing. DO-330 qualified. CANoe/CANalyzer integration for automotive HIL.
|
|
118
|
-
- **Parasoft C/C++test**: Policy enforcement + coverage with continuous monitoring.
|
|
119
|
-
- **Simulink Test**: Model-level scenario specification in terms of physical signals (DO-331).
|
|
120
|
-
- **dSPACE SCALEXIO/VEOS**: Industrial standard HIL/SIL platforms for automotive/aerospace.
|
|
121
|
-
- **NI VeriStand**: Aerospace HIL with LabVIEW-based test orchestration.
|
|
122
|
-
|
|
123
|
-
Kanstren (2012) found the primary tool differentiator was traceability coverage quality, not execution capability.
|
|
124
|
-
|
|
125
|
-
#### 4.1.4 Strengths and Limitations
|
|
126
|
-
|
|
127
|
-
**Strengths**: Dual adequacy oracle (requirements + structural coverage). Auditable evidence. Regulatory certainty.
|
|
128
|
-
|
|
129
|
-
**Limitations**: Cost (~$1,000/LOC for DAL A per Rierson, 2013). MC/DC + requirements cannot guarantee all failure modes are considered -- system-level interactions remain a gap. STPA addresses this but increases burden and is not yet mandated.
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
### 4.2 Distributed Systems and Microservices
|
|
134
|
-
|
|
135
|
-
#### 4.2.1 Theory and Mechanism
|
|
136
|
-
|
|
137
|
-
**Consumer-Driven Contract Testing** (Clemson, 2014): Consumer defines expected interaction; provider verifies against consumer's expectation. Transforms O(n^2) integration into O(n) verification. Assumptions: contract completeness and currency. "Contract drift" is the primary failure mode.
|
|
138
|
-
|
|
139
|
-
**Service Virtualization**: Simulation services mimicking dependency behavior including stateful behavior, latency, and fault conditions.
|
|
140
|
-
|
|
141
|
-
**Saga Testing** (Richardson, 2018): For each saga step, generate a failure scenario and assert correct compensating behavior. Multi-party transactional scenarios require coordination across services.
|
|
142
|
-
|
|
143
|
-
**Eventual Consistency Scenarios**: Require temporal assertions: "after write to A, B returns updated value within T ms with probability P."
|
|
144
|
-
|
|
145
|
-
**Network Partition Testing**: Tests CAP theorem behavior -- system either refuses writes (CP) or accepts and reconciles (AP).
|
|
146
|
-
|
|
147
|
-
#### 4.2.2 Literature Evidence
|
|
148
|
-
|
|
149
|
-
Newman's "Building Microservices" (2015, 2nd ed. 2019): Testing pyramid with contract layer. Observation that E2E flakiness grows with square of services involved.
|
|
150
|
-
|
|
151
|
-
Richardson's "Microservices Patterns" (2018): Saga failure taxonomy mapping to scenario generation grammar.
|
|
152
|
-
|
|
153
|
-
Zampetti et al. (2020): 78% of 138 microservices projects had no inter-service contract tests. Projects with contracts had significantly lower integration defect rates.
|
|
154
|
-
|
|
155
|
-
#### 4.2.3 Implementations and Benchmarks
|
|
156
|
-
|
|
157
|
-
- **Pact**: Reference consumer-driven contract testing. Multi-language + Pact Broker for shared registry.
|
|
158
|
-
- **Spring Cloud Contract**: Provider-driven alternative, Spring-native.
|
|
159
|
-
- **WireMock**: HTTP service virtualization with stateful scenarios.
|
|
160
|
-
- **Hoverfly**: Transparent proxy + simulation with interaction journals.
|
|
161
|
-
- **Testcontainers**: On-demand Docker containers for isolated multi-service scenarios.
|
|
162
|
-
|
|
163
|
-
#### 4.2.4 Strengths and Limitations
|
|
164
|
-
|
|
165
|
-
**Strengths**: Independent team delivery. Decoupled deployment.
|
|
166
|
-
|
|
167
|
-
**Limitations**: Contract drift. E2E flakiness. Observability gap for failure diagnosis.
|
|
168
|
-
|
|
169
|
-
---
|
|
170
|
-
|
|
171
|
-
### 4.3 Security and Adversarial Scenarios
|
|
172
|
-
|
|
173
|
-
#### 4.3.1 Theory and Mechanism
|
|
174
|
-
|
|
175
|
-
**STRIDE** (Shostack, 2014): Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of Privilege. Each category maps to scenario patterns.
|
|
176
|
-
|
|
177
|
-
**PASTA** (UcedaVelez & Morana, 2015): Seven-stage risk-centric threat modeling with explicit attack simulation stage.
|
|
178
|
-
|
|
179
|
-
**Attack Trees** (Schneier, 1999; Mauw & Oostdijk, 2005): Hierarchical scenario decomposition. Each root-to-leaf path is a complete scenario.
|
|
180
|
-
|
|
181
|
-
**Misuse Cases** (Sindre & Opdahl, 2005): "Evil twin" of use cases with "threatens" and "mitigates" relationships.
|
|
182
|
-
|
|
183
|
-
**Security Fuzzing**: AFL introduced coverage-guided fuzzing (2013). AFL++ (Fioraldi et al., 2020) extended with improved strategies. LibFuzzer provides in-process fuzzing with sanitizer integration.
|
|
184
|
-
|
|
185
|
-
**MITRE ATT&CK** (Strom et al., 2018): Comprehensive TTP library from observed real-world attacks. Coverage metric: percentage of applicable techniques tested.
|
|
186
|
-
|
|
187
|
-
#### 4.3.2 Literature Evidence
|
|
188
|
-
|
|
189
|
-
OWASP Testing Guide v4.2: 90+ specific test scenarios for web applications.
|
|
190
|
-
|
|
191
|
-
Bau et al. (2010): Web application scanner false negative rates of 44-97%, with tools most effective for syntactically simple vulnerabilities and least effective for semantic/business logic flaws.
|
|
192
|
-
|
|
193
|
-
Bohme et al. (2017): Fuzzing discovers more bugs per CPU-hour for large input spaces; symbolic execution better for small, complex spaces.
|
|
194
|
-
|
|
195
|
-
#### 4.3.3 Implementations and Benchmarks
|
|
196
|
-
|
|
197
|
-
- **OWASP ZAP**: Open-source web security scanner with configurable scan policies.
|
|
198
|
-
- **Burp Suite**: Industry-standard commercial web security testing.
|
|
199
|
-
- **AFL++/libFuzzer**: Coverage-guided fuzzing. Google's OSS-Fuzz continuously fuzzes hundreds of projects.
|
|
200
|
-
- **Metasploit**: Exploit framework operationalizing ATT&CK-aligned attack scenarios.
|
|
201
|
-
- **MITRE ATT&CK Navigator**: Coverage visualization and gap identification tool.
|
|
202
|
-
|
|
203
|
-
#### 4.3.4 Strengths and Limitations
|
|
204
|
-
|
|
205
|
-
**Strengths**: ATT&CK scenarios grounded in actual attacker behavior. Continuous framework updates from new threat intelligence.
|
|
206
|
-
|
|
207
|
-
**Limitations**: Unbounded adversary problem -- no finite library covers all attacks. Zero-days by definition absent. Automated scanners have high false negative rates for semantic vulnerabilities.
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
|
|
211
|
-
### 4.4 Real-Time and Performance Scenarios
|
|
212
|
-
|
|
213
|
-
#### 4.4.1 Theory and Mechanism
|
|
214
|
-
|
|
215
|
-
**Load Profile Design** (Jain, 1991): Arrival rate model (constant, ramp, spike, step), think time distribution (negative exponential), request mix (from production logs), data characteristics.
|
|
216
|
-
|
|
217
|
-
**SLA-Driven Design**: "95th percentile < 200ms at 1,000 concurrent users" defines both pass/fail and load parameters. Concurrent users estimated via Little's Law: N = lambda * W.
|
|
218
|
-
|
|
219
|
-
**WCET Analysis** (Wilhelm et al., 2008): Static analysis + processor architecture modeling for provable execution time upper bounds. Tension between precision (tight bounds) and soundness (guaranteed bounds).
|
|
220
|
-
|
|
221
|
-
**Scheduling Theory** (Liu & Layland, 1973): Rate Monotonic optimal for fixed-priority; utilization bound sum(Ci/Ti) <= n(2^(1/n) - 1).
|
|
222
|
-
|
|
223
|
-
#### 4.4.2 Literature Evidence
|
|
224
|
-
|
|
225
|
-
Molyneaux (2014): Taxonomy of performance test types (load, stress, soak, spike, volume).
|
|
226
|
-
|
|
227
|
-
Iosup et al. (2011): Up to 40% difference in reported response times between tools on identical scenarios, due to client-side overhead differences.
|
|
228
|
-
|
|
229
|
-
Tene (2015): "How NOT to Measure Latency" -- conventional tools systematically under-report high-percentile latency via coordinated omission.
|
|
230
|
-
|
|
231
|
-
#### 4.4.3 Implementations and Benchmarks
|
|
232
|
-
|
|
233
|
-
- **Apache JMeter**: Most deployed. 20+ years. Broad protocol support. XML test plans difficult to version-control.
|
|
234
|
-
- **Gatling**: Scala DSL. Version-controllable. Akka-based high concurrency.
|
|
235
|
-
- **k6**: JavaScript scenarios. Thresholds, scenarios API, browser testing. Grafana Labs.
|
|
236
|
-
- **Locust**: Python-based. Maximum expressive flexibility.
|
|
237
|
-
- **aiT WCET Analyzer** (AbsInt): Commercial, DO-178C/ISO 26262 qualified.
|
|
238
|
-
|
|
239
|
-
#### 4.4.4 Strengths and Limitations
|
|
240
|
-
|
|
241
|
-
**Strengths**: Direct connection to business outcomes (SLA failure = customer impact).
|
|
242
|
-
|
|
243
|
-
**Limitations**: Production representativeness decays as traffic patterns shift. "Black swan" load events not in test suite. Statistical validity frequently violated -- p50 reported without p95/p99.
|
|
244
|
-
|
|
245
|
-
---
|
|
246
|
-
|
|
247
|
-
### 4.5 Human Factors in Scenario Design
|
|
248
|
-
|
|
249
|
-
#### 4.5.1 Theory and Mechanism
|
|
250
|
-
|
|
251
|
-
**Cognitive Biases**:
|
|
252
|
-
- *Confirmation bias*: Preference for happy-path scenarios confirming code correctness (Weinberg, 2008).
|
|
253
|
-
- *Availability heuristic*: Over-testing past incident patterns; under-testing unmemorable failure modes.
|
|
254
|
-
- *Anchoring*: First proposed scenario constrains group's subsequent exploration.
|
|
255
|
-
- *Optimism bias*: Scenario suites complete for nominal behavior, sparse for degraded/error modes.
|
|
256
|
-
- *Framing effects*: "Verify max payload handling" vs. "verify attacker can't crash with oversized payload" -- same test, different discovery likelihood.
|
|
257
|
-
|
|
258
|
-
**Collaborative Discovery**:
|
|
259
|
-
- *Example Mapping* (Wynne, 2015): Rules (yellow), examples (green), questions (red) on index cards. Red card clusters identify poorly understood areas.
|
|
260
|
-
- *Event Storming* (Brandolini, 2013): Domain events on timeline. 15-50 participants. Extracts normal flow, branch conditions, and missing behavior scenarios.
|
|
261
|
-
- *Specification by Example* (Adzic, 2011): Collaborative discovery -> executable specifications -> regression tests. 40-70% reduction in requirement misunderstanding rate.
|
|
262
|
-
|
|
263
|
-
**Domain Expert vs. Developer Asymmetry**: Domain experts have tacit edge-case knowledge but lack technical expressiveness. Developers can implement but lack domain coverage intuition.
|
|
264
|
-
|
|
265
|
-
**Rapid Software Testing** (Bach & Bolton, 2014): Session-based exploratory testing with domain experts as live oracles.
|
|
266
|
-
|
|
267
|
-
#### 4.5.2 Literature Evidence
|
|
268
|
-
|
|
269
|
-
Shull et al. (2000): Perspective-Based Reading reduced defect escape rates by 35% vs. unstructured review.
|
|
270
|
-
|
|
271
|
-
Zannier et al. (2007): Structured workshops produced more complete, less redundant artifacts than unstructured brainstorming.
|
|
272
|
-
|
|
273
|
-
Endsley (1995): Situation Awareness theory explains why testers with low domain awareness miss safety-critical state transitions.
|
|
274
|
-
|
|
275
|
-
#### 4.5.3 Implementations and Benchmarks
|
|
276
|
-
|
|
277
|
-
- **Example Mapping**: No tooling required beyond index cards or Miro.
|
|
278
|
-
- **Event Storming**: Sticky notes or Miro with community templates.
|
|
279
|
-
- **Exploratory Testing**: TestRail, Zephyr for charter management.
|
|
280
|
-
- **Bias mitigation**: Perspective-Based Reading (persona assignment), Devil's Advocate sessions, Pre-mortem Analysis (Klein, 1993).
|
|
281
|
-
|
|
282
|
-
#### 4.5.4 Strengths and Limitations
|
|
283
|
-
|
|
284
|
-
**Strengths**: Access to tacit knowledge. Cross-functional scenario discovery.
|
|
285
|
-
|
|
286
|
-
**Limitations**: Workshop fatigue (2-4 hours effective). Scaling beyond small teams. Tacit-to-explicit translation depends on scribe quality. No automated scenario extraction from workshops.
|
|
287
|
-
|
|
288
|
-
---
|
|
289
|
-
|
|
290
|
-
## 5. Comparative Synthesis
|
|
291
|
-
|
|
292
|
-
| Dimension | Safety-Critical | Distributed Systems | Security | Real-Time/Performance | Human Factors |
|
|
293
|
-
|---|---|---|---|---|---|
|
|
294
|
-
| **Regulatory overhead** | Extreme | Minimal | Moderate | Low | None |
|
|
295
|
-
| **Failure cost** | Catastrophic | High | Variable | Moderate-High | Indirect |
|
|
296
|
-
| **Generation method** | Requirements + STPA | Contracts + topology | Threat modeling + ATT&CK | Workload characterization | Collaborative workshops |
|
|
297
|
-
| **Adequacy oracle** | MC/DC + traceability | Contract compliance | ATT&CK coverage | SLA thresholds | Team consensus |
|
|
298
|
-
| **Tool maturity** | Very high | High-Medium | High (exploitation) | High | Low |
|
|
299
|
-
| **Human bottleneck** | Safety analysts + DER | Platform architects | Red teamers | Performance engineers | Facilitators + domain experts |
|
|
300
|
-
| **Primary failure mode** | Completeness illusion | Contract drift | Adversary surprise | Production mismatch | Facilitation quality |
|
|
301
|
-
|
|
302
|
-
**Cross-domain observations**:
|
|
303
|
-
|
|
304
|
-
*The adequacy oracle determines technique selection.* Safety-critical uses a dual oracle (requirements + structural coverage). Security uses transparent-about-incompleteness metrics (ATT&CK coverage). Performance uses threshold metrics (SLA). Human factors lacks a compelling objective oracle.
|
|
305
|
-
|
|
306
|
-
*Human bottlenecks persist across all domains.* Tool automation reduces per-scenario execution cost but has not automated generating the *right* scenarios in any domain.
|
|
307
|
-
|
|
308
|
-
*Scenario reuse remains unsolved.* ATT&CK and OWASP provide domain-agnostic scenario libraries; safety-critical and performance scenarios remain system-specific.
|
|
309
|
-
|
|
310
|
-
---
|
|
311
|
-
|
|
312
|
-
## 6. Open Problems and Gaps
|
|
313
|
-
|
|
314
|
-
### 6.1 Cross-Domain Scenario Reuse
|
|
315
|
-
|
|
316
|
-
Automotive ADAS scenario libraries have potential applicability to drone navigation and robotic surgery. Standards frameworks are incompatible (DAL vs. ASIL vs. IEC 62304 classes). OpenSCENARIO (ASAM, 2020) is a first step for automotive; adoption in other domains is nascent.
|
|
317
|
-
|
|
318
|
-
### 6.2 Automated Compliance Evidence Generation
|
|
319
|
-
|
|
320
|
-
LLMs could automate requirements parsing, scenario suggestion, and traceability link generation, but no system produces evidence directly acceptable to regulators without human review.
|
|
321
|
-
|
|
322
|
-
### 6.3 Security Scenario Completeness Metrics
|
|
323
|
-
|
|
324
|
-
No widely accepted completeness metric exists. Research directions: attack graph completeness from formal threat models, adversarial ML for scenario generation from vulnerability databases, red team vs. scanner coverage correlation studies.
|
|
325
|
-
|
|
326
|
-
### 6.4 Performance Scenario Drift
|
|
327
|
-
|
|
328
|
-
Load profiles calibrated at launch become progressively less representative. Continuous comparison of production traffic against test profiles remains an engineering gap.
|
|
329
|
-
|
|
330
|
-
### 6.5 Debiasing Scenario Authoring at Scale
|
|
331
|
-
|
|
332
|
-
Perspective-Based Reading works for small groups but doesn't scale to 500-developer organizations. Automated bias detection tools (analyzing scenario suite patterns like "95% happy-path outcomes") could provide scalable signals but require labeled training data.
|
|
333
|
-
|
|
334
|
-
### 6.6 AI-Assisted Domain-Specific Scenario Generation
|
|
335
|
-
|
|
336
|
-
Open problems: LLM-generated MC/DC-adequate scenarios for safety-critical software, threat-model-grounded security scenarios beyond ATT&CK enumeration, performance scenarios from architecture descriptions calibrated against realistic load distributions.
|
|
337
|
-
|
|
338
|
-
---
|
|
339
|
-
|
|
340
|
-
## 7. Conclusion
|
|
341
|
-
|
|
342
|
-
The scenario primitive is preserved across all five domains, but the generation oracle, adequacy oracle, and evaluation oracle are domain-specific constructs that must be deliberately engineered.
|
|
343
|
-
|
|
344
|
-
Safety-critical testing is the most rigorously defined, at a cost justified only by failure consequences. Distributed systems fragment testing across service boundaries, with contract testing providing elegant but drift-prone decomposition. Security testing is structurally incomplete by necessity -- the adversary's scenario space is unbounded. Performance testing connects most directly to business outcomes but depends on production representativeness that decays over time. Human factors represent the least formalized domain, yet are the root cause of quality failures in all others.
|
|
345
|
-
|
|
346
|
-
Scenario testing quality is bounded not primarily by algorithmic or tooling limitations but by the quality of domain knowledge that informs generation and the adequacy oracles that judge completeness. Investing in domain knowledge -- through standards alignment, threat modeling, workload characterization, and collaborative discovery -- produces greater quality improvements than investing in execution tooling alone.
|
|
347
|
-
|
|
348
|
-
---
|
|
349
|
-
|
|
350
|
-
## References
|
|
351
|
-
|
|
352
|
-
Adzic, G. (2011). *Specification by Example*. Manning Publications.
|
|
353
|
-
Anderson, R. (2008, 3rd ed. 2020). *Security Engineering*. Wiley.
|
|
354
|
-
ASAM. (2020). *OpenSCENARIO 1.0*. Association for Standardization of Automation and Measuring Systems.
|
|
355
|
-
Bach, J., & Bolton, M. (2014). *Rapid Software Testing*. Satisfice, Inc.
|
|
356
|
-
Bass, L., Clements, P., & Kazman, R. (2021). *Software Architecture in Practice* (4th ed.). Addison-Wesley.
|
|
357
|
-
Bau, J., et al. (2010). State of the art: Automated black-box web application vulnerability testing. *IEEE S&P*, 332-345.
|
|
358
|
-
Bohme, M., et al. (2017). Coverage-based greybox fuzzing as Markov chain. *IEEE TSE*, 45(5), 489-506.
|
|
359
|
-
Brandolini, A. (2013, expanded 2021). *Introducing Event Storming*. Leanpub.
|
|
360
|
-
Carroll, J. M. (2000). *Making Use: Scenario-Based Design*. MIT Press.
|
|
361
|
-
Chilenski, J. J., & Miller, S. P. (1994). Applicability of MC/DC to software testing. *Software Engineering Journal*, 9(5), 193-200.
|
|
362
|
-
Clemson, B. (2014). *Pact: Consumer-driven contract testing*. Pact Foundation.
|
|
363
|
-
Czarnecki, K., & Eisenecker, U. W. (2000). *Generative Programming*. Addison-Wesley.
|
|
364
|
-
Endsley, M. R. (1995). Toward a theory of situation awareness. *Human Factors*, 37(1), 32-64.
|
|
365
|
-
Fioraldi, A., et al. (2020). AFL++. *WOOT '20*.
|
|
366
|
-
Hatton, L. (1997). The T experiments. *IEEE CSE*, 4(2), 27-38.
|
|
367
|
-
Heimdahl, M. P. E., & Leveson, N. G. (1996). Completeness and consistency in hierarchical state-based requirements. *IEEE TSE*, 22(6), 363-377.
|
|
368
|
-
IEC. (2006, amended 2015). *IEC 62304: Medical Device Software*.
|
|
369
|
-
IEC. (2010). *IEC 61508: Functional Safety*.
|
|
370
|
-
Iosup, A., et al. (2011). On the performance variability of production cloud services. *CCGrid*, 104-113.
|
|
371
|
-
ISO. (2018). *ISO 26262: Road Vehicles -- Functional Safety* (2nd ed.).
|
|
372
|
-
Jain, R. (1991). *The Art of Computer Systems Performance Analysis*. Wiley.
|
|
373
|
-
Kahneman, D. (2011). *Thinking, Fast and Slow*. Farrar, Straus and Giroux.
|
|
374
|
-
Kang, K. C., et al. (1990). *Feature-Oriented Domain Analysis (FODA)*. CMU/SEI-90-TR-21.
|
|
375
|
-
Kanstren, T. (2012). Testing approaches in industrial safety-critical software. *ENASE*, 159-168.
|
|
376
|
-
Klein, G. A. (1993). Recognition-primed decision model. In *Decision Making in Action* (pp. 138-147). Ablex.
|
|
377
|
-
Klees, G., et al. (2018). Evaluating fuzz testing. *CCS '18*, 2123-2138.
|
|
378
|
-
Leveson, N. G. (2011). *Engineering a Safer World*. MIT Press.
|
|
379
|
-
Liu, C. L., & Layland, J. W. (1973). Scheduling algorithms for multiprogramming. *JACM*, 20(1), 46-61.
|
|
380
|
-
Mauw, S., & Oostdijk, M. (2005). Foundations of attack trees. *ICISC 2005* (LNCS 3935), 186-198.
|
|
381
|
-
McGraw, G. (2006). *Software Security: Building Security In*. Addison-Wesley.
|
|
382
|
-
Molyneaux, I. (2014). *The Art of Application Performance Testing* (2nd ed.). O'Reilly.
|
|
383
|
-
Newman, S. (2015, 2nd ed. 2019). *Building Microservices*. O'Reilly.
|
|
384
|
-
Norman, D. A. (1988, revised 2013). *The Design of Everyday Things*. Basic Books.
|
|
385
|
-
OWASP Foundation. (2020). *OWASP Testing Guide* (v4.2).
|
|
386
|
-
Reason, J. (1990). *Human Error*. Cambridge University Press.
|
|
387
|
-
Richardson, C. (2018). *Microservices Patterns*. Manning.
|
|
388
|
-
Rierson, L. (2013). *Developing Safety-Critical Software*. CRC Press.
|
|
389
|
-
RTCA. (2011). *DO-178C: Software Considerations in Airborne Systems and Equipment Certification*.
|
|
390
|
-
Schneier, B. (1999). Attack trees. *Dr. Dobb's Journal*, 24(12), 21-29.
|
|
391
|
-
Shostack, A. (2014). *Threat Modeling: Designing for Security*. Wiley.
|
|
392
|
-
Shull, F., et al. (2000). How perspective-based reading can improve requirements inspections. *IEEE Computer*, 33(7), 73-79.
|
|
393
|
-
Sindre, G., & Opdahl, A. L. (2005). Eliciting security requirements with misuse cases. *RE*, 10(1), 34-44.
|
|
394
|
-
Strom, B. E., et al. (2018). *MITRE ATT&CK: Design and Philosophy*. MTR180035.
|
|
395
|
-
Tene, G. (2015). *How NOT to Measure Latency*. QCon presentation.
|
|
396
|
-
UcedaVelez, T., & Morana, M. (2015). *Risk Centric Threat Modeling*. Wiley.
|
|
397
|
-
Weinberg, G. M. (2008). *Perfect Software and Other Illusions About Testing*. Dorset House.
|
|
398
|
-
Wilhelm, R., et al. (2008). The WCET problem -- overview and survey. *ACM TECS*, 7(3), 36.
|
|
399
|
-
Wynne, M. (2015). *Example Mapping*. Cucumber Limited.
|
|
400
|
-
Wynne, M., & Hellesoy, A. (2012). *The Cucumber Book*. Pragmatic Bookshelf.
|
|
401
|
-
Zampetti, F., et al. (2020). Interplay between pull request review and CI builds. *SANER 2020*, 11-21.
|
|
402
|
-
Zannier, C., et al. (2007). On the success of agile practices. *Agile 2007*, 209-213.
|
|
403
|
-
|
|
404
|
-
---
|
|
405
|
-
|
|
406
|
-
## Practitioner Resources
|
|
407
|
-
|
|
408
|
-
### Safety-Critical and Embedded Systems
|
|
409
|
-
|
|
410
|
-
**Tools**
|
|
411
|
-
- **LDRA** (ldra.com): Requirements traceability + MC/DC. DO-178C/ISO 26262 certified.
|
|
412
|
-
- **VectorCAST** (vector.com): C/C++/Ada testing. DO-330 qualified.
|
|
413
|
-
- **Parasoft C/C++test** (parasoft.com): Policy enforcement + continuous coverage.
|
|
414
|
-
- **Simulink Test** (mathworks.com): Model-level scenario specification (DO-331).
|
|
415
|
-
- **dSPACE SCALEXIO/VEOS** (dspace.com): HIL/SIL platforms.
|
|
416
|
-
- **AbsInt aiT** (absint.com): WCET analysis, DO-178C qualified.
|
|
417
|
-
|
|
418
|
-
**Key Texts**
|
|
419
|
-
- Rierson (2013). *Developing Safety-Critical Software*. CRC Press.
|
|
420
|
-
- Leveson (2011). *Engineering a Safer World*. MIT Press (free PDF).
|
|
421
|
-
|
|
422
|
-
### Distributed Systems
|
|
423
|
-
|
|
424
|
-
**Tools**
|
|
425
|
-
- **Pact** (pact.io): Consumer-driven contracts. Multi-language + PactFlow broker.
|
|
426
|
-
- **Spring Cloud Contract** (spring.io): Provider-driven, Spring-native.
|
|
427
|
-
- **WireMock** (wiremock.org): HTTP service virtualization with stateful scenarios.
|
|
428
|
-
- **Hoverfly** (hoverfly.io): Transparent proxy + simulation.
|
|
429
|
-
- **Testcontainers** (testcontainers.com): Docker containers for integration scenarios.
|
|
430
|
-
- **ToxiProxy** (github.com/Shopify/toxiproxy): Network condition simulation.
|
|
431
|
-
|
|
432
|
-
**Key Texts**
|
|
433
|
-
- Newman (2019). *Building Microservices* (2nd ed.). O'Reilly.
|
|
434
|
-
- Richardson (2018). *Microservices Patterns*. Manning.
|
|
435
|
-
|
|
436
|
-
### Security
|
|
437
|
-
|
|
438
|
-
**Tools**
|
|
439
|
-
- **OWASP ZAP** (zaproxy.org): Open-source web security scanner.
|
|
440
|
-
- **Burp Suite** (portswigger.net): Industry-standard commercial.
|
|
441
|
-
- **AFL++** (github.com/AFLplusplus): Coverage-guided fuzzer.
|
|
442
|
-
- **libFuzzer** (llvm.org/docs/LibFuzzer.html): In-process fuzzing.
|
|
443
|
-
- **Metasploit** (metasploit.com): Exploit framework.
|
|
444
|
-
- **ATT&CK Navigator** (mitre-attack.github.io/attack-navigator): Coverage visualization.
|
|
445
|
-
|
|
446
|
-
**Key Texts**
|
|
447
|
-
- Shostack (2014). *Threat Modeling*. Wiley.
|
|
448
|
-
- Anderson (2020). *Security Engineering* (3rd ed.). Wiley (free chapter PDFs).
|
|
449
|
-
|
|
450
|
-
### Performance
|
|
451
|
-
|
|
452
|
-
**Tools**
|
|
453
|
-
- **Apache JMeter** (jmeter.apache.org): Mature, broad protocol support.
|
|
454
|
-
- **Gatling** (gatling.io): Scala DSL, high concurrency.
|
|
455
|
-
- **k6** (k6.io): JavaScript scenarios, CI/CD-native.
|
|
456
|
-
- **Locust** (locust.io): Python-based, distributed.
|
|
457
|
-
- **Hdr Histogram** (hdrhistogram.org): Coordinated omission correction.
|
|
458
|
-
|
|
459
|
-
**Key Texts**
|
|
460
|
-
- Jain (1991). *The Art of Computer Systems Performance Analysis*. Wiley.
|
|
461
|
-
- Molyneaux (2014). *The Art of Application Performance Testing*. O'Reilly.
|
|
462
|
-
|
|
463
|
-
### Human Factors
|
|
464
|
-
|
|
465
|
-
**Techniques**
|
|
466
|
-
- **Example Mapping**: No tooling required. cucumber.io/blog/bdd/example-mapping-introduction
|
|
467
|
-
- **Event Storming**: Miro templates available. eventstorming.com
|
|
468
|
-
- **Specification by Example**: Adzic (2011). specificationbyexample.com
|
|
469
|
-
|
|
470
|
-
**Key Texts**
|
|
471
|
-
- Carroll (2000). *Making Use*. MIT Press.
|
|
472
|
-
- Kahneman (2011). *Thinking, Fast and Slow*.
|
|
473
|
-
- Weinberg (2008). *Perfect Software*. Dorset House.
|
|
474
|
-
- Brandolini (2021). *Introducing Event Storming*. Leanpub.
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
# Authentication & Authorization Patterns
|
|
2
|
-
|
|
3
|
-
*February 23, 2026*
|
|
4
|
-
|
|
5
|
-
Reference for AI agents reviewing access control in web applications.
|
|
6
|
-
Derived from [secure-coding-failure.md](secure-coding-failure.md) section 4.7.
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## Authentication vs Authorization
|
|
11
|
-
|
|
12
|
-
- **Authentication**: Verifying *who* the caller is (identity). Handled by login flows, tokens, sessions.
|
|
13
|
-
- **Authorization**: Verifying *what* the caller can do (permissions). Handled by middleware, guards, ownership checks.
|
|
14
|
-
|
|
15
|
-
Most vulnerabilities occur in authorization -- the caller is authenticated but accesses
|
|
16
|
-
resources or operations they should not.
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## Common Broken Patterns
|
|
21
|
-
|
|
22
|
-
### Missing Auth Middleware
|
|
23
|
-
|
|
24
|
-
Route handlers that lack an auth guard present on sibling routes.
|
|
25
|
-
|
|
26
|
-
```typescript
|
|
27
|
-
// Express -- unprotected route among protected ones
|
|
28
|
-
router.get('/api/users', authMiddleware, listUsers);
|
|
29
|
-
router.get('/api/users/:id', authMiddleware, getUser);
|
|
30
|
-
router.delete('/api/users/:id', deleteUser); // BUG: missing authMiddleware
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
**Detection**: List all route registrations. Flag any route that omits auth middleware
|
|
34
|
-
when the majority of routes at the same path prefix include it.
|
|
35
|
-
|
|
36
|
-
### Insecure Direct Object Reference (IDOR)
|
|
37
|
-
|
|
38
|
-
User-supplied IDs used in queries without ownership verification.
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
// Unsafe -- any authenticated user can access any order
|
|
42
|
-
app.get('/api/orders/:id', authMiddleware, async (req, res) => {
|
|
43
|
-
const order = await db.get('SELECT * FROM orders WHERE id = ?', [req.params.id]);
|
|
44
|
-
res.json(order);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
// Safe -- ownership check included
|
|
48
|
-
app.get('/api/orders/:id', authMiddleware, async (req, res) => {
|
|
49
|
-
const order = await db.get(
|
|
50
|
-
'SELECT * FROM orders WHERE id = ? AND user_id = ?',
|
|
51
|
-
[req.params.id, req.user.id]
|
|
52
|
-
);
|
|
53
|
-
if (!order) return res.status(404).json({ error: 'Not found' });
|
|
54
|
-
res.json(order);
|
|
55
|
-
});
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
**Detection**: Find DB queries that use a URL/body parameter as the primary filter but
|
|
59
|
-
do not include the authenticated user's ID in the WHERE clause.
|
|
60
|
-
|
|
61
|
-
### Role Escalation
|
|
62
|
-
|
|
63
|
-
Admin endpoints accessible with regular user tokens.
|
|
64
|
-
|
|
65
|
-
```typescript
|
|
66
|
-
// Unsafe -- no role check
|
|
67
|
-
app.post('/api/admin/promote', authMiddleware, promoteUser);
|
|
68
|
-
|
|
69
|
-
// Safe -- role guard added
|
|
70
|
-
app.post('/api/admin/promote', authMiddleware, requireRole('admin'), promoteUser);
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
**Detection**: Flag routes under `/admin` or similar prefixes that lack role-checking
|
|
74
|
-
middleware beyond basic auth.
|
|
75
|
-
|
|
76
|
-
### JWT Pitfalls
|
|
77
|
-
|
|
78
|
-
| Pitfall | Description |
|
|
79
|
-
|---------|-------------|
|
|
80
|
-
| No signature verification | Accepting tokens without calling `jwt.verify()` |
|
|
81
|
-
| Algorithm confusion | Accepting `alg: "none"` or switching from RS256 to HS256 |
|
|
82
|
-
| No expiry check | Missing `exp` claim validation, tokens valid forever |
|
|
83
|
-
| Secret in source code | JWT signing secret hardcoded (see [secrets-checklist.md](secrets-checklist.md)) |
|
|
84
|
-
|
|
85
|
-
### CORS Misconfiguration
|
|
86
|
-
|
|
87
|
-
```typescript
|
|
88
|
-
// Unsafe -- wildcard origin with credentials
|
|
89
|
-
app.use(cors({ origin: '*', credentials: true }));
|
|
90
|
-
|
|
91
|
-
// Unsafe -- reflecting request origin without validation
|
|
92
|
-
app.use(cors({ origin: req.headers.origin, credentials: true }));
|
|
93
|
-
|
|
94
|
-
// Safe -- explicit allowlist
|
|
95
|
-
app.use(cors({ origin: ['https://app.example.com'], credentials: true }));
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
## Framework-Specific Patterns
|
|
101
|
-
|
|
102
|
-
### Express / NestJS (JS/TS)
|
|
103
|
-
|
|
104
|
-
| Check | What to look for |
|
|
105
|
-
|-------|-----------------|
|
|
106
|
-
| Missing global guard | Routes outside `app.use(authMiddleware)` scope |
|
|
107
|
-
| NestJS missing `@UseGuards` | Controller methods without `@UseGuards(AuthGuard)` |
|
|
108
|
-
| Route ordering | Unprotected catch-all route registered before auth middleware |
|
|
109
|
-
|
|
110
|
-
### Django / FastAPI (Python)
|
|
111
|
-
|
|
112
|
-
| Check | What to look for |
|
|
113
|
-
|-------|-----------------|
|
|
114
|
-
| Missing `@login_required` | Django view functions without the decorator |
|
|
115
|
-
| Missing `Depends(get_current_user)` | FastAPI endpoints without auth dependency |
|
|
116
|
-
| Missing permission classes | DRF views with `permission_classes = []` or `AllowAny` on sensitive endpoints |
|
|
117
|
-
| Django `@csrf_exempt` | State-changing views exempted from CSRF without justification |
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## Detection Approach
|
|
122
|
-
|
|
123
|
-
### Route Audit
|
|
124
|
-
|
|
125
|
-
1. Extract all registered routes (paths + HTTP methods).
|
|
126
|
-
2. For each route, check if auth middleware/decorator/guard is applied.
|
|
127
|
-
3. Flag routes that modify data (POST/PUT/PATCH/DELETE) without auth.
|
|
128
|
-
4. Flag routes that return user-specific data without auth.
|
|
129
|
-
|
|
130
|
-
### Ownership Check Audit
|
|
131
|
-
|
|
132
|
-
1. Find all DB queries that accept a user-supplied ID parameter.
|
|
133
|
-
2. Check if the query also filters by the authenticated user's ID.
|
|
134
|
-
3. If no ownership filter exists and the resource is user-scoped, flag as IDOR (P1).
|
|
135
|
-
|
|
136
|
-
## Source
|
|
137
|
-
|
|
138
|
-
Derived from [secure-coding-failure.md](secure-coding-failure.md) section 4.7.
|