Teams should build security testing into development and CI/CD, not treat it as a release-time checkpoint. For serverless APIs, combine DAST to exercise the running service, SAST to catch insecure coding patterns, and SCA to flag vulnerable dependencies. This approach increases test coverage, reduces remediation cost, and helps catch regressions before production traffic exposes them.
Shift security left for serverless APIs, not right before launch
Serverless APIs fail in production for the same reasons other services do, but the deployment model makes weak assumptions harder to spot after release. Security testing should begin while features are still changing, with DAST validating the running endpoint, SAST catching insecure code paths, and SCA finding vulnerable packages before traffic reaches them. For API-specific failure modes, anchor the review to the OWASP API Security Top 10 and use the OWASP Web Security Testing Guide to keep testing structured.
The practical value is that you are testing the feature in the same state attackers will see it, including auth flows, parameter handling, function chaining, and error behaviour. That matters for serverless APIs because release-time review often misses regressions introduced by a small change in routing, permissions, or dependency versions.
If your delivery pipeline already produces disposable preview environments, use them to run the security checks automatically on every meaningful change. If it does not, the testing gap will usually appear between code review and production, which is exactly where insecure API behaviour tends to escape.
What to test in the pipeline before production exposure
DAST is the best fit for confirming that the deployed API behaves safely under realistic requests, but it should not be the only control. SAST is needed to catch insecure patterns early in the source, especially around input handling, authorization logic, and dangerous defaults. SCA is equally important because vulnerable libraries often become the fastest path from a new feature to an exposed weakness.
For teams shipping fast, the key decision is coverage versus latency. Lightweight checks can run on every commit, while deeper scans can run on merge or release candidate builds. That layered approach is more reliable than a single gate at the end, because each method sees a different class of defect.
- Use DAST to validate the running API with expected and unexpected requests.
- Use SAST to catch insecure code before deployment artifacts are built.
- Use SCA to block known vulnerable dependencies and stale transitive packages.
- Fail the build when a new feature introduces a high-risk finding that would be visible to unauthenticated or low-trust callers.
Teams that want their controls to remain consistent across many builds should also align the test cases with a repeatable security baseline. That is where prescriptive control guidance such as OWASP SAMM helps by turning security checks into a normal part of delivery maturity rather than a one-off review.
Risk and Threat Considerations
New serverless API features are especially exposed when testing is deferred until after deployment, because small defects can become immediately reachable through public endpoints, event triggers, or integrations. The main risk is not only code weakness, but also the speed with which a bad release can be discovered and exercised once production traffic begins.
Failure mechanism: Insecure request handling, broken authorization, vulnerable dependencies, or unexpected runtime behaviour slips through because the code was not exercised as a live service before release. In serverless environments, that can also be amplified by misconfigured function permissions or overly broad dependencies.
Impact: Attackers or accidental traffic can hit the weakness immediately, turning a late-stage defect into direct exposure, service abuse, data access, or a production rollback. The cost of fixing it rises sharply once customers, logs, and downstream systems are already involved.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10 address the attack and risk surface, while CIS Controls v8 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| CIS Controls v8 | CIS 4 — Secure Configuration of Enterprise Assets and Software | Serverless API safety depends on secure build and deployment configuration. |
| CIS 16 — Application Software Security | SAST, DAST and SCA are core application security practices for new APIs. | |
| Recommendation — Harden deployment settings and enforce secure defaults before exposing new API features. Integrate code, dependency, and dynamic testing into the software delivery pipeline. | ||
| OWASP Agentic AI Top 10 | A1 — Prompt Injection and Tool Manipulation | Serverless APIs commonly expose tool-like execution paths that need abuse-resistant testing. |
| A4 — Overprivileged and Unauthorized Actions | New API features often fail through excessive runtime permissions or access scope. | |
| Recommendation — Test callable API actions for input abuse and unsafe downstream tool invocation. Verify that new functions and endpoints execute with least privilege. | ||
| NIST CSF 2.0 | PR.IP-1 — Configuration Management | Pipeline-based security testing is a configuration control for software release. |
| PR.DS-6 — Data is Protected in Transit | API testing should validate exposed request and response paths that carry sensitive data. | |
| Recommendation — Build security testing into release automation and change control. Validate that new endpoints protect data flows before production exposure. | ||
Practitioner Guidance
What to prioritise: Put the highest-weight tests on changes that affect authentication, authorization, input handling, dependency updates, and any function that can reach sensitive data or downstream systems. Those are the failures most likely to become externally visible the moment the feature is released.
What to verify: Confirm that security checks run against the deployed preview or build artifact, not just the source tree. A code-only pipeline can miss runtime issues that only appear when the API is actually invoked.
Practitioner takeaway: For serverless APIs, the goal is to make security testing part of the feature lifecycle, so a release only happens after the new endpoint has already survived the same traffic patterns, dependency checks, and code review pressure it will face in production.
Related resources from NHI Mgmt Group
- How should security teams secure open-source software before it reaches production?
- How should security teams govern APIs that appear before production monitoring is in place?
- How should teams evaluate LLM features before using them in production workflows?
- How should teams secure AI-generated applications before they reach production?