Sophie Laurent, YuSMP Group
Sophie Laurent Legal & Compliance Lead, YuSMP Group · GDPR, HIPAA, EU AI Act and application security policy for US & EU SaaS teams

Security in 2026 is something you practise continuously, not something you certify once a year. Turn on MFA and keep access tokens short-lived. Enforce least privilege on every API endpoint — not just at login. Validate every input, guard your secrets and dependencies, and serve a strict Content Security Policy. Test with SAST and DAST in CI so problems surface before they ship. Apply Zero Trust: verify every request, even from inside your own network. Rate-limit abuse, log enough to investigate an incident, and encrypt data both in transit and at rest.

What are the most important web app security best practices in 2026?

The practices that matter most fall into nine control areas — each covered in depth below. Getting all nine right closes the majority of exploitable vulnerabilities in the OWASP Top 10, plus the supply-chain and AI-assisted vectors that define the 2026 threat landscape:

  • Authentication & session management — MFA by default, short-lived signed tokens, hardened session cookies.
  • Access control & least privilege — deny-by-default authorization enforced server-side on every request.
  • Input validation & injection prevention — parameterised queries, output encoding, allow-list validation, prompt injection guards.
  • API security — BOLA/IDOR prevention, endpoint-level auth, versioning, API gateway controls.
  • Secrets & supply-chain security — vaulted secrets, pinned dependencies, signed builds and SBOMs.
  • Security headers & Content Security Policy — a strict, nonce-based CSP plus HSTS and framing controls.
  • Rate limiting & abuse prevention — throttle authentication, APIs and expensive endpoints.
  • Security testing in the development lifecycle — SAST, DAST and SCA integrated into every CI/CD run.
  • Zero Trust and secure configuration — verify every request, harden infrastructure, deploy WAF controls.
  • Logging, monitoring & incident response — tamper-evident logs and a rehearsed response plan.
  • Encryption in transit and at rest — TLS 1.3 everywhere and encrypted, key-managed storage.

Why 2026 raises the bar for web app security

The threat landscape has moved on since 2023, in three ways that matter. Attackers now reach for the same AI tooling defenders use — automated fuzzing, prompt-injection testing, LLM-assisted code analysis — so the skill needed to find and exploit a flaw keeps dropping. At the same time, supply-chain attacks through compromised npm packages, GitHub Actions runners and third-party SDKs have become the most reliable way into an otherwise well-hardened codebase. And the regulatory stakes are higher than ever. GDPR enforcement has produced fines exceeding €1.2 billion across EU member states, and the EU's Network and Information Security Directive (NIS2), binding since October 2024, extends mandatory security obligations to B2B SaaS providers that serve critical-sector clients.

Everything here maps to the OWASP Top 10 (2021 edition) as its primary risk taxonomy, then extends it with the supply-chain and AI-specific vectors that modern stacks now face. Want an independent read against that taxonomy? Our penetration testing and security audit services turn every finding into a prioritised remediation plan. If you are still settling the technical foundation of the app, start with our guide to choosing a web app tech stack in 2026. And once security is handled, performance is the next thing to tackle — see our article on Core Web Vitals and web app performance in 2026.

Authentication and session management

Broken authentication still sits at number two in the OWASP Top 10. Get it wrong and the damage scales fast: at best a single hijacked user account, at worst an attacker holding admin rights over an entire SaaS tenant's data. Here is the control set we apply in 2026:

  • Multi-factor authentication (MFA) by default. MFA should be mandatory, not optional, for all user roles. TOTP (Google Authenticator, Authy) is the minimum; FIDO2 / WebAuthn passkeys are the 2026 target for any application handling sensitive data. SMS OTP is acceptable only as a fallback — it is susceptible to SIM-swap attacks and carrier-level compromise.
  • Password policy and breach checking. Minimum 12 characters, no complexity theatre (length beats special-character requirements for entropy). Check new passwords against the Have I Been Pwned k-anonymity API on registration and password change. Do not allow passwords that appear in your top-10,000 common-password list.
  • Secure token issuance. Use short-lived access tokens (15–60 minutes) and longer-lived, single-use refresh tokens stored server-side. JWTs must be signed with RS256 or ES256 (asymmetric), never HS256 with a shared secret at scale. Validate the iss, aud, exp and nbf claims on every request.
  • Cookie security attributes. Session cookies must carry HttpOnly, Secure and SameSite=Strict (or Lax where cross-site navigation is required). Never store access tokens in localStorage — XSS can trivially exfiltrate them.
  • Session invalidation. Invalidate server-side session records on logout, password change, MFA reset and account suspension. Rotate session IDs immediately after privilege elevation (e.g., a user switching to admin mode). Implement both idle timeout (15–30 minutes of inactivity) and absolute session timeout (8–24 hours regardless of activity).
  • Account enumeration prevention. Return identical error messages and response times for "user not found" and "wrong password" scenarios. Use constant-time comparison for credential checks to prevent timing side-channels.
  • Brute-force lockout and rate limiting. After five failed login attempts, trigger exponential backoff or CAPTCHA — not a hard account lock that enables denial-of-service. Log and alert on unusual login patterns (velocity, geographic anomaly, impossible travel).
