Skip to content

Implementation plan / Session plan / Handover RC-1-S28-F24

Handover RC-1-S28-F24 Fix: The gateway audits ise.gateway.denied without the decision identifier and policy version, so it is quarantined

Card: RC-1-S28-F24. Issue: cema-care/his#276. Branch: session/RC-1-S28-F24. Slice: RC-1. This is a round 2 fix of the gate session RC-1-S28-G2. The unit belongs to RC-1-S12. No new decision record: the marker's shape is ADR-HIS-101, and this change follows it in one more emitter.

The failure

From the issue's first comment, the gate's evidence (run 20261201T000308Z-fa9c, audit-quarantine.csv): the audit service quarantined 12 ise.gateway.denied events from gateways. The errors were /decisionId and /policyVersion "is required for authorization and emergency access (D10-ESS 9.5)".

The cause in the code: denied_event in apisix/lua/apisix/plugins/his-gateway.lua audits every refusal with outcome denied. It passes the decision when there is one, and nil otherwise. With nil, the event carried neither the decision nor the marker. The ruling on cema-care/his#220 requires an event with no decision to state that, using audit.v1 1.2's decisionUnavailable: true. The intake half was merged with RC-1-S28-F14. What was left was the emitter.

The gateway refuses without a decision in three places. Only the first is in the gate run, and only the first is covered by the ruling on #220:

  • The decision service is unavailable. This covers no answer, a 5xx, an unreadable answer, an open circuit, or no service token. It includes the external channel, a restricted read, a write, a stale cache and the downtime prompt. These are the gate's 12 events, all under the run's 25 s decision times.
  • The decision service refused the request with a 400, 401 or 403. That is not a decision, so the gateway treats it as Deny.
  • The purpose of use is not one the client is registered for (FR-ISE-GWY-001 part 7). The gateway refuses this before it asks for a decision.

What was changed and where

Only platform/gateways:

  • apisix/lua/apisix/plugins/his-gateway.lua: denied_event has a new argument, outage. The two outage refusals of the degraded path pass it (external and patient-data requests failing closed; internal requests denied on the degraded path), and their events carry decisionUnavailable: true. Every other refusal is unchanged. A denial on a decision carries decisionId and policyVersion and no marker. The two refusals that have no decision but are not outages (a purpose not registered for the client, a request the decision service refused) still carry neither. They wait for the question on #276 (review round 1, below).
  • apisix/lua/his/audit.lua: event writes decisionUnavailable only as true, and leaves it out otherwise (ADR-HIS-101 point 4).
  • rendered/reference/lua/…: the two files rendered again (bin/gateways render --env reference).
  • test/testbed/fakes.py: the fake decision service has a refuse mode (403, no decision).
  • test/testbed/test_gateway.py: the new and extended tests below.
  • Review round 2 (the pipeline failed): T11PolicyOutage.test_b_policy_service_outage got a 503 on its cached read on the self-hosted runner, at a step before anything this change touches. The test bed keeps a stored Permit for 8 s. Between storing it and the cached read, the test made two control calls into the fake decision services (docker exec) and an external request, which on a loaded runner took longer than that. The fix:
  • the cached read now comes straight after the outage starts;
  • test/testbed/env/testbed.toml.in keeps a stored Permit for 20 s instead of 8 s, and gives the downtime prompt at 30 s instead of 20 s, so the prompt still comes after the stale-cache check;
  • the test's waits and the README follow.

Production values (60 minutes, 15 minutes) are unchanged.

