Pentest cleanup deletes test users only in the target's identity provider, never in ours #999

Closed
opened 2026-11-14 09:47:31 +00:00 by sharang · 0 comments
Owner

Part of the DAST/pentest dogfooding work. Blocks switching the pentest on anywhere.

Problem: pentest/cleanup.rs deletes the test user of an auto-register session with the agent's own Keycloak: the master-realm admin login (KEYCLOAK_ADMIN_USERNAME/_PASSWORD) and our realm (KEYCLOAK_REALM).

  • session.rs sets the provider to Keycloak whenever the agent has KEYCLOAK_URL, regardless of which identity provider the target uses.
  • Custom and an unknown provider fall back to our Keycloak as well.

Today it never deletes anything, but only because test_user.username is never written after registration (it stays None and cleanup errors). Once the username is filled in, a pentest of any app could delete a user with the same name in our own realm.

Change:

  • Cleanup acts only on the target's identity provider, with admin credentials given for that session (sealed like other tenant credentials). It never uses the agent's own Keycloak settings.
  • No credentials for the target's provider → no deletion. The session report lists the test user as "left behind, delete by hand".
  • Remove the Custom/None fallback to our Keycloak.
  • Record the username/e-mail actually registered, so cleanup has something to act on.
  • Firebase (#17): either implement it the same way (session-scoped service account) or drop the variant. This issue supersedes #17.

Acceptance: a test shows that a session without target-IdP credentials never calls a Keycloak admin endpoint, even with KEYCLOAK_URL and admin credentials configured on the agent. A second test shows that a session with them deletes the user only in the given realm.

Part of the DAST/pentest dogfooding work. Blocks switching the pentest on anywhere. **Problem:** `pentest/cleanup.rs` deletes the test user of an auto-register session with the agent's **own** Keycloak: the master-realm admin login (`KEYCLOAK_ADMIN_USERNAME`/`_PASSWORD`) and our realm (`KEYCLOAK_REALM`). - `session.rs` sets the provider to Keycloak whenever the agent has `KEYCLOAK_URL`, regardless of which identity provider the target uses. - `Custom` and an unknown provider fall back to our Keycloak as well. Today it never deletes anything, but only because `test_user.username` is never written after registration (it stays `None` and cleanup errors). Once the username is filled in, a pentest of any app could delete a user with the same name in our own realm. **Change:** - Cleanup acts only on the **target's** identity provider, with admin credentials given for that session (sealed like other tenant credentials). It never uses the agent's own Keycloak settings. - No credentials for the target's provider → no deletion. The session report lists the test user as "left behind, delete by hand". - Remove the `Custom`/`None` fallback to our Keycloak. - Record the username/e-mail actually registered, so cleanup has something to act on. - Firebase (#17): either implement it the same way (session-scoped service account) or drop the variant. This issue supersedes #17. **Acceptance:** a test shows that a session without target-IdP credentials never calls a Keycloak admin endpoint, even with `KEYCLOAK_URL` and admin credentials configured on the agent. A second test shows that a session with them deletes the user only in the given realm.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#999