Security lock icon representing web application authentication and access control mechanisms
Authentication is the front door of your application. A misconfigured login flow — missing MFA, weak session tokens, or insecure cookie attributes — makes every other security control irrelevant.

Access control and least privilege

Broken access control tops the OWASP Top 10 2021, showing up in 94% of the applications tested. Almost always it fails the same way: the interface hides an action, and the team assumes that hiding it is the same as blocking it. The server never checks, so the action stays wide open.

  • Server-side enforcement, always. Every API endpoint must independently verify that the authenticated identity has permission to perform the requested action on the requested resource. Never assume that because you did not render a "Delete" button in the UI, the DELETE endpoint is unreachable — it is not.
  • Role-based access control (RBAC) or attribute-based access control (ABAC). Define roles at design time, not at code time. Roles should be stored and evaluated server-side. For complex multi-tenant SaaS (see our multi-tenant SaaS architecture guide), ABAC policies that factor in tenant ID, data ownership and user role together are more robust than flat RBAC.
  • Insecure Direct Object References (IDOR) prevention. Never expose raw database IDs (auto-incrementing integers) in URLs or API responses. Use opaque identifiers (UUIDs v4 or ULIDs) and always validate that the requesting user owns or has explicit permission for the referenced object.
  • Principle of least privilege at the infrastructure level. Database users should have only the permissions they need (SELECT, INSERT, UPDATE — not DROP or ALTER). IAM roles for cloud services should be scoped to the minimum set of resources and actions. Audit IAM policies quarterly.
  • Privilege escalation protection. Any action that elevates privilege (granting admin access, resetting another user's MFA, accessing billing data) should require step-up authentication — prompt for password or MFA again, even for an already-authenticated session.
Access control checklist — server-side enforcement
ControlImplementation signalRisk if missing
Endpoint-level permission checkEvery handler has an explicit authorize() callHorizontal privilege escalation, IDOR
Opaque resource identifiersUUIDs or ULIDs in all public URLs/responsesEnumeration of other users' resources
Tenant isolation in multi-tenant appsEvery DB query filters by tenant_idCross-tenant data leakage
Least-privilege DB credentialsSeparate read/write roles per serviceBlast radius amplification on SQL injection
Step-up auth for privilege escalationRe-prompt for password/MFA before admin actionsSession hijack enables full admin takeover

Input validation and injection prevention

Every injection attack exploits the same mistake: the application stops telling code apart from data. That family is large. It covers SQL and NoSQL injection, OS command injection, LDAP injection, Server-Side Template Injection (SSTI), and now prompt injection in LLM-integrated apps. As more web apps wire in LLM pipelines, prompt injection has become the vector teams most often overlook, so it earns a place next to the classics below.

  • Parameterised queries everywhere. Use your ORM's query builder (Prisma, SQLAlchemy, Hibernate, ActiveRecord) for all database interactions. If you must write raw SQL for performance reasons, use parameterised placeholders — never string interpolation. Add a CI rule (Semgrep, ESLint security plugin) that flags raw string concatenation in query contexts.
  • Input validation at the boundary. Validate all inputs (request bodies, query parameters, headers, cookies, file uploads) against a strict schema at the API gateway or controller layer. Use allowlist validation (define what IS allowed) rather than blocklist (define what IS NOT allowed) — blocklists are bypassable through encoding tricks (URL encoding, Unicode normalisation, null bytes).
  • Output encoding. Encode all user-controlled data before inserting it into HTML (HTML entity encoding), JavaScript (JSON serialisation), CSS or URL contexts. Use your framework's built-in templating (React JSX, Jinja2 auto-escape, Angular DomSanitizer) rather than raw innerHTML or string concatenation.
  • File upload controls. Validate MIME type by file content (magic bytes), not the Content-Type header or filename extension. Store uploaded files outside the web root or in object storage (S3, GCS). Scan uploaded files with an antivirus API before making them accessible. Serve user-uploaded content from a separate origin or subdomain with no cookies and a restrictive CSP.
  • Prompt injection in LLM-integrated apps. If your application passes user input to an LLM (chatbot, document summariser, AI assistant), treat LLM responses as untrusted output before rendering them in the UI. Use structured output formats (JSON schema enforcement) rather than free-text parsing. Separate system prompts from user inputs using the model's API-level role distinction, not text concatenation.

API security best practices

APIs are now the primary attack surface of a modern web application. The OWASP API Security Top 10 (2023 edition) catalogues the most commonly exploited classes — and the pattern is the same every year: developers apply good security to their front-end login flow and then ship internal API endpoints with no authentication check at all. A one-line curl command exploits that mistake in seconds.

  • Authenticate every endpoint, every request. No endpoint is "internal only" from a network perspective once your frontend JavaScript calls it. Validate the bearer token or session cookie on every API handler — not just at the route group level where a misconfigured middleware passthrough can leave individual routes unprotected.
  • Prevent Broken Object-Level Authorization (BOLA/IDOR). BOLA is the number-one API vulnerability: the caller supplies a resource ID and the API returns the resource without checking whether the caller owns it. For every response that returns a resource record, verify that the authenticated identity has explicit rights to that specific object — not just to the endpoint in general. Swap auto-increment integer IDs for UUIDs or ULIDs to remove the enumeration shortcut.
  • Prevent Broken Function-Level Authorization (BFLA). Administrative functions — bulk exports, user management, billing operations — are often exposed at undocumented API paths with no UI surface. Attackers enumerate them with common wordlists. Apply RBAC checks at the handler level, not as a UI toggle; use separate rate-limited paths for admin operations.
  • Enforce strict schema validation on request bodies. Use a schema validator (Zod, Joi, Pydantic, JSON Schema) at the API gateway or controller layer. Reject requests that contain undeclared fields (strict mode). Unexpected fields are a canary for parameter pollution and mass assignment attacks — where an attacker adds {"role":"admin"} to a profile update body and it gets written to the database unchecked.
  • Version your APIs explicitly. Never silently deprecate an old endpoint version by removing authentication from it. A versioned API (/v1/, /v2/) with a documented sunset policy forces clients to migrate; an unversioned one leaves insecure old paths alive indefinitely.
  • Restrict CORS precisely. Set Access-Control-Allow-Origin to the exact list of trusted origins your frontend uses — never * for authenticated APIs. Wildcard CORS on an API that reads cookies gives any site on the internet the ability to make credentialed cross-origin requests on behalf of your logged-in users.
  • Use an API gateway for traffic inspection. An API gateway (Kong, AWS API Gateway, Apigee) centralises rate limiting, JWT validation, IP allowlisting, and request logging across all services. It also gives you a single place to enforce throttling before requests reach your application layer — important for costly LLM-backed API calls that are expensive to process even if they do not succeed.
OWASP API Security Top 10 — quick reference
RankCategoryPrimary mitigation
API1Broken Object Level Authorization (BOLA)Ownership check on every record, UUIDs over integers
API2Broken AuthenticationToken validation on every endpoint, short TTLs
API3Broken Object Property Level AuthorizationStrict schema validation, reject undeclared fields
API4Unrestricted Resource ConsumptionRate limits by user + IP on all endpoints
API5Broken Function Level Authorization (BFLA)RBAC at handler level, separate admin paths
API6Unrestricted Access to Sensitive Business FlowsBot detection, CAPTCHA, step-up auth for high-risk flows
API7Server-Side Request Forgery (SSRF)Allowlist outbound destinations, block metadata IPs
API8Security MisconfigurationDisable debug/verbose errors in prod, strip unused HTTP methods
API9Improper Inventory ManagementAPI versioning, sunset policies, automated endpoint discovery
API10Unsafe Consumption of APIsValidate third-party API responses; treat as untrusted input

Secrets management and supply-chain security

SolarWinds in 2020 and Codecov in 2021 proved the point: you can harden your own code perfectly and still be breached through what you depend on. Since then the attack surface has only grown. Malicious npm packages now surface at more than 1,200 a month, typosquats shadow popular libraries, and compromised GitHub Actions workflows quietly lift secrets out of CI while a pull request builds.

Secrets management fundamentals:

  • All secrets (API keys, database credentials, JWT signing keys, OAuth client secrets, TLS private keys) must live in a dedicated secrets manager: AWS Secrets Manager, HashiCorp Vault, GCP Secret Manager, or Azure Key Vault.
  • Secrets must never appear in source code, Dockerfiles, container image layers, CI log output, or environment variable dumps accessible to non-privileged processes.
  • Use a pre-commit hook (git-secrets, truffleHog, gitleaks) that scans staged files for credential patterns before every commit. Also run the same scanner in CI on the full diff of every pull request.
  • Rotate all long-lived secrets on a 90-day schedule. Rotate immediately on any team member offboarding, any reported credential exposure, or any anomalous access pattern in your secret-access audit log.
  • Prefer short-lived dynamic credentials wherever possible: IAM Roles for EC2/ECS instead of long-lived AWS access keys; PostgreSQL roles generated on demand by Vault; OIDC federation for GitHub Actions instead of stored secrets.

Supply-chain controls:

  • Pin dependencies to exact versions in package-lock.json or poetry.lock and verify integrity with npm ci / pip install --require-hashes. Do not use version ranges in production dependency specifications.
  • Audit your dependency tree weekly with npm audit, pip-audit, or Dependabot. Subscribe to GitHub Security Advisories for your critical dependencies.
  • Review transitive dependencies, not just direct ones. The node_modules tree for a typical Next.js application contains 800–1,200 packages; any of them can be compromised.
  • Use GitHub Actions with pinned action versions (SHA hash, not tag) and limit GITHUB_TOKEN permissions to the minimum required for each workflow. Use environment protection rules to prevent untrusted PRs from accessing production secrets.
  • Generate and publish an SBOM (Software Bill of Materials) for each release. NIS2 and emerging US Executive Order requirements are moving towards mandatory SBOM disclosure for software sold to regulated-sector clients.
Security operations team monitoring web application threat alerts and access logs on multiple screens
A security operations posture is not a luxury for large enterprises only. SaaS teams of five engineers can implement centralised log aggregation, automated alerting and on-call rotation with open-source tooling and cloud-native services at low marginal cost.

Security headers and Content Security Policy

No other control gives you this much protection for so little work. HTTP security headers ship in a single deploy and shut down whole categories of client-side attack at once. Here is the set every app should send in 2026:

HeaderRecommended valueThreat mitigated
Content-Security-Policynonce-based; block unsafe-inlineXSS, data exfiltration, clickjacking
Strict-Transport-Securitymax-age=63072000; includeSubDomains; preloadProtocol downgrade, SSL stripping
X-Frame-OptionsDENYClickjacking
X-Content-Type-OptionsnosniffMIME-type confusion attacks
Referrer-Policystrict-origin-when-cross-originSensitive URL leakage in Referer header
Permissions-PolicyRestrict camera, mic, geolocation to ()Abuse of browser APIs by injected scripts
Cross-Origin-Opener-Policysame-originCross-origin window attacks (Spectre)
Cross-Origin-Resource-Policysame-originCross-origin resource inclusion abuse

Building an effective CSP: A permissive policy that allows unsafe-inline everywhere buys you almost nothing against XSS. A strict one leans on per-request nonces. For each response the server mints a cryptographically random nonce, writes it into the CSP header, and stamps it onto every legitimate <script> tag. An injected script never carries that nonce, so the browser refuses to run it.

In a typical React, Next.js or Vue app, a nonce-based CSP needs middleware that generates and stores the nonce for each request — Next.js middleware, Express middleware, or a function running at the CDN edge. Budget a few days for it. In return you drop the WAF rule you were using to catch reflected XSS. Recheck your headers on securityheaders.com after every deploy.

Rate limiting and abuse prevention

Leave rate limiting off and every public endpoint becomes three things at once: a denial-of-service target, a credential-stuffing funnel, and an open door for scrapers. Doing it well in 2026 takes more thought than a flat "100 requests per minute per IP" rule:

  • Authentication endpoints need the tightest limits. Login: 5 attempts per 15 minutes per IP + per username. Password reset: 3 requests per hour per email address. MFA code validation: 3 attempts then force re-authentication. Token refresh: 10 per minute per session.
  • API endpoints by cost. Rate limit by both IP and authenticated user. Use token-bucket or sliding-window algorithms (not fixed-window, which is bypassable at window boundaries). For computationally expensive endpoints (file processing, report generation, LLM calls), apply tighter limits and consider a queue-based architecture.
  • Bot detection and CAPTCHA. Distinguish legitimate clients from bots using behavioural signals (mouse movement, keypress timing, request header patterns) rather than IP blocklists alone. IP blocklists are ineffective against residential proxy networks, which are now widely available to attackers for under $50/month. Consider Cloudflare Turnstile, hCaptcha or AWS WAF bot control as lightweight integration options.
  • Account lockout vs. rate limiting. Hard account lockouts (after N failures, the account is permanently disabled until admin review) are a denial-of-service risk for your own users — an attacker can lock out any account they know exists. Prefer exponential backoff with CAPTCHA challenge over hard lockouts.
  • Alerting on rate-limit hits. Rate-limit events should trigger structured log entries with IP, user agent, and endpoint. Alert on unusual volume: a spike in 429 responses on your login endpoint is often the first signal of a credential-stuffing campaign in progress.

Security testing in the development lifecycle

Writing secure code is necessary but not sufficient. You need to find the gaps in what you wrote — before an attacker does. A mature security testing programme runs multiple complementary tools across every stage of the development lifecycle, so that vulnerabilities surface at the cheapest point to fix them: in a developer's branch, not in a post-breach forensic review.

Static Application Security Testing (SAST): SAST tools analyse source code or compiled bytecode without executing it. They catch injection patterns, hardcoded credentials, insecure function calls and known-dangerous API usage at commit time — fast and cheap.

  • Semgrep — language-agnostic, highly configurable; runs in CI in under 60 seconds on most codebases. The free community ruleset covers OWASP Top 10 patterns. Write custom rules for your internal APIs and domain-specific patterns.
  • Snyk Code — integrates with GitHub/GitLab, inline PR comments. Useful for teams that want SAST without a separate CI step.
  • Bandit (Python) / ESLint security plugin (JavaScript/TypeScript) — lightweight, language-specific, low false-positive rate for common patterns.
  • Run SAST on every pull request. Fail the build on HIGH-severity findings. Triage MEDIUM weekly rather than letting them accumulate.

Software Composition Analysis (SCA): SCA scans your dependency tree — all packages, including transitive ones — for known CVEs.

  • Dependabot (GitHub) or Renovate — automated PR creation for vulnerable dependency updates. Enable auto-merge for patch-level updates with passing tests.
  • Snyk Open Source / OWASP Dependency-Check — deeper analysis including license compliance and reachability (does the vulnerable code path actually execute in your app?).
  • Track your SBOM (Software Bill of Materials) and subscribe to advisory feeds (GitHub Security Advisories, OSV.dev) for your critical packages.

Dynamic Application Security Testing (DAST): DAST attacks a running instance of your application from outside, the way an attacker would. It finds runtime misconfigurations, authentication bypasses and reflected injection vulnerabilities that are invisible in static code.

  • OWASP ZAP — open source, integrates into CI via Docker. Use the baseline scan for fast checks on every deploy; the full scan weekly against a staging environment.
  • Nuclei (ProjectDiscovery) — template-based; the community template library covers thousands of CVEs and misconfigurations. Run against your staging URL after every release.
  • Burp Suite (manual + CI edition) — the industry standard for thorough manual DAST and API testing. Use it for periodic deep assessments, not as a daily CI gate.

Penetration testing cadence: Run a third-party penetration test at least annually, and additionally before any significant architecture change (adding a payment integration, launching a new API surface, or migrating to microservices). SAST and DAST tools catch known patterns; a skilled penetration tester finds the logical flaws and chained vulnerabilities that automated tools miss. Our penetration testing and security audit services deliver a findings report with CVSS scores and a prioritised remediation plan.

Security testing tools — where each fits in the SDLC
Tool typeExample toolsWhen to runWhat it catches
SASTSemgrep, Snyk Code, BanditEvery PR / commitInjection patterns, hardcoded secrets, insecure APIs
SCADependabot, Snyk OSS, Dependency-CheckEvery PR + daily advisory feedKnown CVEs in dependencies
DASTOWASP ZAP, NucleiPost-deploy to staging; weekly full scanRuntime misconfigs, auth bypass, reflected injection
Secrets scangitleaks, truffleHog, GitHub secret scanningPre-commit hook + every PRCredentials in code, committed .env files
Penetration testThird-party engagementAnnually + before major changesLogic flaws, chained vulnerabilities, business-context exploits

Zero Trust and secure configuration

Zero Trust is an architecture principle, not a product. Its core assertion: no request should be trusted by virtue of its origin — not because it arrived from inside the VPC, not because the user authenticated an hour ago, not because the service is on an internal subnet. Every request must be verified. Every resource access must be authorised. Every communication must be encrypted.

Zero Trust controls for web applications:

  • Verify identity on every request, not once at login. Short-lived access tokens (15–60 minutes) force continuous re-verification. Sliding-window refresh tokens that require re-authentication after a period of inactivity close the "logged in and forgotten" attack surface.
  • Encrypt internal traffic. Service-to-service calls within a private network or VPC should use mTLS — mutual TLS where both client and server present certificates. Service meshes (Istio, Linkerd) implement this transparently; without a mesh, enforce it at the application layer. Unencrypted internal traffic is exploitable by any process with network access to the same host.
  • Microsegment network access. A compromised microservice should not have network-level access to every other service in the cluster. Use network policies (Kubernetes NetworkPolicy, AWS Security Groups) to restrict service-to-service communication to the exact list of callers that need it.
  • Disable debug modes and verbose error messages in production. Stack traces returned in HTTP error responses tell an attacker your framework version, file paths, ORM query structure and sometimes partial data. Catch all exceptions at the top-level handler and return a generic error message with a correlation ID — log the full trace server-side, never in the response body.
  • Strip unused HTTP methods. If your API only uses GET and POST, return 405 Method Not Allowed for DELETE, PUT, PATCH and OPTIONS at the gateway or middleware level. Unused methods with permissive CORS are a common source of CSRF and CORS-based attacks.
  • Web Application Firewall (WAF) as a runtime safety net. A WAF (Cloudflare WAF, AWS WAF, ModSecurity) adds a detection layer between your application and the internet. It catches known exploit payloads — SQLi strings, XSS vectors, path traversal sequences — and blocks them before they reach your application code. WAF is not a substitute for fixing injection vulnerabilities in your code, but it reduces the blast radius of any gap you missed. Enable the OWASP Core Rule Set as a baseline; tune it per-endpoint to reduce false positives.
  • Secure baseline configuration checklist: Remove default credentials from all infrastructure components (databases, admin panels, message brokers). Disable directory listing on web servers. Remove version headers (Server, X-Powered-By) from HTTP responses — fingerprinting makes targeted CVE exploitation trivial. Run infrastructure configuration against CIS Benchmarks (CIS AWS Foundations, CIS Kubernetes) in your CI pipeline using tools like Checkov or Trivy.

Logging, monitoring and incident response

Controls keep incidents from happening. Logging and monitoring decide how bad the ones that slip through get. In 2023, IBM's Cost of a Data Breach report put the median dwell time — from first compromise to detection — at 207 days for web application breaches. A logging programme earns its keep by cutting that number from months down to hours.

What to log (structured, not free-text):

  • Every authentication event: login success, login failure, MFA success/failure, password reset, session creation, session invalidation.
  • Every authorisation decision, especially denials: who tried to access what, what permission was missing, what time.
  • All administrative actions: role changes, user creation/deletion, configuration changes, data exports.
  • Application errors and exceptions at ERROR and FATAL level, with full context (request ID, user ID, endpoint, sanitised request parameters).
  • Dependency and infrastructure events: deployment timestamps, secret rotation events, certificate renewal.

What NOT to log: Passwords (including failed attempts), full payment card numbers, full SSNs or government IDs, access tokens or session cookies, any data classified as sensitive under your data classification policy. Log sanitisation rules should be enforced at the logger layer, not left to individual developers.

Alert thresholds to implement immediately:

  • More than 10 failed login attempts from one IP within 5 minutes.
  • Successful login from a country or ASN that the user has never used before.
  • Any access to the admin panel outside business hours.
  • Any privilege-escalation event (user granted admin role).
  • Certificate expiry within 30 days (prevent accidental outage from expired TLS).
  • Any dependency advisory for a package in your production dependency tree.

Keep logs for at least 12 months. Personal data in them still falls under GDPR Article 5 data minimisation, so anonymise or pseudonymise user identifiers after 90 days wherever you can. And store the logs somewhere write-once and tamper-evident, well away from your application servers. An attacker who takes over those servers should never be able to erase the record of what they did.

Encryption in transit and at rest

Everyone encrypts in 2026. The weaknesses that get exploited now live in the details of how you do it. Here is the practical checklist:

In transit:

  • TLS 1.2 minimum, TLS 1.3 preferred for all connections — client to server, server to database, server to third-party API, microservice to microservice. Disable TLS 1.0 and 1.1 at the load-balancer or CDN level.
  • HSTS preloading: submit your domain to the HSTS preload list so browsers enforce HTTPS before even making a connection. This eliminates SSL-stripping attacks on first-visit scenarios.
  • Certificate management: use automated certificate renewal (Let's Encrypt with Certbot, AWS Certificate Manager, Cloudflare managed certificates). Alert on certificate expiry at 30 days and 7 days. A 2023 survey found 23% of web application security incidents were partially attributable to expired TLS certificates causing service disruptions.
  • Internal network traffic: encrypt service-to-service communication even within a VPC or private network using mTLS (mutual TLS). Service meshes (Istio, Linkerd) implement this transparently; alternatively, enforce it at the application layer.

At rest:

  • Encrypt all database storage at rest using the cloud provider's managed encryption (AWS RDS encryption, GCP Cloud SQL encryption). Enable at creation — retrofitting is non-trivial on live databases.
  • For highly sensitive fields (SSNs, health data, financial account numbers), apply field-level encryption at the application layer using AES-256-GCM before storing in the database. This provides protection even if the database credentials are compromised.
  • Encrypt all object storage buckets (S3, GCS) with SSE-S3 at minimum, SSE-KMS for data subject to compliance requirements. Disable public bucket access by default — apply an organisation-level policy that prevents any bucket from being made public without explicit review.
  • Password hashing: use bcrypt (cost factor 12+), scrypt, or Argon2id. Never MD5, SHA-1 or unsalted SHA-256 — these are broken for password storage and are a database dump away from complete account compromise.
  • Key management: rotate encryption keys annually. Use separate keys for different data classifications. Store key material in your HSM or cloud KMS — never alongside the encrypted data.

If you are building for the EU market, it helps to see how these controls line up with your compliance obligations. We trace the link between technical measures and GDPR Article 32 ("appropriate technical measures") and the HIPAA Security Rule safeguards in two companion pieces: GDPR for US founders selling to the EU and the HIPAA software development checklist. Just remember what that paperwork does. It maps controls you have already built onto regulatory language; it is no substitute for building them.

For overall guidance on web application development — from architecture and technology selection through to security and performance — our engineering team publishes detailed technical runbooks drawn from real client engagements.

FAQ

What are the most critical web application security controls in 2026?

The OWASP Top 10 remains the authoritative baseline. In 2026 the highest-impact controls are: strong authentication with MFA and phishing-resistant passkeys, strict role-based access control (RBAC) enforced server-side, parameterised queries or ORM-level protections against injection, secrets stored in a dedicated vault (never in source code), a Content Security Policy with nonce-based script controls, rate limiting on every public endpoint, and centralised structured logging with alert thresholds. These seven controls close the majority of exploitable attack surface in a typical SaaS or B2B web app.

How do I prevent SQL injection in a modern web app?

Use parameterised queries or a well-maintained ORM (Prisma, SQLAlchemy, Hibernate) for every database interaction — never concatenate user input into SQL strings. Enable query logging in staging to catch dynamic SQL before it reaches production. Add a static analysis rule (ESLint security plugin, Semgrep) to your CI pipeline that fails on raw string interpolation in query contexts. For legacy codebases, a web application firewall (WAF) adds a detection layer, but it is not a substitute for fixing the underlying code.

What security headers should every web app send in 2026?

The mandatory set is: Content-Security-Policy (nonce or hash-based, block inline scripts), Strict-Transport-Security with a long max-age (at least one year) and includeSubDomains, X-Frame-Options: DENY or SAMEORIGIN, X-Content-Type-Options: nosniff, Referrer-Policy: strict-origin-when-cross-origin, and Permissions-Policy restricting camera/microphone/geolocation to necessary origins only. Verify your headers with securityheaders.com or the OWASP Secure Headers Project after every deploy.

How should a SaaS app store and rotate secrets in 2026?

All secrets — API keys, database credentials, JWT signing keys, OAuth client secrets — must live in a dedicated secrets manager: AWS Secrets Manager, HashiCorp Vault, or GCP Secret Manager. Secrets must never appear in source code, container images, CI logs, or environment variable dumps. Rotate secrets on a schedule (90 days for long-lived keys, immediately on any team member offboarding or breach signal). Audit secret access logs quarterly and use short-lived dynamic credentials wherever the secrets manager supports it.

What is the difference between authentication and session security?

Authentication verifies who a user is (username + password + MFA). Session security governs what happens after login: how the session token is issued, stored, transmitted and invalidated. Key session controls include: issue tokens with a short TTL, store tokens in httpOnly Secure SameSite=Strict cookies (not localStorage), invalidate server-side on logout, rotate session IDs after privilege changes, and implement idle and absolute session timeouts. A strong authentication flow is undermined entirely if session tokens are leakable via XSS or CSRF.

How does GDPR or HIPAA relate to web application security?

Compliance frameworks like GDPR and HIPAA require technical security controls that overlap heavily with OWASP best practices — encryption in transit and at rest, access logging, least-privilege access, incident response plans and breach notification procedures. However, compliance is not the same as security: a system can be GDPR-compliant on paper while still being exploitable. Treat compliance as a floor, not a ceiling. Implement the OWASP controls first; compliance documentation then maps your existing controls to regulatory requirements rather than rebuilding from scratch.

What is the difference between SAST and DAST in web application security?

SAST (Static Application Security Testing) analyses your source code or compiled binaries without executing them — tools like Semgrep, Snyk Code and Bandit catch injection patterns, hardcoded secrets and insecure function calls at commit time. DAST (Dynamic Application Security Testing) attacks a running application from outside, the way an attacker would — tools like OWASP ZAP and Nuclei find logic flaws, authentication bypasses and mis-configured headers that are invisible in static code. Both are necessary in a mature CI/CD pipeline: SAST catches classes of vulnerability before code is merged; DAST finds the runtime issues SAST misses. A third layer, SCA (Software Composition Analysis), scans dependency trees for known CVEs. Run all three; rely on none exclusively.

What does Zero Trust mean for web application security?

Zero Trust is an architectural principle: never trust any request by virtue of its origin — not because it came from inside the VPN, not because the user authenticated an hour ago, not because the service account is on an internal subnet. Every request must be authenticated, authorised and validated, every time. For a web application this means: enforce least-privilege RBAC on every API call (not just at login), require short-lived tokens rather than long-lived sessions, encrypt internal service-to-service traffic with mTLS even within a private network, and audit identity and access logs continuously. Zero Trust is not a product you buy — it is a set of controls you apply incrementally to reduce implicit trust assumptions in your stack.

Last updated 5 September 2026. Added: API security best practices (OWASP API Security Top 10 mapping), security testing in the SDLC (SAST/DAST/SCA/penetration testing), Zero Trust and secure configuration. Controls are aligned with OWASP Top 10 (2021), OWASP API Security Top 10 (2023), NIST SP 800-53 Rev 5 and CIS Controls v8. This article discusses security engineering practices; it does not constitute legal advice regarding regulatory compliance obligations.