---
url: /saas-starter/v0.10.1/guide/asvs.md
---
# OWASP ASVS level 2

::: tip What this page covers
Every choice of `--Persistence`, `--Auth`, `--IncludeTests` and `--Aspire`: a label says
which options a part is for. The copy in your app's `docs/` folder has only the parts for yours.
`ApiHost` stands for your app's name.
:::

How ApiHost measures up to the [OWASP Application Security Verification Standard](https://owasp.org/www-project-application-security-verification-standard/)
5.0.0 at level 2, the level the ASVS recommends for most applications that handle personal data. It
covers every level 1 and level 2 requirement, in the standard's order, and says whether the app
meets it as it comes, what's left to you, and why. [Security](./security.md) describes the same
protections by feature.

This is a review of the template, not a certificate for your app: what you build on it, and how you
deploy it, is part of what an assessor checks. Use it as a starting point for your own.

| Status | Meaning |
|---|---|
| **Met** | The app does it as it comes. |
| **Partly** | Met for what the app has, with a gap that's described. |
| **Yours** | It depends on your deployment, your organisation or the features you add; what to do is described. |
| **N/A** | The app has no such feature (LDAP, GraphQL, WebRTC...). It applies once you add one. |

Reviewed for v0.10.0 (November 2026), against ASVS 5.0.0.

## V1 Encoding and Sanitization

| # | Requirement | Status | How |
|---|---|---|---|
| 1.1.1 | Decode input once, before validation | Met | ASP.NET Core decodes URLs and JSON once, before binding and validation; the app decodes nothing again. |
| 1.1.2 | Encode output as the last step, or let the interpreter do it | Met | React encodes text when it renders; System.Text.Json encodes JSON; queries are parameterised. |
| 1.2.1 | Output encoding for the context (HTML, attributes, headers) | Met | React escapes text and attributes; the server sends JSON, not HTML; header values come from the framework's typed APIs. |
|  1.2.2 | Encode untrusted data in URLs; only safe protocols | Met | The client builds URLs with `encodeURIComponent`. Webhook URLs must be `https` (and public) in production. |
|  1.2.2 | Encode untrusted data in URLs; only safe protocols | Met | The client builds URLs with `encodeURIComponent`. |
| 1.2.3 | Encode output when building JavaScript or JSON | Met | JSON is written by System.Text.Json. The only inline scripts are the build's own, allowed by hash. |
| 1.2.4 | Parameterised database queries | Met | Marten's LINQ and EF Core parameterise every query; there's no SQL built from strings. |
| 1.2.5 | No OS command injection | Met | The app runs no commands. |
| 1.2.6 | No LDAP injection | N/A | No LDAP. |
| 1.2.7 | No XPath injection | N/A | No XPath. |
| 1.2.8 | LaTeX processors locked down | N/A | No LaTeX. |
| 1.2.9 | Escape special characters in regular expressions | Met | No regular expression is built from input. |
| 1.3.1 | Sanitise HTML from WYSIWYG editors | N/A | There's no rich-text input; text is shown as text. If you add an editor, sanitise its HTML on the server (for example with HtmlSanitizer, MIT). |
| 1.3.2 | No `eval()` or dynamic code execution | Met | None in the client or the server. Wolverine's code is generated at publish time, not from input; the Content-Security-Policy allows no `eval`. |
| 1.3.3 | Sanitise data passed to dangerous contexts | Met | Input is validated (FluentValidation) and limited in length before it's stored or sent anywhere. |
|  1.3.4 | Sanitise user-supplied SVG | Met | Pictures must be PNG, JPEG or WebP by their bytes, so an SVG is refused. Attachments of any type, SVG included, are only ever downloaded as files, never shown as pages ([file storage](./file-storage.md)). |
|  1.3.4 | Sanitise user-supplied SVG | Met | Attachments of any type, SVG included, are only ever downloaded as files, never shown as pages ([file storage](./file-storage.md)). |
| 1.3.5 | Sanitise Markdown, CSS, XSL and similar | N/A | No user-supplied templates or stylesheets. |
|  1.3.6 | Protect against SSRF | Met | The app calls fixed services (Stripe, Have I Been Pwned, Google, GitHub, file storage). Webhooks, the only addresses users choose, refuse private, link-local and loopback addresses after DNS, in production, and never follow redirects ([integrations](./integrations.md)). |
|  1.3.6 | Protect against SSRF | Met | The app calls fixed services only: Have I Been Pwned, Google, GitHub and file storage. Users can't give it addresses to call. |
|  1.3.6 | Protect against SSRF | Met | The app calls only its file storage, at a configured address. Users can't give it addresses to call. |
|  1.3.7 | No templates built from untrusted input | Met | Emails are built from fixed templates with encoded values. |
|  1.3.7 | No templates built from untrusted input | N/A | The app sends no email. |
| 1.3.8 | No JNDI injection | N/A | .NET has no JNDI. |
| 1.3.9 | Sanitise content sent to memcache | N/A | No memcache. |
| 1.3.10 | Sanitise format strings | Met | C# interpolation and structured logging take values as arguments, never as format strings. |
| 1.3.11 | Sanitise input passed to mail systems | Met | MailKit builds messages: addresses are parsed and header values encoded, so input can't add headers or recipients. |
| 1.4.1 | Memory-safe strings and copies | Met | .NET and JavaScript are memory safe; the app has no unsafe code. |
| 1.4.2 | Prevent integer overflows | Met | Numbers from requests are range-checked by validators (page sizes, limits, sizes). |
| 1.4.3 | Release memory, no dangling pointers | Met | Managed memory. |
| 1.5.1 | XML parsers with external entities off | Met | The app parses no XML from users; .NET's parsers don't resolve external entities by default. |
| 1.5.2 | Safe deserialisation | Met | System.Text.Json into fixed types; no type names from input. Wolverine and Marten read only what the app wrote. |

## V2 Validation and Business Logic

| # | Requirement | Status | How |
|---|---|---|---|
| 2.1.1 | Document input validation rules | Met | Each request's validator is the rule, next to its endpoint (for example `CreateTodoValidator`); [the reference](./reference/endpoints.md) lists the endpoints. |
| 2.1.2 | Document checks across combined fields | Yours | The template's requests have few related fields; document your own as you add them. |
|  2.1.3 | Document business limits, per user and overall | Met | Rate limits ([security](./security.md)), upload sizes ([file storage](./file-storage.md)) and plan limits are documented with their settings. |
|  2.1.3 | Document business limits, per user and overall | Met | Rate limits ([security](./security.md)) and upload sizes ([file storage](./file-storage.md)) are documented with their settings. |
|  2.1.3 | Document business limits, per user and overall | Met | Upload sizes and counts are documented with their settings ([file storage](./file-storage.md)). |
| 2.2.1 | Validate all input against expectations | Met | Every request has a validator or typed binding; a query value that doesn't parse answers 400 (`RejectUnparseableQueryValues`). |
| 2.2.2 | Validate on the server, not only the client | Met | The API validates everything; the client's checks are only for convenience. |
| 2.2.3 | Combinations of related fields are reasonable | Met | Validators check related fields together where they exist (for example a due date with a reminder). |
|  2.3.1 | Steps of a flow in order, none skipped | Met | Multi-step flows carry a server-issued ticket from the step before: two-factor sign-in, linking Google or GitHub, passkey ceremonies, uploads (an encrypted upload token). |
|  2.3.1 | Steps of a flow in order, none skipped | Met | Uploads carry a server-issued, encrypted upload token from the step before. |
|  2.3.2 | Business limits enforced as documented | Met | Plan limits, invitation limits and upload limits are checked on the server. |
|  2.3.2 | Business limits enforced as documented | Met | Invitation and upload limits are checked on the server. |
|  2.3.2 | Business limits enforced as documented | Met | Upload limits are checked on the server. |
| 2.3.3 | Transactions: all or nothing | Met | Each endpoint and handler commits its changes and the messages it sends in one transaction (Wolverine's outbox). |
| 2.3.4 | Locking for limited resources | Partly | Marten's and EF Core's optimistic concurrency stop lost updates where it matters (event streams). Limits such as a plan's seats are checked before the change, so two requests at the same instant could both pass; lock or re-check in the transaction if a limit must never be exceeded. |
|  2.4.1 | Anti-automation against excessive calls | Partly | Rate limits on sign-in, sign-up, email sending, invitations, picture uploads and API keys; plan limits on data. Other endpoints have none: add a limiter (`AddRateLimiter`) to any feature that's costly or could be used to fill your storage. |
|  2.4.1 | Anti-automation against excessive calls | Partly | Rate limits on sign-in, sign-up, email sending and picture uploads. Other endpoints have none: add a limiter (`AddRateLimiter`) to any feature that's costly or could be used to fill your storage. |
|  2.4.1 | Anti-automation against excessive calls | Partly | Upload sizes and counts are limited, but there are no rate limits: add a limiter (`AddRateLimiter`) to any feature that's costly or could be used to fill your storage, and limit requests per address at the proxy. |

## V3 Web Frontend Security

| # | Requirement | Status | How |
|---|---|---|---|
| 3.2.1 | Responses aren't rendered in the wrong context | Met | API responses are JSON with `nosniff`; downloads come as attachments and, from local storage, with a sandboxing Content-Security-Policy. |
| 3.2.2 | Text shown with safe rendering functions | Met | React renders text with `textContent`; no `dangerouslySetInnerHTML` on data. |
|  3.3.1 | Cookies `Secure`, with a `__Secure-` or `__Host-` prefix | Met | The app's own cookies are `Secure` and named `__Secure-...` over HTTPS (`Security/SecureCookies.cs`). Not the consent cookie, which the browser sets and only records a choice, nor ASP.NET Core's short-lived correlation cookies during Google or GitHub sign-in. |
|  3.3.1 | Cookies `Secure`, with a `__Secure-` or `__Host-` prefix | Met | The app sets no cookies of its own. The consent cookie (with analytics on) only records a choice, and is set by the browser. |
|  3.3.2 | `SameSite` set for each cookie's purpose | Met | The refresh token's cookie is `Strict`; the known-device cookie `Lax`, as Google and GitHub send people back to sign in. |
|  3.3.2 | `SameSite` set for each cookie's purpose | N/A | No cookies of the app's own. |
|  3.3.3 | `__Host-` prefix unless shared | Partly | `__Secure-` rather than `__Host-`, which requires `Path=/`: the refresh token's cookie is kept to `/api` so it isn't sent with every page, script and picture, nor through a CDN. Host the app on a hostname of its own (3.5.4) so no sibling site can set cookies for it. |
|  3.3.3 | `__Host-` prefix unless shared | N/A | No cookies of the app's own. |
|  3.3.4 | Session cookies `HttpOnly`, set only by `Set-Cookie` | Met | The refresh token is `HttpOnly` and never in a response body for browsers; the access token is kept in memory, not in a cookie. |
|  3.3.4 | Session cookies `HttpOnly`, set only by `Set-Cookie` | N/A | No sessions. |
| 3.4.1 | HSTS on every response, a year, subdomains included | Met | Outside Development: a year, with `includeSubDomains` (`Program.cs`). Serve every subdomain over HTTPS before going live. |
| 3.4.2 | CORS origins fixed or allow-listed | Met | No CORS: the API answers no cross-origin requests from browsers. |
| 3.4.3 | Content-Security-Policy with `object-src 'none'`, `base-uri 'none'`, allow-list or hashes | Met | Scripts from the app's origin and the build's inline scripts by hash; `object-src 'none'`, `base-uri 'none'`, `frame-ancestors 'none'` (`Security/SecurityHeaders.cs`). |
| 3.4.4 | `X-Content-Type-Options: nosniff` everywhere | Met | On every response. |
| 3.4.5 | Referrer policy | Met | `strict-origin-when-cross-origin`: other sites see the origin, never the path or query. |
| 3.4.6 | `frame-ancestors` on every response | Met | `frame-ancestors 'none'`, and `X-Frame-Options: DENY` for older browsers. |
|  3.5.1 | CSRF protection without relying on CORS preflight | Met | API calls carry the access token in the `Authorization` header, which another site can't send; the refresh cookie is only read with a custom header (`X-Refresh-Token-Cookie`). |
|  3.5.1 | CSRF protection without relying on CORS preflight | Met | The app has no sessions or cookies a forged request could ride on: every visitor shares the same data. |
| 3.5.2 | Requests can't avoid a preflight | Met | The cookie-reading endpoints need the custom header, which always triggers a preflight, and the API allows none. |
|  3.5.3 | Sensitive actions use POST, PUT, PATCH or DELETE | Met | Every change is a POST, PUT or DELETE; links in emails open a page that POSTs. |
|  3.5.3 | Sensitive actions use POST, PUT, PATCH or DELETE | Met | Every change is a POST, PUT or DELETE. |
| 3.5.4 | Separate applications on separate hostnames | Yours | Give the app a hostname of its own (`app.example.com`), not a path beside other sites. With S3 or Azure, files come from the store's own hostname. |
|  3.5.5 | `postMessage` messages checked | Met | The client uses no `postMessage` across windows; tabs share sign-in state through a `BroadcastChannel`, which only the same origin can use. |
|  3.5.5 | `postMessage` messages checked | Met | The client uses no `postMessage`. |
| 3.7.1 | Only supported client-side technologies | Met | React and standard web APIs; no plugins. |
|  3.7.2 | Redirects to other hosts only from an allow-list | Met | The only redirects off the app are to Google, GitHub and Stripe, with addresses the server builds. |
|  3.7.2 | Redirects to other hosts only from an allow-list | Met | The only redirects off the app are to Google and GitHub, with addresses the server builds. |
|  3.7.2 | Redirects to other hosts only from an allow-list | Met | The app doesn't redirect to other hosts. |

## V4 API and Web Service

| # | Requirement | Status | How |
|---|---|---|---|
| 4.1.1 | `Content-Type` with charset matches the body | Met | `application/json; charset=utf-8` and `application/problem+json`; static files by extension. |
| 4.1.2 | Only user-facing pages redirect HTTP to HTTPS | Yours | The reverse proxy (Caddy in `deploy/`) redirects every HTTP request. To refuse rather than redirect API calls over HTTP, answer `/api` on port 80 with an error in the proxy. |
| 4.1.3 | Headers set by a proxy can't be forged | Met | With `ASPNETCORE_FORWARDEDHEADERS_ENABLED`, the app takes the client's address from the last proxy only, and Caddy replaces any `X-Forwarded-For` the client sent. Behind another proxy, check it does the same. |
| 4.2.1 | Message boundaries determined consistently (no smuggling) | Met | Kestrel and Caddy follow the HTTP specifications. |
| 4.3.1 | GraphQL query limits | N/A | No GraphQL. |
| 4.3.2 | GraphQL introspection off in production | N/A | No GraphQL. |
| 4.4.1 | WebSockets over TLS | Met | SignalR uses the page's scheme: `wss` in production. |
|  4.4.2 | Check `Origin` on the WebSocket handshake | Partly | The hub doesn't check `Origin`. A page from another site can't use it as someone, though: the hub only accepts an access token, which that page doesn't have (no cookie is involved). |
|  4.4.2 | Check `Origin` on the WebSocket handshake | Partly | The hub doesn't check `Origin`. With no accounts, it only sends what any visitor can see. |
|  4.4.3 | Dedicated WebSocket tokens follow session rules | Met | The hub uses the same short-lived access tokens, and closes connections when they expire. |
|  4.4.3 | Dedicated WebSocket tokens follow session rules | N/A | No sessions. |
|  4.4.4 | WebSocket tokens come from the HTTPS session | Met | The access token comes from signing in over HTTPS. |
|  4.4.4 | WebSocket tokens come from the HTTPS session | N/A | No sessions. |

## V5 File Handling

| # | Requirement | Status | How |
|---|---|---|---|
|  5.1.1 | Document file types, sizes, and how files are made safe | Met | [File storage](./file-storage.md): pictures (PNG, JPEG, WebP, 512 KB) and attachments (size and count limits, any type, always downloaded). |
|  5.1.1 | Document file types, sizes, and how files are made safe | Met | [File storage](./file-storage.md): attachments (size and count limits, any type, always downloaded). |
|  5.2.1 | Only files of a size the app can handle | Met | Pictures are limited to 512 KB and 1024 pixels a side; attachments to `Attachments:MaxBytes`, checked after the upload too. |
|  5.2.1 | Only files of a size the app can handle | Met | Attachments are limited by `Attachments:MaxBytes`, checked after the upload too. |
|  5.2.2 | Extension and content match the expected type | Partly | Pictures are checked by their bytes and decoded. Attachments accept any type, as they're only stored and downloaded: if a feature of yours processes files, check their type by content. |
|  5.2.2 | Extension and content match the expected type | Partly | Attachments accept any type, as they're only stored and downloaded: if a feature of yours processes files, check their type by content. |
| 5.2.3 | Compressed files checked before unpacking | N/A | The app unpacks nothing. |
| 5.3.1 | Uploads never run as code | Met | Files go to a store (a folder outside `wwwroot`, S3 or Azure), never executed, and are served as attachments. |
| 5.3.2 | File paths from trusted data | Met | Storage keys are generated by the app; a key can't leave the storage folder. |
| 5.4.1 | Ignore user-supplied file names; set `Content-Disposition` | Met | Files are stored under generated keys; downloads name the file in `Content-Disposition`. |
| 5.4.2 | File names encoded in headers (RFC 6266) | Met | `FileDownloads.AttachmentHeader` uses `filename*` encoding. |
| 5.4.3 | Antivirus scanning of untrusted files | Yours | No scanning. If files are shared between people, scan them after upload (ClamAV, or your storage provider's malware scanning) before making them available. |

::: info With accounts

## V6 Authentication

| # | Requirement | Status | How |
|---|---|---|---|
| 6.1.1 | Document rate limits, anti-automation and lockout | Met | [Accounts](./accounts.md#lockout) and [security](./security.md): per-address rate limits, a per-account lockout of 15 minutes, which a password reset lifts so an attacker can't keep someone out. |
| 6.1.2 | Document context-specific words not allowed in passwords | Met | The email, the app's name and `Accounts:PasswordBlockedWords` ([accounts](./accounts.md#passwords)). |
| 6.1.3 | Document every way to sign in, with equal strength | Met | [Accounts](./accounts.md): password, passkey, Google and GitHub, each with two-factor where it applies. |
| 6.2.1 | Passwords of at least 8 characters | Met | 8 or more. |
| 6.2.2 | Users can change their password | Met | Settings → Security. |
| 6.2.3 | Changing a password needs the current one | Met | `POST /api/account/password` checks it. |
| 6.2.4 | New passwords checked against the top 3,000 | Met | The 10,000 most common passwords of 8 characters or more (`Identity/CommonPasswords.cs`). |
| 6.2.5 | No composition rules | Met | Any characters; no upper case, digit or symbol rules. |
| 6.2.6 | Password fields use `type=password` | Met | Every password field. |
| 6.2.7 | Paste and password managers allowed | Met | Nothing blocks paste; fields have `autocomplete` set for password managers. |
| 6.2.8 | Passwords checked exactly as typed | Met | No trimming, truncation or case changes. |
| 6.2.9 | Passwords of 64 characters or more allowed | Met | No maximum beyond the request's size. |
| 6.2.10 | No periodic password changes | Met | Passwords never expire. |
| 6.2.11 | Context-specific words refused | Met | `CommonPasswordValidator`. |
| 6.2.12 | New passwords checked against breached passwords | Partly | With `Accounts:RejectBreachedPasswords=true`, through Have I Been Pwned without sending the password. Off by default because it calls an outside service: turn it on in production. |
| 6.3.1 | Defences against credential stuffing and brute force | Met | Rate limits per address, lockout per account, emails about new devices and lockouts. |
| 6.3.2 | No default accounts | Met | The demo user exists in Development only; admins come from `Accounts:AdminEmails` once confirmed. |
| 6.3.3 | Multi-factor authentication, or a combination of factors | Partly | Offered to everyone (authenticator apps and passkeys), and can be required of admins (`Accounts:RequireTwoFactorForAdmins`) and, with organisations, by an organisation of its members. Not required of every user: whether to require it is your decision, to document. |
| 6.3.4 | No undocumented ways to sign in | Met | The ways in [accounts](./accounts.md) are all there is; API keys (with organisations) are separate credentials for programs. |
| 6.4.1 | Initial passwords and activation codes random, short-lived | Met | Invitations and confirmations are links with signed, single-use tokens that expire (a week for invitations); there are no initial passwords. |
| 6.4.2 | No password hints or secret questions | Met | None. |
| 6.4.3 | Password reset doesn't bypass multi-factor | Met | A reset sets the password only; signing in afterwards still asks for the code. |
| 6.4.4 | Lost second factor: identity proven again | Yours | Recovery codes cover a lost phone. Without them, an admin can turn two-factor off (back office); decide how admins confirm who's asking before they do. |
| 6.5.1 | Codes from authenticator apps and recovery codes work once | Met | Recovery codes are used up; an authenticator code is refused a second time (`ApplicationUserManager`, remembered per instance). |
| 6.5.2 | Lookup secrets stored hashed | Met | Recovery codes have 125 random bits and are stored as SHA-256 hashes. |
| 6.5.3 | Secrets and seeds from a CSPRNG | Met | Authenticator keys, recovery codes and tokens come from `RandomNumberGenerator`. |
| 6.5.4 | Codes with at least 20 bits of entropy | Met | Six-digit codes; recovery codes have 125 bits. |
| 6.5.5 | Defined lifetimes; TOTP of 30 seconds | Met | 30-second codes (accepted a step either side, for clocks that drift); the step between password and code expires after 5 minutes. |
| 6.6.1 | SMS and phone codes | N/A | No SMS or phone codes. |
| 6.6.2 | Out-of-band codes bound to their request | Met | Email links are tied to the user and their purpose, and stop working once used. |
| 6.6.3 | Out-of-band codes rate limited | Met | Email links carry long signed tokens, and the endpoints that use them are rate limited. |
| 6.8.1 | Identities from several providers can't be confused | Met | External logins are keyed by provider and the provider's user ID; an email is only linked once the provider has verified it. |
| 6.8.2 | Signatures on authentication assertions validated | Met | Google and GitHub sign-in use the authorisation code flow over TLS; ASP.NET Core's handlers validate what they receive. |
| 6.8.3 | SAML assertions used once | N/A | No SAML. |
| 6.8.4 | Strength and recency from the identity provider checked | Met | Google and GitHub sign-ins are treated as one factor: with two-factor on, they also need a code. |

## V7 Session Management

| # | Requirement | Status | How |
|---|---|---|---|
| 7.1.1 | Document inactivity and absolute timeouts, and deviations from NIST | Met | A session ends after `Jwt:RefreshTokenLifetimeDays` unused (14) and at most `Jwt:SessionLifetimeDays` after sign-in (30), NIST SP 800-63B's limit for AAL1. AAL2 asks for re-authentication every 24 hours: shorten both if your app needs that. |
| 7.1.2 | Document how many sessions an account may have | Met | Any number, one per device; all are listed in Settings, where any can be ended. |
| 7.1.3 | Document federated session lifetimes | Met | Signing in with Google or GitHub starts an app session like any other; signing out of Google or GitHub doesn't end it. |
| 7.2.1 | Tokens verified on the server | Met | Every request's access token is validated by the API. |
| 7.2.2 | Dynamically generated session tokens, not static keys | Met | Access and refresh tokens are issued at sign-in; API keys (with organisations) are for programs. |
| 7.2.3 | Reference tokens random with 128 bits | Met | Refresh tokens have 512 random bits and are stored as hashes. |
| 7.2.4 | A new token at every sign-in | Met | Every sign-in starts a new session with new tokens. |
| 7.3.1 | Inactivity timeout | Met | `Jwt:RefreshTokenLifetimeDays`. |
| 7.3.2 | Absolute session lifetime | Met | `Jwt:SessionLifetimeDays`. |
| 7.4.1 | Terminated sessions can't be used | Met | Signing out revokes the refresh token; the access token expires within `Jwt:AccessTokenLifetimeMinutes` (15). |
| 7.4.2 | Sessions end when an account is disabled or deleted | Met | Locking or deleting an account revokes its refresh tokens, and a locked account can't refresh. |
| 7.4.3 | Option to end other sessions after changing a factor | Met | Changing or resetting the password ends every other session; Settings can end the rest at any time. |
| 7.4.4 | Sign out visible on every signed-in page | Met | In the sidebar's account menu (the top bar's, on narrow screens). |
| 7.4.5 | Admins can end a user's sessions | Met | The back office's "End sessions". |
| 7.5.1 | Re-authentication before changing what recovers the account | Met | Changing the email needs the password and, with two-factor on, a code. Turning two-factor off needs a code. |
| 7.5.2 | Users can view and end their sessions | Partly | Settings lists sessions and ends any or all. It doesn't ask for the password again first. |
| 7.6.1 | Federated session lifetimes behave as documented | Met | See 7.1.3. |
| 7.6.2 | A session needs the user's action | Met | Sessions start only from a sign-in the user makes. |

## V8 Authorization

| # | Requirement | Status | How |
|---|---|---|---|
|  8.1.1 | Document function and data access rules | Met | [Accounts](./accounts.md) (roles, organisation roles) and [the reference](./reference/endpoints.md), which lists who can call each endpoint. |
|  8.1.1 | Document function and data access rules | Met | [Accounts](./accounts.md) (roles) and [the reference](./reference/endpoints.md), which lists who can call each endpoint. |
| 8.1.2 | Document field-level access rules | Met | Requests are records with only the fields a caller may set; responses list only what the caller may see. |
| 8.2.1 | Function access needs explicit permission | Met | Endpoints require sign-in unless marked public; admin endpoints need the Admin role. `EndpointSecurityTests` fails on an endpoint that's neither. |
|  8.2.2 | Data access only to its owner (no IDOR) | Met | Data belongs to an organisation and is filtered by multi-tenancy in the data layer; someone else's records answer 404. |
|  8.2.2 | Data access only to its owner (no IDOR) | Met | Data belongs to a user and is loaded by owner; someone else's records answer 404. |
| 8.2.3 | Field-level access | Met | No endpoint binds a whole entity, so a request can't set fields it shouldn't (see 15.3.3). |
| 8.3.1 | Authorisation on the server | Met | The client only hides what the API refuses anyway. |
|  8.4.1 | Tenants can't affect each other | Met | Marten's multi-tenancy or EF Core's tenant filter, from the token's organisation, and checked membership on every request. |
|  8.4.1 | Tenants can't affect each other | Met | Each user's data is separate (see 8.2.2). |

## V9 Self-contained Tokens

| # | Requirement | Status | How |
|---|---|---|---|
| 9.1.1 | Tokens validated by signature | Met | Access tokens are JWTs checked for signature, issuer, audience and lifetime. |
| 9.1.2 | Only allow-listed algorithms | Met | HS256 only (`ValidAlgorithms`). |
| 9.1.3 | Keys only from trusted configuration | Met | One key from `Jwt:SigningKey`; headers such as `jku` and `jwk` are ignored. The app won't start with a short or development key outside Development. |
| 9.2.1 | `exp` and `nbf` checked | Met | With 30 seconds' clock skew. |
| 9.2.2 | Token type checked | Met | The app issues one kind of JWT, the access token; other tickets are Data Protection payloads with their own purposes. |
| 9.2.3 | Audience checked | Met | `Jwt:Audience`. |
| 9.2.4 | Audience restricted when one key signs for several audiences | Met | One key, one audience. Give each app its own key. |

## V10 OAuth and OIDC

The app is an OAuth client of Google and GitHub, and the API is a resource server for its own
tokens. It isn't an authorisation server or an OpenID provider, so 10.4, 10.6 and 10.7 don't apply.

| # | Requirement | Status | How |
|---|---|---|---|
| 10.1.1 | Tokens only sent where they're needed | Met | Google's and GitHub's tokens stay on the server and aren't kept; the browser gets only the app's own tokens. |
| 10.1.2 | Responses tied to the user agent's transaction (state, PKCE) | Met | ASP.NET Core's handlers use `state` with a correlation cookie, and PKCE where the provider supports it. |
| 10.2.1 | CSRF protection on the code flow | Met | As 10.1.2. |
| 10.2.2 | Mix-up defence with several authorisation servers | Met | Each provider has its own callback path and handler. |
| 10.3.1 | Resource server checks the audience | Met | See 9.2.3. |
|  10.3.2 | Authorisation from the token's claims | Met | User, roles and organisation come from the token's claims. |
|  10.3.2 | Authorisation from the token's claims | Met | User, roles come from the token's claims. |
| 10.3.3 | Users identified by claims that can't be reassigned | Met | `sub` is the user's ID, never reused. |
| 10.3.4 | Strength and recency checked when required | Met | Where an action needs more (changing the email, deleting the account), the API asks for the password and code again rather than trusting the token's age. |
| 10.4.1 – 10.4.11 | Authorisation server requirements | N/A | The app isn't an authorisation server. |
| 10.5.1 | ID token replay prevented (nonce) | Met | Google sign-in uses ASP.NET Core's OAuth handler; the identity comes from the provider's user info over TLS, not from an ID token. |
| 10.5.2 | Users identified by `sub` | Met | By the provider's user ID. |
| 10.5.3 | Issuer metadata matches | N/A | No discovery documents are used; the providers' addresses are fixed. |
| 10.5.4 | ID token audience checked | N/A | See 10.5.1. |
| 10.5.5 | Back-channel logout tokens checked | N/A | No back-channel logout. |
| 10.6.1, 10.6.2 | OpenID provider requirements | N/A | The app isn't an OpenID provider. |
| 10.7.1 – 10.7.3 | Consent management | N/A | The app isn't an authorisation server. |
:::

::: info Without accounts

## V6 to V10: Authentication, sessions, authorisation and tokens

This app has no accounts, so there's no authentication, session or token to assess, and every
visitor shares the same data. These chapters apply once you add sign-in; the template's
`--Auth identity` and `--Auth saas` options meet them as their versions of this page describe.
:::

## V11 Cryptography

| # | Requirement | Status | How |
|---|---|---|---|
|  11.1.1 | Key management policy | Yours | The app's keys: `Jwt:SigningKey` (rotate it as [described](./how-to/rotate-the-signing-key.md)), ASP.NET Core Data Protection's keys (in PostgreSQL, rotated every 90 days by the framework), and your providers' secrets. Write down who holds them and how they're replaced. |
|  11.1.1 | Key management policy | Yours | The app's keys: ASP.NET Core Data Protection's (rotated every 90 days by the framework; kept in the container, so a restart makes new ones and only short-lived signed URLs are lost), and your providers' secrets. Write down who holds them and how they're replaced. |
| 11.1.2 | Cryptographic inventory | Met | Below. |
| 11.2.1 | Industry-validated implementations | Met | .NET's `System.Security.Cryptography` (the operating system's libraries) and ASP.NET Core Data Protection. No custom cryptography. |
|  11.2.2 | Crypto agility | Met | Data Protection rotates keys and algorithms; password hashes are upgraded by Identity on sign-in; the JWT key can be rotated. |
|  11.2.2 | Crypto agility | Met | Data Protection rotates its keys and can change algorithms. |
| 11.2.3 | At least 128 bits of security | Met | See the inventory. |
| 11.3.1 | No ECB or weak padding | Met | AES-256-CBC with HMAC-SHA256 (Data Protection's default). |
| 11.3.2 | Approved ciphers and modes | Met | As 11.3.1. |
| 11.3.3 | Authenticated encryption | Met | Data Protection authenticates everything it encrypts. |
| 11.4.1 | Approved hash functions | Met | SHA-256 and HMAC-SHA256. SHA-1 is used only to look up Have I Been Pwned's index, not for security. |
|  11.4.2 | Passwords with an approved KDF | Met | Identity's PBKDF2 with HMAC-SHA512, 100,000 iterations. |
|  11.4.2 | Passwords with an approved KDF | N/A | No passwords. |
| 11.4.3 | Collision-resistant hashes of 256 bits | Met | SHA-256. |
| 11.4.4 | Keys derived from passwords use a KDF | N/A | No keys are derived from passwords. |
| 11.5.1 | Non-guessable values from a CSPRNG, 128 bits | Met | Tokens, keys and codes come from `RandomNumberGenerator`. IDs are GUIDs, which aren't secrets: access is checked, not assumed from an unguessable ID. |
|  11.6.1 | Approved public-key algorithms | Met | Passkeys use the authenticator's keys (ES256, RS256), checked by Identity. |
|  11.6.1 | Approved public-key algorithms | N/A | No public-key cryptography of the app's own. |

The app's cryptography:

| What | Algorithm | Key |
|---|---|---|
|  Access tokens (JWT) | HMAC-SHA256 | `Jwt:SigningKey`, at least 256 bits |
|   Refresh tokens, API keys, recovery codes, invitation tokens (stored) | SHA-256 of 128+ random bits | None |
|   Refresh tokens and recovery codes (stored) | SHA-256 of 128+ random bits | None |
|  Passwords | PBKDF2-HMAC-SHA512, 100,000 iterations, 128-bit salt | None |
|   Email links, two-factor tickets, passkey state, known devices, organisation secrets | Data Protection: AES-256-CBC + HMAC-SHA256 | Data Protection keys, in PostgreSQL |
|   Email links, two-factor tickets, passkey state, known devices | Data Protection: AES-256-CBC + HMAC-SHA256 | Data Protection keys, in PostgreSQL |
|  Authenticator codes (TOTP) | HMAC-SHA1 (RFC 6238, as authenticator apps require) | A 160-bit key per user |
| Signed file URLs (local storage), upload tokens | Data Protection | Data Protection keys |
|  Webhook signatures | HMAC-SHA256 | A secret per endpoint |
| TLS | TLS 1.2 and 1.3 (Caddy's defaults) | Let's Encrypt certificates |

## V12 Secure Communication

| # | Requirement | Status | How |
|---|---|---|---|
| 12.1.1 | Only TLS 1.2 and 1.3 | Met | Caddy (`deploy/`) allows only TLS 1.2 and 1.3. Behind another proxy or load balancer, configure it the same way. |
| 12.1.2 | Recommended cipher suites | Met | Caddy's defaults. |
| 12.1.3 | mTLS client certificates validated | N/A | No client certificates. |
| 12.2.1 | TLS for every external connection | Met | HTTPS redirection and HSTS; Caddy serves HTTPS only. |
| 12.2.2 | Publicly trusted certificates | Met | Caddy gets Let's Encrypt certificates. |
|  12.3.1 | TLS for every connection, in and out | Partly | Outgoing calls (Stripe, Google, GitHub, Have I Been Pwned, S3, Azure, webhooks) use HTTPS. In `deploy/`, PostgreSQL is reached over Docker's private network without TLS: with a managed database, add `SSL Mode=VerifyFull` to the connection string. SMTP uses TLS when the server offers it: set `Email:Smtp:Security` to `StartTls` or `SslOnConnect` so it can't fall back. |
|  12.3.1 | TLS for every connection, in and out | Partly | Outgoing calls (Google, GitHub, Have I Been Pwned, S3, Azure) use HTTPS. In `deploy/`, PostgreSQL is reached over Docker's private network without TLS: with a managed database, add `SSL Mode=VerifyFull` to the connection string. SMTP uses TLS when the server offers it: set `Email:Smtp:Security` to `StartTls` or `SslOnConnect` so it can't fall back. |
|  12.3.1 | TLS for every connection, in and out | Partly | Outgoing calls (S3, Azure) use HTTPS. In `deploy/`, PostgreSQL is reached over Docker's private network without TLS: with a managed database, add `SSL Mode=VerifyFull` to the connection string. |
| 12.3.2 | TLS clients validate certificates | Met | .NET validates every certificate; the app turns none of that off. |
| 12.3.3 | TLS between internal HTTP services | N/A | The app is one service; the proxy reaches it over a private network. |
| 12.3.4 | Internal certificates trusted explicitly | N/A | As 12.3.3. |

## V13 Configuration

| # | Requirement | Status | How |
|---|---|---|---|
|  13.1.1 | Document all communication needs | Met | [Deployment](./deployment.md) lists the services the app uses and their settings; webhooks are the only addresses users choose. |
|  13.1.1 | Document all communication needs | Met | [Deployment](./deployment.md) lists the services the app uses and their settings; users can't give it addresses to call. |
|  13.2.1 | Backend connections authenticated, without unchanging shared credentials | Yours | PostgreSQL and SMTP use passwords from configuration. Prefer your cloud's managed identities (Azure, AWS IAM) for the database and storage where you can. |
|  13.2.1 | Backend connections authenticated, without unchanging shared credentials | Yours | PostgreSQL uses a password from configuration. Prefer your cloud's managed identities (Azure, AWS IAM) for the database and storage where you can. |
| 13.2.2 | Least privilege for backend accounts | Yours | The app needs to create its tables at startup. Once deployed, you can run it with a database role that owns only its own schema. |
|  13.2.3 | No default credentials | Met | `deploy/` makes you set every password; the app refuses the development signing key. |
|  13.2.3 | No default credentials | Met | `deploy/` makes you set every password. |
|  13.2.4 | Allow-list of outbound destinations | Yours | The app calls fixed hosts (see 13.1.1), plus webhook addresses, which must be public. To enforce it, restrict outbound traffic at the firewall. |
|  13.2.4 | Allow-list of outbound destinations | Yours | The app calls fixed hosts (see 13.1.1). To enforce it, restrict outbound traffic at the firewall. |
| 13.2.5 | Server allow-list for requests and loads | Yours | As 13.2.4. |
| 13.3.1 | Secrets in a secrets manager, not in source | Partly | No secrets are in the source or the image: they come from environment variables (`deploy/.env` on the server) or user secrets in development. A secrets manager (your cloud's key vault) is better than a file on the server. |
| 13.3.2 | Least privilege for secrets | Yours | Limit who can read `deploy/.env` or your key vault. |
| 13.4.1 | No `.git` or source control metadata deployed | Met | The container image holds only the published app. |
| 13.4.2 | Debug modes off in production | Met | Development's exception page and code generation only run in Development; production loads pre-generated code. |
| 13.4.3 | No directory listings | Met | Static files are served without directory browsing. |
| 13.4.4 | No HTTP TRACE | Met | No endpoint answers TRACE. |
| 13.4.5 | Documentation and monitoring endpoints not exposed unless intended | Partly | The OpenAPI document and `/scalar` only exist in Development. `/health/live` and `/health/ready` are public and say only "Healthy" or "Unhealthy"; hide them at the proxy if you'd rather. |

## V14 Data Protection

| # | Requirement | Status | How |
|---|---|---|---|
|  14.1.1 | Sensitive data identified and classified | Partly | The template's own: passwords, codes and tokens (secrets, stored hashed or encrypted), personal data (emails, names, pictures, user content), and files. Classify your app's data as you add it. |
|  14.1.1 | Sensitive data identified and classified | Partly | The template's own: personal data (user content), and files. Classify your app's data as you add it. |
| 14.1.2 | Protection requirements per level | Yours | Decide them for your data: retention, encryption at rest, who can read logs. |
|  14.2.1 | No sensitive data in URLs | Partly | Tokens go in headers and bodies. The exceptions: SignalR's WebSocket takes the access token in the query string, as browsers can't set headers on one (short-lived, and OpenTelemetry redacts query strings); links in emails carry their token to a page that POSTs it; signed file URLs are short-lived. |
|  14.2.1 | No sensitive data in URLs | Met | Nothing sensitive goes in URLs; signed file URLs are short-lived. |
| 14.2.2 | Sensitive data not cached by servers | Met | API responses are `Cache-Control: no-store`. Public pages and assets are cached; nothing personal is. |
| 14.2.3 | Sensitive data not sent to trackers | Met | No analytics unless you set `Analytics:GoogleTagManagerId`, and then only after consent. Don't put personal data in tags. |
| 14.2.4 | Controls as documented for each level | Yours | See 14.1.2. |
|  14.3.1 | Client data cleared at sign-out | Met | Signing out deletes the refresh cookie and clears the access token and cached data from memory in every tab. |
|  14.3.1 | Client data cleared at sign-out | N/A | No sessions. |
| 14.3.2 | `Cache-Control: no-store` for sensitive data | Met | Every API response, unless an endpoint sets its own (signed file downloads, privately, for minutes). |
|  14.3.3 | No sensitive data in browser storage | Met | `localStorage` holds only the theme and whether someone is signed in; the session is in an `HttpOnly` cookie. |
|  14.3.3 | No sensitive data in browser storage | Met | `localStorage` holds only the theme. |

## V15 Secure Coding and Architecture

| # | Requirement | Status | How |
|---|---|---|---|
| 15.1.1 | Remediation time frames for vulnerable components | Yours | Dependabot opens update pull requests weekly. Decide and write down how fast you apply them: for example, critical within days, others within a month. |
| 15.1.2 | Software bill of materials | Yours | `Directory.Packages.props` and the lock files list every package. To publish an SBOM, generate one in your build (`dotnet CycloneDX`, `npm sbom`). |
|  15.1.3 | Document costly functionality and its defences | Met | Uploads, emails, exports and webhooks run as durable background messages with retries; [architecture](./architecture.md) describes them. |
|  15.1.3 | Document costly functionality and its defences | Met | Uploads, emails and exports run as durable background messages with retries; [architecture](./architecture.md) describes them. |
|  15.1.3 | Document costly functionality and its defences | Met | Uploads and background work run as durable messages with retries; [architecture](./architecture.md) describes them. |
| 15.2.1 | Components within remediation time frames | Yours | See 15.1.1. The template's CI fails on known vulnerabilities; run `dotnet list package --vulnerable --include-transitive` and `npm audit` in yours. |
|  15.2.2 | Defences for costly functionality | Met | Background queues, rate limits and size limits (see 2.4.1). |
|  15.2.2 | Defences for costly functionality | Met | Background queues and size limits (see 2.4.1). |
| 15.2.3 | No test code or samples in production | Partly | Tests aren't published. The Todos are a sample feature: replace or remove them before going live, as [adding a feature](./how-to/add-a-feature.md) describes. |
| 15.3.1 | Only needed fields returned | Met | Endpoints return response records, never entities. |
|  15.3.2 | Outgoing calls don't follow redirects | Met | Webhooks never follow redirects. Other calls go to fixed providers. |
|  15.3.2 | Outgoing calls don't follow redirects | Met | Other calls go to fixed providers. |
| 15.3.3 | No mass assignment | Met | Requests bind to records with only the settable fields. |
|  15.3.4 | Client address from trusted proxy headers | Met | See 4.1.3; rate limits and logs use it. |
|  15.3.4 | Client address from trusted proxy headers | Met | See 4.1.3; logs use it. |
| 15.3.5 | Strict types, no type juggling | Met | C# and TypeScript (strict). |
| 15.3.6 | No prototype pollution | Met | The client never merges untrusted objects into others. |
| 15.3.7 | No HTTP parameter pollution | Met | Each parameter has one source (route, query or body), set by the endpoint's signature. |

## V16 Security Logging and Error Handling

| # | Requirement | Status | How |
|---|---|---|---|
| 16.1.1 | Log inventory | Partly | [Observability](./observability.md): logs go to the console and, with OpenTelemetry configured, to your collector; [security](./security.md#security-events-in-the-logs) lists the security events. Retention and access are your logging system's. |
| 16.2.1 | Who, what, when and where in each entry | Met | Timestamp, trace ID and request path on every entry; security events add the user and address. |
| 16.2.2 | Synchronised clocks, UTC | Met | Timestamps are UTC; containers use the host's synchronised clock. |
| 16.2.3 | Logs only go where documented | Met | The console and the OpenTelemetry exporter you configure. |
| 16.2.4 | Logs in a common format | Met | OpenTelemetry's log format, or the console. |
|  16.2.5 | Sensitive data logged according to its level | Met | No passwords, tokens or codes are logged; links with tokens are never stored or logged. |
|  16.2.5 | Sensitive data logged according to its level | Met | Nothing secret is logged. |
|  16.3.1 | Authentication logged, success and failure | Met | Sign-ins (user, session, method) and refused sign-in requests (`Security/SecurityEvents.cs`); Identity logs lockouts. |
|  16.3.1 | Authentication logged, success and failure | N/A | No authentication. |
|  16.3.2 | Failed authorisation logged | Met | Every 403 is logged with the user and address. |
|  16.3.2 | Failed authorisation logged | Met | Every 403 is logged with the address. |
|  16.3.3 | Security events and bypass attempts logged | Partly | Refusals, rate limits and reused refresh tokens are logged. Validation failures (400) aren't, as they're mostly honest mistakes. |
|  16.3.3 | Security events and bypass attempts logged | Partly | Refusals are logged. Validation failures (400) aren't, as they're mostly honest mistakes. |
| 16.3.4 | Unexpected errors logged | Met | Unhandled exceptions and failed messages are logged with their trace; failed messages are kept for the back office. |
| 16.4.1 | Logs encoded against injection | Met | Structured logging keeps values apart from the message. |
| 16.4.2 | Logs protected from changes | Yours | Your log store's job. |
| 16.4.3 | Logs sent to a separate system | Yours | Configure the OpenTelemetry exporter ([observability](./observability.md)) so logs leave the server. |
| 16.5.1 | Generic error messages | Met | Production errors are ProblemDetails with a trace ID and no details. |
|  16.5.2 | Keeps working when external services fail | Met | Emails, webhooks and other outside calls are durable messages with retries; Have I Been Pwned failing accepts the password. |
|  16.5.2 | Keeps working when external services fail | Met | Emails and other outside calls are durable messages with retries; Have I Been Pwned failing accepts the password. |
|  16.5.2 | Keeps working when external services fail | Met | Outside calls (file storage) are retried, as durable messages where they run in the background. |
| 16.5.3 | Fails securely | Met | Failures roll back the transaction; authorisation fails closed. |

## V17 WebRTC

| # | Requirement | Status | How |
|---|---|---|---|
| 17.1.1 – 17.3.2 | TURN, media and signalling servers | N/A | No WebRTC. |
