The cleanup of an auto-register pentest session deleted the test user in our own Keycloak realm, through the agent's master-realm admin login (KEYCLOAK_ADMIN_*). It did so whenever the agent had KEYCLOAK_URL, whatever identity provider the target used, and Custom/unknown fell back to it too. It never ran only because the username was never recorded.
Change
Session-scoped access only. New config.auth.cleanup (TestUserCleanup, tagged by provider):
keycloak: base URL, realm, client id/secret. It uses a client-credentials token from that realm, not master.
auth0: domain, client id/secret.
okta: domain, API token.
Secrets are sealed with the other session credentials (Credentials lists them) and redacted from API responses. The URL passes NetGuard::check_url when the session is created, and requests go through the guarded client. KEYCLOAK_ADMIN_USERNAME/_PASSWORD are removed from the agent config.
Found by the session's own address. The test user is looked up by base+{session_id}@domain. It is deleted only when exactly one account carries exactly that address (case-insensitive); the provider's search result alone is not trusted. The prompt now gives the LLM that exact address instead of a {session_id} placeholder.
Recorded. The planned test user is now written to the stored session (before, it existed only in memory, so test_user.cleaned_up landed on an empty record). A user that cannot be deleted gets left_behind with the reason. It is announced in the session stream and named in the report ("Test User … Left behind … delete it by hand").
Firebase and Custom are no longer cleaned up. The variants stay, so older records still read.
Not in this PR: the wizard still has only the "delete test user" checkbox. Without access given through the API, the user is reported as left behind. Wizard fields for the provider access come later.
Tests:
A fake Keycloak checks that the token is requested from the given realm with client credentials, and that only the account with the session's address is deleted.
Several matching accounts → nothing deleted. A search that only resembles the address → nothing deleted.
No access given → nothing asked. An already-deleted user is not asked for again. A missing secret or address leaves the user behind.
planned_test_user, the report row, sealing/redaction of the new secret, and serde for older records.
Run: cargo test -p compliance-core, cargo test -p compliance-agent --lib pentest (81 passed), clippy (CI flags) for core and agent, a dashboard check.
CI will also need #1001 (quinn-udp advisory, which fails cargo audit on every PR right now).
Closes #999. Supersedes #17.
The cleanup of an auto-register pentest session deleted the test user in **our own** Keycloak realm, through the agent's master-realm admin login (`KEYCLOAK_ADMIN_*`). It did so whenever the agent had `KEYCLOAK_URL`, whatever identity provider the target used, and `Custom`/unknown fell back to it too. It never ran only because the username was never recorded.
**Change**
- **Session-scoped access only.** New `config.auth.cleanup` (`TestUserCleanup`, tagged by `provider`):
- `keycloak`: base URL, realm, client id/secret. It uses a client-credentials token from that realm, not master.
- `auth0`: domain, client id/secret.
- `okta`: domain, API token.
Secrets are sealed with the other session credentials (`Credentials` lists them) and redacted from API responses. The URL passes `NetGuard::check_url` when the session is created, and requests go through the guarded client. `KEYCLOAK_ADMIN_USERNAME`/`_PASSWORD` are removed from the agent config.
- **Found by the session's own address.** The test user is looked up by `base+{session_id}@domain`. It is deleted only when exactly one account carries exactly that address (case-insensitive); the provider's search result alone is not trusted. The prompt now gives the LLM that exact address instead of a `{session_id}` placeholder.
- **Recorded.** The planned test user is now written to the stored session (before, it existed only in memory, so `test_user.cleaned_up` landed on an empty record). A user that cannot be deleted gets `left_behind` with the reason. It is announced in the session stream and named in the report ("Test User … Left behind … delete it by hand").
- **Firebase and Custom** are no longer cleaned up. The variants stay, so older records still read.
**Not in this PR:** the wizard still has only the "delete test user" checkbox. Without access given through the API, the user is reported as left behind. Wizard fields for the provider access come later.
**Tests:**
- A fake Keycloak checks that the token is requested from the given realm with client credentials, and that only the account with the session's address is deleted.
- Several matching accounts → nothing deleted. A search that only resembles the address → nothing deleted.
- No access given → nothing asked. An already-deleted user is not asked for again. A missing secret or address leaves the user behind.
- `planned_test_user`, the report row, sealing/redaction of the new secret, and serde for older records.
Run: `cargo test -p compliance-core`, `cargo test -p compliance-agent --lib pentest` (81 passed), clippy (CI flags) for core and agent, a dashboard check.
CI will also need #1001 (`quinn-udp` advisory, which fails `cargo audit` on every PR right now).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
The cleanup of an auto-register session deleted the test user in
Prüfwerk's own Keycloak realm, through the agent's master-realm admin
login, whatever identity provider the target used. It never ran only
because the username was never recorded.
- Cleanup acts only on admin access given for the session
(`config.auth.cleanup`: Keycloak realm client, Auth0 M2M app, Okta
token), sealed like the other session credentials and checked by the
net guard; the agent's KEYCLOAK_ADMIN_* settings are gone.
- The user is found by the session's own plus-addressed e-mail and
deleted only when exactly one account carries exactly that address.
The prompt now gives the LLM that exact address.
- The test user is written to the stored session; a user that cannot
be deleted is recorded as left behind and named in the report.
- Firebase and Custom are not cleaned up (supersedes #17).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #999. Supersedes #17.
The cleanup of an auto-register pentest session deleted the test user in our own Keycloak realm, through the agent's master-realm admin login (
KEYCLOAK_ADMIN_*). It did so whenever the agent hadKEYCLOAK_URL, whatever identity provider the target used, andCustom/unknown fell back to it too. It never ran only because the username was never recorded.Change
Session-scoped access only. New
config.auth.cleanup(TestUserCleanup, tagged byprovider):keycloak: base URL, realm, client id/secret. It uses a client-credentials token from that realm, not master.auth0: domain, client id/secret.okta: domain, API token.Secrets are sealed with the other session credentials (
Credentialslists them) and redacted from API responses. The URL passesNetGuard::check_urlwhen the session is created, and requests go through the guarded client.KEYCLOAK_ADMIN_USERNAME/_PASSWORDare removed from the agent config.Found by the session's own address. The test user is looked up by
base+{session_id}@domain. It is deleted only when exactly one account carries exactly that address (case-insensitive); the provider's search result alone is not trusted. The prompt now gives the LLM that exact address instead of a{session_id}placeholder.Recorded. The planned test user is now written to the stored session (before, it existed only in memory, so
test_user.cleaned_uplanded on an empty record). A user that cannot be deleted getsleft_behindwith the reason. It is announced in the session stream and named in the report ("Test User … Left behind … delete it by hand").Firebase and Custom are no longer cleaned up. The variants stay, so older records still read.
Not in this PR: the wizard still has only the "delete test user" checkbox. Without access given through the API, the user is reported as left behind. Wizard fields for the provider access come later.
Tests:
planned_test_user, the report row, sealing/redaction of the new secret, and serde for older records.Run:
cargo test -p compliance-core,cargo test -p compliance-agent --lib pentest(81 passed), clippy (CI flags) for core and agent, a dashboard check.CI will also need #1001 (
quinn-udpadvisory, which failscargo auditon every PR right now).🤖 Generated with Claude Code
https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9