How do you add API security testing to a pipeline for a REST service with an OpenAPI spec?
IntermediateScenarioPipeline Security Scanning
Answer
Situation read → The spec lets a scanner know every endpoint, so crawling is not needed.
What I'd do →
- Lint the spec for security issues (
spectralwith an OWASP ruleset). - Deploy to an ephemeral environment.
- Run
zap-api-scan.py -t https://api.stg.example.com/openapi.json -f openapi -r api.htmlwith an auth header. - Add contract-based fuzzing (
schemathesis run) for unexpected inputs. - Test authorization separately: two users, check one cannot read the other's object (BOLA).
Why → Generic scanners are weak at authorization bugs, so you need explicit tests for them.
Interview tip → Say BOLA is the top API risk in the OWASP API Top 10.
More on Pipeline Security Scanning
You are asked to add security to an existing CI pipeline. Where do SAST, SCA, secrets scanning and DAST each go?BeginnerGitleaks flags an AWS access key in a pull request. The developer says it is a test key. What do you do?BeginnerDevelopers fear security scans will slow the pipeline from 6 to 20 minutes. How do you roll them out?BeginnerA SAST tool reports 2,000 findings on a legacy repo the first time you run it. How do you introduce it without freezing delivery?IntermediateA developer insists a scanner finding is a false positive. What is your process?BeginnerSCA flags a critical CVE in a transitive dependency and no patched version exists. What are your options?Intermediate