Azure Application Gateway security
This page describes the security controls on the gateway: what protects each hop, what is exposed on purpose, and what is still target state. The rules are in the guidelines, and the gaps are in implementation.
Controls by hop
| Hop | Control | State |
|---|---|---|
| Client to Front Door | Platform WAF, managed TLS, security headers | Enforced. See Front Door security |
| Front Door or client to gateway | DDoS protection on the public IP, NSG, TLS 1.2 or later | Enforced. NSG is broader than the target |
| Gateway listener | Wildcard certificate, HTTPS only, no HTTP listener | Enforced |
| Gateway to backend | HTTPS 443 with the backend FQDN as host and certificate name | Enforced |
| Backend | App Service and storage restricted to the gateway subnet, APIM and SignalR validate tokens | Mostly enforced. APIM network restriction is to be verified |
| Authorization | APIM validates the caller token, the BFF handles the user token | Not done at the gateway |
Network security group
The gateway subnet has its own NSG, nsg-agw-<env>-<region>-01. Rules are defined
in the hub networking stack (hub/networking/nsgs.tf).
| Inbound rule | Why it exists | Guideline |
|---|---|---|
GatewayManager on 65200 to 65535 | Required by Application Gateway v2 for platform management | MUST stay |
AzureLoadBalancer | Required for the Azure load balancer health | MUST stay |
AzureFrontDoor.Backend on 443 | Allows Front Door to reach the gateway | MUST stay |
Internet on 443 | Allows the SignalR WebSocket hostnames and the outage bypass | MUST stay while those paths exist |
Internet on 80 | None. There is no HTTP listener | MUST be removed |
AzureSignalR inbound | Allows the SignalR service to call into the gateway (upstream) | Verify. Remove if nothing uses SignalR upstream calls |
Why the service tag is not enough
The AzureFrontDoor.Backend tag covers every Front Door profile in Azure, not
only ION’s. The NSG cannot tell ION’s profile from any other. ION’s profile is
identified by the X-Azure-FDID header. Today the gateway uses that header only
to decide whether to add security headers. It does not block requests with a
wrong or missing header.
Because the NSG also allows Internet on 443, every agw-* hostname is reachable
without Front Door today. The exception list below describes what is sanctioned. For
all other listeners, enforcing “Front Door only” per listener needs the target-state
WAF custom rule, because an NSG has no per-hostname or per-header rule.
Backend restrictions
| Backend | Restriction to the gateway |
|---|---|
| App Service SPA hosts | Access restriction allows the gateway subnet (agwsbn) through the Microsoft.Web service endpoint. Priority-2 rules for Front Door and rules for engineers are on the same host |
| Storage backends (attachments, initiatives) | Network rules allow the gateway subnet through the Microsoft.Storage service endpoint. Shared keys are off and access uses Entra RBAC or user-delegation SAS |
| Static Web Apps | Configured in the SWA repositories (Front Door gap list) |
| APIM | Public gateway endpoint. Protected by token validation and policy. Verify whether it checks X-Azure-FDID for the priority-2 path |
| Azure SignalR Service | Public service endpoint. Protected by the access token that the shell BFF issues |
ZPA is used only by engineers who reach these resources. It is not part of the runtime path from the gateway to its backends.
TLS and certificates
| Item | Configuration |
|---|---|
| Listener protocol | HTTPS only on 443. There is no HTTP listener |
| SSL policy | AppGwSslPolicy20220101S (minimum TLS 1.2). Later predefined policies are allowed. TLS 1.0 and 1.1 are not |
| Backend protocol | HTTPS on 443 for every backend |
| Backend certificate check | Host header and certificate name are the backend FQDN. Backends present publicly trusted certificates, so no trusted-root configuration is needed |
| HTTP/2 | Enabled |
| Listener certificate | The platform wildcard certificate in Key Vault, referenced by a versionless secret ID so rotation needs no gateway change |
- The gateway identity MUST be a dedicated user-assigned managed identity with
Key Vault Secrets Userscoped to the certificate secrets. Today it uses the platform-wide identityid-ion-<env>-chn-01, which has more access than the gateway needs. This is a gap. - A module-level certificate input that pins a certificate version, and any trusted-root certificate configuration, belong to paths that no longer exist. They SHOULD be removed from the stack and the module so a stale version cannot stay in use.
- Certificate expiry MUST raise an alert. Renewal is a Key Vault operation, and the gateway picks up the new version automatically.
- Front Door connects to
agw-*hostnames over HTTPS. It does not validate the gateway certificate name today (see the Front Door TLS rules).
Headers and CORS
Front Door adds security headers on the normal path. The gateway adds them only when the request did not come through ION’s Front Door, so the bypass and the exception paths are covered. The model is in architecture.
| Header | Value |
|---|---|
Strict-Transport-Security | max-age=31536000; includeSubDomains; preload |
X-Frame-Options | SAMEORIGIN |
X-Content-Type-Options | nosniff |
Referrer-Policy | strict-origin-when-cross-origin |
Permissions-Policy | Per-app restrictive policy |
Content-Security-Policy | Variant per app class (mfe, alya, default, bondi) |
X-Xss-Protection | Present today. The header is deprecated and SHOULD be removed |
CORS
The gateway sets CORS only for hostnames that browsers reach directly, which
are the exception paths. Origins are an explicit allow-list of exact https:// origins.
Wildcards are not allowed.
Current configuration has several issues that the guidelines remove:
- The global
gateway-rewrite-rulesetallows four origins: the portal, Roadie, the Alya portal, and the docs site. The list is maintained by hand in the hub stack. Access-Control-Allow-Credentialsis set to a fixedtrueand is not derived from the matched origin.- The
Access-Control-Allow-Headersrule is marked# TODO: FIX. It listsX-Shell,X-Capabilities,ocp-apim-subscription-key, and others. It should list only the headers that browsers actually send to that hostname. - Per-app rules duplicate the Alya shell origin for MFE remotes. A change to the shell hostname needs a change in every app file.
Every Front Door CORS or header rule MUST have a gateway mirror, and parity is part of the PR checklist (guidelines).
Exceptions
Only these paths may reach the gateway without Front Door. Each is sanctioned by ADR-0015.
| Exception | Hostnames | Controls on the path | Missing |
|---|---|---|---|
| SignalR WebSocket | agw-alya-sigr, agw-alya-shell-sigr | DDoS protection, TLS 1.2, SignalR access token from the shell BFF (user-scoped, short-lived), security headers added by the gateway | WAF, Front Door edge |
| Front Door outage bypass | The agw-<app>-webapp hostnames of bypass-capable portals and agw-api | DDoS protection, TLS 1.2, Entra sign-in, APIM token validation and rate limits, security headers added by the gateway | WAF, Front Door edge |
The bypass is a human change. When Front Door is down, an incident commander approves it and CPE enables direct access for the declared incident. Today the NSG already allows it. See the Front Door runbook.
Query-string tokens on the SignalR hostnames
Target-state WAF
Application Gateway WAF is a roadmap item. It starts where the gateway has the least protection today.
| Phase | Scope | Notes |
|---|---|---|
| 1 | SignalR WebSocket and outage-bypass listeners | Detection mode first, with WAF logs to the Switzerland North workspace. WAF needs the WAF_v2 SKU, so plan the SKU change as a gateway-wide change through all four environments |
| 2 | Same listeners | Prevention after exclusions are tuned. Exclusions are per listener, narrow, and added by PR |
| 3 | Every other listener | Custom rule that blocks a missing or wrong X-Azure-FDID. This enforces Front Door-only access that the NSG cannot |
Until phase 3, documents and dashboards MUST NOT describe the gateway as Front Door-only.
Identity and access
- The gateway has a user-assigned managed identity for Key Vault. It has no other Azure permissions.
- Changes to the gateway go through IaC and Runway by CPE. Portal write access is limited to break-glass roles.
- Rewrite rules MUST NOT add credentials, keys, or secrets to requests, and rules that set trusted headers MUST overwrite client-supplied values.
Logging
Diagnostic settings are applied through Azure Policy. Access, performance, and firewall (when WAF exists) logs go to the Switzerland North Log Analytics workspace. Access logs contain the client IP, host, URI, user agent, backend, and timings, so read access to the workspace is controlled like any other security log.