Skip to content

Record the Cloud Armor rules that refuse requests without a credential - #4322

Merged
anth-volk merged 2 commits into
masterfrom
docs/cloud-armor-edge-refusal
Nov 17, 2026
Merged

anth-volk merged 2 commits into
masterfrom
docs/cloud-armor-edge-refusal

Conversation

@anth-volk

@anth-volk anth-volk commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #4323
Fixes #4231

Summary

Records the Cloud Armor change of 2026-11-17 on pol-api-lb, the policy on api.policyengine.org's load balancer. Documentation and snapshots only: the policy was changed with gcloud, as the runbook describes, and this pull request changes no code or deployment.

  • Rules 770–772 (allow): GET and HEAD /health, GET /v2/openapi.json, and CORS preflights (OPTIONS with Origin and Access-Control-Request-Method). These are the Public API's public routes (PUBLIC_ROUTES and is_public_request in policyengine_api/request_caller.py).
  • Rule 800 (deny(403)): requests with no Authorization header, or one of only spaces and tabs. The Public API already refuses these with 401 since PUBLIC_API_SERVER_CREDENTIAL_REQUIRED=1; the load balancer now refuses them before they reach Cloud Run.

Changes

  • docs/migration/armor/20261117T105602Z-pol-api-lb-edge-refusal-preview.yaml: the policy after rules 770–772 and log-only rule 800 were added.
  • docs/migration/armor/20261117T130329Z-pol-api-lb-edge-refusal-enforced.yaml: the policy after rule 800 was enforced (the current state).
  • docs/migration/lb-cloud-armor-runbook.md:
    • a section on rules 770–800: what callers through api.policyengine.org now see (Google's 403 page, not the Public API's 401 with WWW-Authenticate: Bearer), keeping rules 770–772 matched to the Public API's public routes, using rule 800 only while enforcement is on, CORS preflights no longer counting toward the per-address limits, the blank-header pattern Cloud Armor accepts, the 2-hour preview, and how to check and roll back;
    • the summary table: rule 1100 (calculate throttle) was enforced on 2026-11-09 at 15:01 UTC, though the table still said preview (Record that Cloud Armor now enforces the /calculate rate limit #4231);
    • the note on preview validation, which said throttle rules in preview only log CONFORM; rule 1100's preview logged RATE_LIMIT_THRESHOLD_EXCEED for 29,037 of 162,011 matching requests (Record that Cloud Armor now enforces the /calculate rate limit #4231). The 2026-11-10 snapshot already shows rule 1100 enforced, so Record that Cloud Armor now enforces the /calculate rate limit #4231 needs no new snapshot;
    • the rule 900 notes, which described the Public API serving requests without a credential.
  • changelog.d/cloud-armor-edge-refusal.changed.md.

Behavior change for callers

Through api.policyengine.org, a request without a credential outside the public routes now gets 403 with Google's HTML page, not the Public API's 401 JSON. Requests to the *.run.app URLs skip the load balancer and still get the Public API's 401. Requests with any non-blank Authorization header pass the load balancer, and the Public API validates them as before.

Verification

  • Rule 800 ran in preview for 2 hours (2026-11-17 10:48–12:48 UTC). It would have refused 264 requests, and the Public API had answered every one with 401.
  • After enforcement (first 403 at 13:00:47 UTC), without a credential through api.policyengine.org: /, /no-such-path, /us/metadata, POST /us/calculate, /v2/model-catalog, /deployment and /v2/me got 403; GET and HEAD /health, /v2/openapi.json and a CORS preflight got 200. Authorization: Bearer made-up got the Public API's 401, and a blank header got 403. The same checks against the *.run.app URL got the Public API's 401.
  • The load balancer log shows enforcedSecurityPolicy.priority=800 with outcome DENY only for requests without a credential.
  • The website and calculator-app servers were still served after enforcement (/us/calculate and /us/metadata, 200).
  • No tests were run: this pull request changes only Markdown, YAML snapshots and a changelog fragment.

🤖 Generated with Claude Code

Adds the exported snapshots of pol-api-lb from 2026-11-17: after rules
770-772 and log-only rule 800 were added, and after rule 800 was enforced.
Rule 800 answers 403 at the load balancer to requests with no Authorization
header, or a blank one, outside the Public API's public routes, which rules
770-772 allow first. These are requests the Public API refuses with 401 since
PUBLIC_API_SERVER_CREDENTIAL_REQUIRED=1.

The runbook gets a section on these rules: what callers through
api.policyengine.org now see (Google's 403 page, not the Public API's 401),
keeping rules 770-772 matched to the Public API's public routes, using rule
800 only while enforcement is on, preflights leaving the per-address limits,
the accepted blank-header pattern, the 2-hour preview, and how to check and
roll it back. It also corrects the summary table, where the calculate throttle
(rule 1100) has been enforced since the 2026-11-10 snapshot, and updates the
rule 900 notes that described the Public API serving requests without a
credential.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The runbook's summary table said rule 1100 (the calculate throttle) stays in
preview; it was enforced on 2026-11-09 at 15:01 UTC, after the partner API
fallback that kept it in preview was removed in July 2026. The note on
preview validation said throttle rules in preview only log CONFORM; rule
1100's preview logged RATE_LIMIT_THRESHOLD_EXCEED for 29,037 of 162,011
matching requests in the 30 days before it was enforced.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.67%. Comparing base (6dd46da) to head (55fa5e8).
⚠️ Report is 20 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4322   +/-   ##
=======================================
  Coverage   93.67%   93.67%           
=======================================
  Files         397      397           
  Lines       22831    22885   +54     
  Branches     3589     3633   +44     
=======================================
+ Hits        21387    21438   +51     
- Misses        840      845    +5     
+ Partials      604      602    -2     
Flag Coverage Δ
integration 57.69% <ø> (+0.06%) ⬆️
unit 90.95% <ø> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@anth-volk
anth-volk merged commit 32e122e into master Nov 17, 2026
23 of 24 checks passed
@anth-volk
anth-volk deleted the docs/cloud-armor-edge-refusal branch November 17, 2026 14:57

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Record the Cloud Armor rules that refuse requests without a credential Record that Cloud Armor now enforces the /calculate rate limit

1 participant