Engineering Notes · Cloud Security · 2026-11-10

Continuous Deny-by-Default Probing: Catching Cloud Rule Regressions Within 60 Seconds of Deploy.

Security rules-as-code (Firestore rules, Realtime Database rules, bucket IAM, RPC authorization guards) share one failure mode: they compile, they deploy, and they silently change behavior. The only signal you can trust is an actual unauthenticated request against the deployed configuration.

Posted 2026-11-10 · 12 min read · Companion harness: Silvauren/cloud-unauth-probe (staging)

TL;DR Model your unauthenticated attack surface as a set of state-transition invariants: for every deployed probe, the response class must never move from a deny state (401/403) to a success state (2xx), and the body must never contain protected bytes. Run the full probe set as a post-deploy gate and you catch rule regressions in under a minute, without touching authenticated test paths.

The problem: rules pass review and still regress

Unit tests for authorization logic almost always mock the enforcement layer. A Firestore rules file that compiles cleanly can still widen access: a refactored match block, a renamed field that turns a resource.data check into a no-op, an IAM condition dropped during a Terraform refactor. None of these fail your build. All of them fail your users.

Reviews catch intent; they do not catch state. What you need is a measurement of the deployed deny surface, taken continuously, where the only accepted inputs are the same ones an anonymous internet client would send.

Deny-by-default as a state machine

Define a finite set of probes P. Each probe is an unauthenticated HTTP request against a deployed resource, with a declared expected class:

ClassMeaningVerdict contribution
DENY_AUTH401, no/invalid credentials presentedPass
DENY_RULES403, authenticated-or-not, policy deniesPass
LEAK2xx, or any response whose body contains protected bytesFail (critical)
TRANSIENT5xx, 429, timeoutsRetry, then inconclusive

The invariant is on transitions between consecutive deploys, not on absolute values. A probe moving DENY_AUTH → DENY_RULES is fine (tightening). A probe moving any deny class → LEAK is a regression. A probe moving LEAK → deny is a fix; record it, alert softly, move on. This transition framing matters because expected classes differ per probe and per surface, the manifest declares them, the executor only enforces monotonicity of denial.

What each surface actually returns

The expected class is empirical, not aspirational. Current deployed behavior, verified 2026-11:

SurfaceAnonymous requestObservable signal
Firestore (REST v1)403 with PERMISSION_DENIED status in the JSON body when rules deny; 401 UNAUTHENTICATED when a token is required and absenterror.status in body distinguishes the two deny classes
Realtime Database (REST /.json)401 with a permission-denied payload stringStatus line plus body text
Object storage (XML/API GET on private object)403 Forbidden; some providers 404 when existence is hiddenNeither may ever carry object bytes; both are acceptable deny classes, declared per probe
Callable / RPC endpointExplicit guard returns 401/403; a missing guard returns 200 with data2xx on an anonymous callable is the single most common leak shape
Deny-class variation (401 vs 403 vs 404) is why the manifest is declarative. Hard-coding "must be 401" produces false alarms the moment a provider tightens semantics.

A probe manifest

probes:
  - id: firestore-userdoc-unauth
    request:
      method: GET
      url: https://firestore.googleapis.com/v1/projects/${PROJECT}/databases/(default)/documents/users/alpha
    expect_class: DENY_RULES     # or DENY_AUTH, declared, not assumed
    body_must_not_contain: ["@gmail", "phoneNumber", "displayName"]

  - id: rtdb-root-unauth
    request:
      method: GET
      url: https://${PROJECT}-rtdb.firebaseio.com/.json
    expect_class: DENY_AUTH

  - id: bucket-object-unauth
    request:
      method: GET
      url: https://storage.googleapis.com/${BUCKET}/exports/2026-11.csv
    expect_class: DENY_RULES
    body_must_not_contain: ["BEGIN PRIVATE KEY"]

  - id: callable-adminExport-unauth
    request:
      method: POST
      url: https://us-central1-${PROJECT}.cloudfunctions.net/adminExport
      json: {}
    expect_class: DENY_AUTH      # 200 here means the guard is missing

The body_must_not_contain list is the second, independent invariant: even a response the classifier calls a deny must not echo protected bytes (some providers return partial context in error envelopes).

The executor, and why transients cannot cause false LEAKs

Classification is conservative by construction: only a 2xx status (or a body invariant hit) can ever be a LEAK. A 500 storm, a 429 from quota, a TLS timeout, none of them are leaks, so the worst a transient can do is leave a probe inconclusive. That yields a three-valued gate:

def classify(resp, probe):
    if resp is None:                       # timeout / connect error
        return "TRANSIENT"
    if 200 <= resp.status < 300:
        return "LEAK"
    if any(s in resp.text for s in probe.body_must_not_contain):
        return "LEAK"                      # bytes leaked inside an error envelope
    if resp.status == 401:
        return "DENY_AUTH"
    if resp.status == 403 or resp.status == 404:
        return "DENY_RULES"                # 404 existence-hiding is declared per probe
    if resp.status >= 500 or resp.status == 429:
        return "TRANSIENT"
    return "UNEXPECTED"                    # 3xx/4xx oddities surface as review items

def gate(probes, prev_state, new_state, budget_s=25):
    for p in probes:                       # concurrency 8, jittered start
        cls = retry_until(p, klass="stable", budget=budget_s)
        if cls == "LEAK" and prev_state[p.id] != "LEAK":
            return exit(10)                # regression: deny -> allow
        if cls == "LEAK" and prev_state[p.id] == "LEAK":
            continue                       # known hole, tracked elsewhere
        if cls == "TRANSIENT":
            return exit(20)                # inconclusive: hold, do not pass
    return exit(0)

Exit-code semantics keep CI honest: 0 pass, 10 regression (page, block promotion), 20 inconclusive (a hold, never a pass, silence must not be interpreted as safety).

The 60-second budget

PhaseBudgetNotes
Deploy webhook → probe job start≤ 3 sPost-deploy hook, not a cron poll
DNS + TLS warm (connection reuse)≤ 5 sOne session per host, keep-alive
Probe execution (120 probes, concurrency 8)≤ 25 sPer-probe timeout 3 s, jittered start ±100 ms
Retry envelope (transients only)inside the 25 sBackoff 250 ms → 1 s → 4 s, capped at 3 attempts
Verdict + status report≤ 5 sSARIF for the run; single summary row per probe

Rewriting it as one probability: with per-attempt transient probability q, three attempts leave an unresolved-transient probability of q3. At q = 0.05 that is 1.25 × 10-4 per probe, the hold path exists for exactly this residue, and it holds rather than passes.

What this does not do

Unauthenticated probing does not replace authenticated abuse testing, business-logic review, or load-shaping tests. It answers one question with high sensitivity: did the anonymous deny surface just shrink? In practice that is the question your users' regulators, and your incident reviewers, ask first.

Status

The manifest format, classifier, and transition-state store described here are being packaged as Silvauren/cloud-unauth-probe a dependency-light runner suitable for a CI post-deploy hook. We publish the technique now because every team running rules-as-code deserves a deny-surface regression alarm that is cheaper than their incident review.