fix(pentest): delete test users only in the target's identity provider (#999)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 4m25s
CI / Check (pull_request) Failing after 9m37s

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
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-11-14 11:04:09 +01:00
1 parent deda6d4867
commit 0dd43be480
12 files changed
+813 -487

No files matched your search

+1 -1
View File
@@ -417,6 +417,7 @@ Every connection the agent opens, in one place. **Guarded** means: the HTTP clie
| Git remotes (clone, fetch, submodules, linked artifacts) | `pipeline/git.rs`, `ingest/` | `check_git_url` and the resolved address before every clone and fetch; redirects off |
| Gitea API of a git source or tracker (managed Git) | `git_source/gitea.rs`, `trackers/gitea.rs` | guarded |
| DAST and pentest targets | `api/handlers/dast.rs`, `pentest/orchestrator.rs`, `compliance-dast` | base URL checked with `check_url`; the DAST tools share a guarded client |
| The target's identity provider, for deleting a pentest test user (Keycloak, Auth0, Okta; given per session) | `pentest/cleanup.rs` | URL checked with `check_url` when the session is created; guarded client |
### Operator-configured services (not guarded)
@@ -428,7 +429,6 @@ These are set by the operator in the agent's environment, not by a tenant, and o
| Tenant registry (entitlements, projects) | `registry.rs` | `TENANT_REGISTRY_URL` |
| breakpilot-compliance OSCAL catalog | `controls/oscal_provider.rs` | `BREAKPILOT_BASE_URL` |
| GitLab and Jira issue trackers | `trackers/gitlab.rs`, `trackers/jira.rs` | `GITLAB_URL`, `JIRA_URL` |
| Identity providers for pentest test-user cleanup (Keycloak, Auth0, Okta) | `pentest/cleanup.rs` | `KEYCLOAK_URL`, `AUTH0_DOMAIN`, `OKTA_DOMAIN` |
| Headless Chrome for PDF reports | `pentest/report/pdf.rs` | `CHROME_WS_URL` |
| MongoDB | `database.rs` | `MONGODB_URI` |
| ClamAV service (clamd, plain TCP; the tree's files are streamed to it) | `pipeline/clamav.rs` | `CLAMD_ADDRESS` |