Security for Legal SaaS

Episode 56 · Module 11 · Monitoring & Incident Response

Security Testing in Your Development Process

19 May 2026 · 8:50 · Security for Legal SaaS

8:50 8:50

If your security testing happens once a year in a penetration test, you're finding bugs 364 days too late. Every vulnerability that exists in production between pen tests is a vulnerability an attacker can exploit. The modern approach — and the only one that scales — is continuous security testing embedded in your development process, from the moment code is written to the moment it runs in production.

Today’s Lesson

Security for Legal SaaS — Episode 56: Security Testing in Your Development Process

Finding Bugs 364 Days Before the Pen Test

If your security testing happens once a year in a penetration test, you're finding bugs 364 days too late. Every vulnerability that exists in production between pen tests is a vulnerability an attacker can exploit. The modern approach — and the only one that scales — is continuous security testing embedded in your development process, from the moment code is written to the moment it runs in production.

OWASP's guidance on integrating security into the SDLC (Software Development Lifecycle) is unambiguous: security testing must happen at every phase — requirements, design, implementation, verification, and deployment — not as a gate at the end.1 The shift-left movement (moving security activities earlier in the development process) has been the dominant trend in application security since 2020, and for good reason: fixing a vulnerability in development costs a fraction of fixing it after deployment.2

For legal SaaS teams — where a vulnerability might expose attorney-client privileged communications or allow manipulation of case records — the cost of a late-discovered bug extends beyond engineering time into professional liability, regulatory penalties, and client trust.

The Security Testing Pyramid

Borrow from the testing pyramid concept: lots of automated checks at the base, fewer manual reviews in the middle, rare comprehensive assessments at the top.

         /\
        /  \        Annual penetration tests
       /    \       (1-2 per year)
      /------\
     /        \     Manual code reviews for
    /          \    security-critical changes
   /------------\
  /              \  Automated testing in CI/CD:
 /                \ SAST, DAST, SCA, secrets scanning
/------------------\
Layer Frequency Scope Finds
SAST in CI Every pull request Source code patterns SQL injection, XSS, insecure crypto, hardcoded secrets
SCA in CI Every pull request Third-party dependencies Known CVEs in libraries you use
Secrets scanning Every commit (pre-commit hook) Repository content API keys, passwords, tokens accidentally committed
DAST in staging Every deployment to staging Running application Authentication flaws, injection in HTTP responses, header misconfigurations
Manual code review Security-critical changes Authentication, authorisation, encryption code Logic flaws, business logic bypasses
Penetration test 1-2 times per year Full application + infrastructure Complex attack chains, multi-step exploits

Shift Left: SAST in the IDE

SAST (Static Application Security Testing) analyses source code without executing it, looking for patterns that indicate vulnerabilities. Modern SAST tools integrate directly into developers' editors, flagging issues as code is written — before it even reaches a pull request.3