Re-run on this host: - at a load average of 86 to 95, T11 passed, while T01 (a 3 s probe timeout) and T08 (a unit's circuit window) failed on timing; this change touches neither; - at a load average of 44 to 68, all 53 passed. - README.md: the audit table says when the marker is sent.

No contract, dependency, lockfile, model or setting changed. Requests are answered exactly as before. Only the audit event of a refusal changed.

Checks and their result

Run as HIS_SESSION=RC-1-S28-F24 (his-rc-1-s28-f24), in platform/gateways:

Check Command Result
The new tests with the plugin as on main (round 0) The test bed with his-gateway.lua and audit.lua as on main, running the decided-Deny, no-decision, outage and T12 tests (a scratch runner that calls testbed.Bed and these tests) The outage test fails on the gate's defect: AssertionError: None is not True for decisionUnavailable on the outage denials. T12 passed there only because its wait timed out with no marked event. It now asserts that one was sent, which fails on main for the same reason
Model and rendering bin/gateways check; bin/gateways render --env reference --check Passed. The model has 277 routes, and the rendered files are current
The owning session's tests, after the repair python3 test/run.py (unit tests, then the test bed on the session's environment) 53 of 53 passed after review rounds 1 and 2: 21 unit tests and 32 test bed tests, TEST-ISE-007 and TEST-ISE-039 among them
Static analysis, secret scan platform/delivery-pipeline/bin/static-analysis platform/gateways; platform/delivery-pipeline/bin/secret-scan code origin/main HEAD Passed: "static analysis: no blocking finding", and "secret scan (code): no secret found" in both the files and the commits
Slice scenario HIS_SESSION=RC-1-S28-F24 e2e/harness/scenario run e2e/scenarios/RC-1 --fresh --strict Did not run, twice; deferred to RC-1-S28-G3. Run 20261201T090635Z-b96b (commit c3552147) stopped at his-env start full: "application not healthy after 7m0s" (Kafka). Run 20261201T103416Z-a1f3 (review round 1) started the environment, but ess-audit did not become ready in the harness's time. Its log has no error; it was still starting when the harness stopped it. CPU steal was 68% during both runs
Documentation python3 docs/implementation_plan/tools/check_links.py; .venv/bin/mkdocs build 0 broken links, 0 duplicate anchors. The site builds. Its one warning is a link in RC-1-S12's handover that was already there

The slice scenario was attempted twice. It did not reach a case either time, for the reason RC-1-S28-G2 and RC-1-S28-F22 report on this shared host: under the hypervisor's steal (68% in both runs), the full profile and the units cannot start within the harness's time. At that level the gate's own run got 1 of 15 cases, with every other case stopping on a fail-closed 503. So this session cannot show the scenario's tests passing, and the card's "Ends when" is shown only by the unit's tests. Showing it is left to the next gate round, RC-1-S28-G3, on a host with dedicated CPU, and is listed under "Needs a person" in the pull request. Nothing in this change answers or refuses a request differently. It changes only the audit event of an outage refusal, which no scenario step asserts on except through the quarantine. The environment his-rc-1-s28-f24 was reset after each run.

ci.sh's other steps (the contract catalogue's checker and build) cover code this change does not touch. They were not run here. The pipeline runs them.

What the gate line now shows

The line is criterion 6 (ACC-005), the IF-ESS-008 audit intake, and criterion 4, FR-ESS-AUD-001, "every action audited, nothing quarantined", of slice gate RC-1. Its check is the audit quarantine (mod_ess_006.quarantine_entry in ess_audit) after the slice run.

