Repository navigation
Conversation
Two concurrent steps in a session each read the IFC labels before AGT was awaited and replaced them after, so the later write could drop a label the earlier step added, secret included. Queue steps per session, with the duplicate request_id check in the same queue. Other sessions still run concurrently. Closes GenAI-Security-Project#310 Signed-off-by: Henos D <henosd19@gmail.com>
|
Thanks for this. It is queued rather than ignored. This pull request does not reference an issue carrying If this is an editorial correction, tick that box in the description and this comment stops applying. |
drk-ram
left a comment
There was a problem hiding this comment.
I tested head 9136b7d9301cc3abbef561ecb0e988a88abd439b merged onto integration 1b8f970370011cbcbb491ffbcafff210d62f6fbd on Windows.
Bun 1.4.4 and 1.3.11 both pass bun run typecheck and 39 session-order, IFC-label, and session-context tests. Removing queue ordering fails the secret-label case; sharing one queue across sessions fails the independent-session case. Both mutations fail on both runtimes.
I found an uncovered branch: removing only the inSessionOrder wrapper around steps/toolCallResult still passes both new tests. A slow request followed by a fast result that adds secret then loses that label when the slow request finishes.
Please add a result-gate regression using the same bridge: start echo slow, send a same-session toolCallResult with output read-secret, await both, then send echo after. Assert the last snapshot retains secret. A result/result pair deserves the same check. My separate probes pass with this patch and fail with the result wrapper removed on both runtimes.
Queued duplicate detection and recovery after a failed evaluation also pass my probes. The complete Guardian run is not green: 1.4.4 has the same 13 baseline failures; 1.3.11 reaches the same 120-second timeout.
President
left a comment
There was a problem hiding this comment.
Thanks - I reproduced the bug on integration (the last step saw only public), and with this PR it keeps secret. Looks good to me.
One thing to keep in mind - a step now waits in the queue with no deadline:
- step 1's AGT call takes 6 s, step 2 waits behind it
- the agent stops waiting after 5 s (the declared
timeout_config) and falls into its fail-open posture
This is the README's "Bounded processing" gap, which #312 already tracks for this Guardian. So no need to fix it here - it is one more case for #312.
Removing the queue around steps/toolCallResult left both tests green. Add a result behind a slow request and a result behind a slow result. Signed-off-by: Henos D <henosd19@gmail.com>
|
Thanks, that branch was uncovered. Added the result-gate cases with the same bridge: a slow request then a Checked on macOS with Bun 1.3.11: with only the |
What changed
Steps in one session are now evaluated one at a time, so a step reads the IFC labels the previous step wrote and a concurrent step can no longer drop
secret. The duplicate request_id check runs in the same queue asevaluateStep, so it still sees every earlier step. Steps in different sessions still run concurrently.Which issue does this implement
Closes #310
meaning, so it needs no issue
Base branch
integration, because this touches the specification, schemas, a referenceimplementation, an adapter, tests, or CI
main, because every changed path is on the documentation lane allowlist inCONTRIBUTING.md
Type of change
I tested this
uv run pytest -vpasses on my machineuv run mkdocs build --strictpasses on my machineTypeScript only, so I ran the agt checks, on macOS with Bun 1.3.11:
packages/guardian/test/session-order.test.tsis new. Its first test is the scenario from [Bug] Concurrent steps in one session overwrite each other's IFC labels, so a secret label is lost #310. Onintegrationit fails withReceived: [ "public" ]; with this change it passes. The second test checks that a slow step in one session does not hold back another session.["public","secret"]for the last step in 3 of 3 runs, where it was["public"]in 5 of 5 before.bun run typecheckclean;bun test1285 pass, 4 skip, 0 fail.Trade-off: a step that waits on AGT now holds later steps of the same session until it finishes or the OPA timeout fails it. Other sessions are not affected.
Note: #229 and #346 edit the same region of
server.ts, so whichever lands second needs a small rebase.Checklist
git commit -s(required by the DCO)Security
It closes a path where a label marking secret data was lost between steps, so a later step was evaluated as if the session had never read secret data.