Tools like Semgrep (open-source, rule-based pattern matching), CodeQL (GitHub's code analysis engine, which we mentioned in Episode 8), and SonarQube scan for:

For legal SaaS: Configure SAST rules specifically for your risk profile. Add custom rules for: access control checks on every endpoint that serves client data (IDOR prevention — Episode 6), tenant isolation in multi-tenant queries (row-level security — Episode 8), and audit logging on every data access operation.

DAST in Staging

DAST (Dynamic Application Security Testing) tests your running application from the outside — like an automated attacker. It sends crafted requests to your application and analyses the responses for vulnerabilities that only manifest at runtime.4

Where SAST finds "this code builds a SQL query unsafely," DAST finds "this endpoint actually returns data it shouldn't when I manipulate the request." DAST catches:

Run DAST against your staging environment (a copy of your application that mirrors production but uses test data) on every deployment. Tools like OWASP ZAP (open-source), Burp Suite (commercial), and SecureLayer7 provide DAST capabilities ranging from free to enterprise-grade.5

Why Both SAST and DAST?

They find different things. SAST examines your code and finds potential vulnerabilities. DAST examines your running application and finds actual exploitable issues. Some vulnerabilities (business logic flaws, complex authentication bypasses) are invisible to SAST. Some (dead code paths, internal utility functions) are invisible to DAST. Using both provides complementary coverage.6

Dependency Scanning: Your Supply Chain Check

Every third-party library in your application is code you didn't write, didn't review, and might contain known vulnerabilities. SCA (Software Composition Analysis) tools continuously scan your dependencies against vulnerability databases.

As we discussed in Episode 51, AI-generated code exacerbates this risk by suggesting vulnerable package versions. Automated dependency scanning catches these before deployment:

Configure your CI pipeline to fail the build when a dependency has a known critical or high-severity CVE (Common Vulnerabilities and Exposures — the standardised identifier for publicly known security vulnerabilities, as covered in Episode 8). A red build for a vulnerable dependency forces the issue to be addressed before deployment.

Penetration Testing: The Expert Assessment

Automated tools have blind spots. Penetration testing — where skilled security professionals manually attempt to exploit your application — finds vulnerabilities that automated tools miss: business logic flaws, complex multi-step attack chains, social engineering vulnerabilities, and novel attack patterns.

Scoping a Pen Test for Legal SaaS

Define the scope before engagement:

In Scope Typically Out of Scope
Application authentication and authorisation Third-party IdP infrastructure (Okta, Azure AD)
API endpoints and data access controls Client-owned networks
Tenant isolation (can Firm A access Firm B's data?) Physical security
File upload and document processing Social engineering of end users
Session management and token handling Denial of service attacks against production
Infrastructure (cloud configuration, network) Testing outside agreed hours

Frequency

For most legal SaaS platforms: annually at minimum, plus after any major architectural change (new authentication system, new data storage layer, new API surface). If you handle highly sensitive data (active litigation strategy, government legal work), semi-annual pen tests are appropriate.

What to Do with the Findings

A penetration test report is not a trophy — it's a to-do list. Prioritise findings by severity and exploitability. Critical and high findings should be remediated before the next deployment. Medium findings within 30 days. Track every finding to resolution. Re-test to verify fixes.

Bug Bounty Programmes

Bug bounties — public or private programmes where external security researchers are rewarded for finding and reporting vulnerabilities — extend your testing surface beyond your team and your pen tester.

When to start: Not on day one. Start a bug bounty after you have: (1) automated security testing in CI, (2) at least one pen test completed, and (3) a process for triaging and fixing reported issues. A bug bounty before these basics are in place generates a flood of reports you can't handle.

Platform options: HackerOne and Bugcrowd provide managed platforms with triage support, legal safe harbour for researchers, and structured reward tiers.

Legal SaaS consideration: Your bounty scope must explicitly exclude access to real client data. Use a dedicated testing environment with synthetic data. Make this clear in the programme policy.

Automated Security Regression Tests

The most frustrating vulnerability is one you already fixed that comes back. Regression testing — automated tests that verify previously fixed vulnerabilities remain fixed — prevents this.

For every security bug found (whether by SAST, DAST, pen test, or bug bounty):

  1. Write an automated test that reproduces the vulnerability
  2. Verify the test fails before the fix and passes after
  3. Add the test to your CI suite permanently
  4. The test runs on every pull request, forever

Over time, this builds a growing library of security-specific regression tests — a permanent immune system for your application.

Example for legal SaaS: A pen test discovers that /api/cases/:id/documents doesn't verify the requesting user belongs to the case's firm (an IDOR vulnerability). You fix it by adding a tenant check. The regression test: authenticate as User A from Firm A, request a document belonging to Firm B's case, assert 403 Forbidden. This test runs on every PR. If anyone refactors the access control code and accidentally removes the tenant check, the test catches it.

The Security Testing Minimum

Control When What It Catches
Pre-commit secret scanning Every commit Accidental credential exposure
SAST in CI Every pull request Code-level vulnerabilities
SCA / dependency scanning in CI Every pull request Known vulnerabilities in libraries
DAST in staging Every deployment Runtime vulnerabilities and misconfigurations
Manual review of security-critical code As needed Logic flaws, business rule bypasses
Annual penetration test Yearly + major changes Complex, multi-step vulnerabilities
Security regression tests Every pull request Previously fixed bugs don't return

Security testing is not a phase. It's a layer that runs continuously, at every stage of development, catching different classes of vulnerabilities at the earliest possible moment. The pen test finds what the automation missed. The automation prevents the pen test from finding the same things twice.

Next episode: access reviews and least privilege audits — how to ensure that the contractor who left six months ago doesn't still have an active API key.

Sources & references

  1. OWASP, OWASP in SDLC — Integration Standards.
  2. Cymulate, Shift Left Security for DevOps & AppSec Teams.
  3. TechSpective, Is SAST Still Relevant in 2026? Rethinking Static Code Analysis.
  4. Checkmarx, What Is Dynamic Application Security Testing (DAST)? 2026 Guide.
  5. SecureLayer7, Top DAST Tools in 2026: Features, Pros & Cons.
  6. Deepstrike, SAST vs DAST vs IAST vs RASP Explained (2025).
  7. OWASP, Dependency-Check: Software Composition Analysis.
  8. OX Security, SAST and DAST Tools: Still Essential Security Testing Tools in 2025.
  9. Cybersecurity Dive, The Future of DAST in an AI-First World.
  10. Netalith, Automated DevSecOps Testing Workflows: Integrating Security into CI/CD Pipelines.
  11. Deepstrike, Software Testing & Security Testing 2025.