ise.gateway.denied from gateways Before (main) With this change Shown by
Outage refusals (the gate's 12) Quarantined: no /decisionId and /policyVersion Stored: outcome denied and decisionUnavailable: true, with no decision. ess-audit's intake waives the decision for authorization and emergency access on that marker (ADR-HIS-101 point 6). The type is not patient-scoped, and the category requires nothing else T11PolicyOutage.test_b_policy_service_outage fails on main and passes now. The intake half is AuditIntakeTest.refusalWithoutDecision in services/ess-audit (RC-1-S28-F14, merged), which stores ise.gateway.denied with the marker
Refusals by the decision service, and purposes not registered for the client (none in the gate run) Would be quarantined: no decision Unchanged: still would be quarantined, pending the question on #276. If it occurs, the gate will show it as gateways ise.gateway.denied with /decisionId errors T05PolicyDecision.test_marker_only_on_an_outage_refusal (no marker is sent on them)
Denials on a decision Stored Unchanged: decision identifier and policy version, no marker, which the intake would otherwise reject (ADR-HIS-101 point 7) T05PolicyDecision.test_deny_returns_no_data
What is sent, against audit.v1 1.2 — No stub violation, with an outage refusal carrying the marker among the events replayed T12Contracts.test_what_the_gateway_sent_to_domain_10_meets_its_contracts

The next gate round, RC-1-S28-G3, should find no gateways event in the quarantine from outages, however many its run has. A non-outage refusal without a decision would still be quarantined until #276 is answered. Neither cause occurred in round 2. The line as a whole passes only when this round's other emitter fixes are merged as well (F22, F23 and F25 to F28).

Requirements and test scenarios of the card

The card has no requirement of its own. It repairs the gateway's part of the gate line. The tests are in platform/gateways/test/testbed/test_gateway.py, and their docstrings carry the identifiers that test/run.py writes into test/out/results.json.

Requirement Test What it shows
FR-ESS-AUD-001 and IF-ESS-008, with D10-ESS 9.5 and the ruling on #220; FR-ISE-GWY-001 behaviour 8; TEST-ISE-007 T05PolicyDecision.test_marker_only_on_an_outage_refusal (new) A purpose the client may not use, and a decision service that refuses the request (403), are each refused 403. Each is audited once as ise.gateway.denied, denied, with no decision and no marker: the ruling covers outages only
FR-ISE-GWY-001 part 10, PR-GWY-001-2; TEST-ISE-039; FR-ESS-AUD-001 T11PolicyOutage.test_b_policy_service_outage (extended) During an outage, the external refusal and the refusal through another client each carry the marker and no decision
FR-ISE-GWY-001 AC-05; TEST-ISE-007; D10-ESS 9.5 T05PolicyDecision.test_deny_returns_no_data (extended) A decided Deny carries its decision identifier and policy version (12), and no marker
IF-ESS-003, IF-ESS-008 contract T12Contracts.test_what_the_gateway_sent_to_domain_10_meets_its_contracts (extended) What the gateway sent passes the ESS stub's audit.v1 schema with no violation. An outage refusal with the marker is among the events

Differences from the card, specification or contract

None. In round 0 this session read the ruling's "no decision was obtained" as covering all three paths, and sent the marker on each. Review round 1 pointed out that audit.v1 1.2's description and the ruling on #220 speak of an outage: "the decision point did not answer and the caller failed closed". The marker is now sent on outage refusals only. The other two cases are a question under rule 3, asked on #276.

Questions for a person

  • Slice scenario, deferred to RC-1-S28-G3 (service owner / platform, for the gate host). It did not run on this host in two attempts (above). The scenario's tests still passing is shown by the next gate round, which needs the dedicated host RC-1-S28-G2 asked for.
  • Non-outage refusals without a decision (question on #276), for the Security and Privacy Office with the Domain 10 owner and the owner of D02-ISE. It covers a purpose not registered for the client (refused before any decision) and a decision service that refuses the request (400, 401 or 403). Should decisionUnavailable extend to them (A), should the purpose refusal use another type (B), or should they stay quarantined (C)? Neither happened in the gate run, so this does not hold the gate's line for the 12 events. The gateway sends no marker on them until it is answered. Answering A or B is a small follow-up fix in denied_event.

Follow-ups outside the card

  • The gateway has no test against the real intake. The test bed's audit fake stores every event. It is the test bed's assertions, written from SubmissionValidator's category rules, that show the intake would store them. A test bed case that posts the gateway's events to services/ess-audit would catch a drift between the two. That belongs to the gateway's owner, in a later card.
  • The service template (FN-S03's owner): as RC-1-S28-G2 and F22 record, the template's kit still audits an outage as failure under access-check-unavailable.