healthclaw-guardrails: agent guardrails in front of Aidbox - #43
Open
aks129 wants to merge 1 commit into
Open
Conversation
Aidbox holds the record. An AI agent talks to a guardrail proxy in front of it, and the proxy enforces four things the FHIR authorization model does not express: redact on read, audit every access, step up on writes, and hold anything irreversible for a human. The Aidbox side is ordinary, which is the point — the layer is additive, and Aidbox still holds the complete, fully-identified record. Companion to an article written with Health Samurai. scripts/walkthrough.sh runs the six steps and FAILS LOUDLY when a property does not hold, rather than printing OK whatever happens: 0. the proxy is in upstream mode and Aidbox refuses anonymous callers 1. the same Patient identified from Aidbox and redacted through the proxy 2. the read left an AuditEvent, and the AuditEvent carries no PHI 3. a write, and two gates that do not substitute for each other 4. the guardrail conformance grade for this deployment 5. the MCP tool surface: 401 unauthenticated, 27 tools authenticated Step 3 is a four-row matrix rather than two refusals in sequence, because a sequence only shows that SOME refusal happened. Presented alone, a human confirmation is not a credential (401) and a credential is not a confirmation (428); only both write (201). The write is then confirmed by querying Aidbox directly — the proxy reporting its own 201 says nothing about storage. Step 4 reports B (6/7), not A, and says why. In upstream mode the error fidelity property measures how Aidbox answers an unknown search parameter rather than how the guardrail does, so it is stated rather than graded away. The assertion is that every OTHER property holds, which stays correct when that gap closes. qa/ contains a Playwright harness that asserts the same properties from a browser and records the run, so the recording and the assertions come from the same requests. Verified end to end against Aidbox edge on the published images.
Author
|
Adding what was actually run, so reviewers can see where the claims come from and where they stop. Verified end to endAgainst Step 1, verbatim from that run: The What is deliberately not claimed
Three setup traps that are handled rather than left for the readerEach one cost a debugging session here, and each presents as something other than its cause:
Happy to restructure, rename, or split anything to fit the repo's conventions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
aidbox-integrations/healthclaw-guardrails/— Aidbox as the system of record, with a guardrail proxy in front of it enforcing four things the FHIR authorization model does not express: redact on read, audit every access, step up on writes, and hold anything irreversible for a human.Nothing about the Aidbox side is unusual, and that is the point. The layer is additive; Aidbox keeps behaving like a FHIR server and still holds the complete, fully-identified record. Companion to an article written with Health Samurai.
What it demonstrates
scripts/walkthrough.shruns six steps and fails loudly when a property does not hold, rather than printing OK whatever happens:Step 1, live:
Step 3 is a four-row matrix rather than two refusals in sequence, because a sequence only shows that some refusal happened:
X-Human-ConfirmedX-Step-Up-TokentruetrueThe write is then confirmed by querying Aidbox directly — the proxy reporting its own 201 says nothing about storage.
Two things stated rather than smoothed over
The grade is B (6/7), not A. In upstream mode the error-fidelity property measures how Aidbox answers an unknown search parameter (404/502) rather than how the guardrail does. Step 4 asserts that every other property holds, so the assertion stays correct on the day that gap closes. Tracked as HealthClawGuardrails#498.
The human-confirmation header is set by the caller, so it evidences a human the way a checkbox does. It is documented as a compensating control, not proof. The README's What this example does not show section covers this and two others.
Notes for reviewers
BOX_LICENSEis passed through as a bare env key, deliberately: an empty licence is worse than a missing one — Aidbox refuses to boot with "License is invalid ... not in correct format" — so absent from.envmeans absent from the container. With it unset,docker compose up -dwaits on Aidbox's health check while you click Continue with Aidbox account, then starts the proxy on its own.curl -f. An unactivated Aidbox answers/healthwith a 302 to its activation page, andcurl -fonly fails on 4xx/5xx — so the obvious check reports an unactivated Aidbox as healthy.MCP_AUTH_TOKENand refuses to start without one.MCP_PUBLIC_DEMO=trueis the documented alternative and is deliberately not used here.qa/holds a Playwright harness that asserts the same properties from a browser and records the run, so the recording and the assertions come from the same requests.Verification
Run end to end against
healthsamurai/aidboxone:edgeon the publishedghcr.ioimages — all six steps green, including a freshdocker compose pullto confirm the pinned tags resolve.Guardrail proxy is MIT: https://github.com/aks129/HealthClawGuardrails