Commit Graph
3 Commits
Author SHA1 Message Date
Sharang ParnerkarandClaude Opus 5 c7fc7af249 feat(platform): isolate tenants on disk, in the runner API and on webhooks (#255)
A security audit found five ways one tenant could reach another tenant's
data or act on its behalf. All five are closed here.

1. Clone directories were shared. Every producer and consumer resolved a
   checkout to `<git_clone_base>/<sanitized-name>`, so two tenants that
   onboarded a target with the same name got one directory: the second one
   to scan fetched the first one's `origin` instead of cloning its own, and
   then scanned it. Checkouts are now `<base>/<tenant>/<name>` through a
   single helper, `pipeline::git::clone_dir`, which every call site uses —
   the orchestrator, PR review, ingest, the graph build, the chat embedding
   build and the file-content reader. Both segments collapse to one safe
   path component, and the tenant segment additionally carries a digest
   whenever collapsing was lossy, so two distinct tenant ids can never map
   to one directory.

2. One SSH deploy key authenticated every tenant's clone. A tenant that
   added the agent's key to a repository made that repository readable by
   any other tenant that named its URL. Per-tenant key management is R1, so
   at MVP the key is gone entirely: `RepoCredentials` is HTTPS-token only,
   an `ssh://`/`git@` URL is rejected with a message pointing at the HTTPS
   URL and a token, and `SSH_KEY_PATH`, the generator, the
   `/api/v1/settings/ssh-public-key` endpoint, the dashboard panel that
   advertised the key and the onboarding docs are all removed.

3. `serve_artifact` had no tenant check. Runner blobs are addressed by
   content hash and the hash is in the job record, so any valid runner key
   could fetch any tenant's control-logic source. The blob store is now per
   tenant (`<base>/tenants/<tenant>/blobs/…`) and the read is bound to the
   tenant the key is bound to; another tenant's digest is simply not there.

4. The runner scope check accepted the `werkbank:runner` scope *or* any key
   whose product was `pruefwerk`, which made every product API key a runner
   key able to lease and complete other tenants' jobs. The scope is now
   required.

5. Webhooks created databases before authenticating. A POST with any
   `tenant_id` reached `for_tenant_id`, whose index-ensure materializes
   `<prefix>_<tenant_id>` — an unauthenticated write primitive. The target
   lookup now goes through `DatabasePool::for_existing_tenant_id`, which
   creates nothing; an unknown tenant or target is a 404.

Also: the static `WERKBANK_RUNNER_TOKEN` names no tenant, so a holder acts
for all of them. It is still accepted in dev, where it is the only option
before the platform is wired up, and refused when `app_env.is_hardened()`.

URL-scheme and SSRF validation (file://, local paths, server-side
`source_ref`) is deliberately untouched — that is #256.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
2026-09-21 00:00:26 +02:00
sharangandSharang Parnerkar c461faa2fb feat: pentest onboarding — streaming, browser automation, reports, user cleanup (#16)
CI / Deploy MCP (push) Successful in 2s
CI / Check (push) Has been skipped
CI / Detect Changes (push) Successful in 7s
CI / Deploy Agent (push) Successful in 2s
CI / Deploy Dashboard (push) Successful in 2s
CI / Deploy Docs (push) Successful in 2s
Complete pentest feature overhaul: SSE streaming, session-persistent browser tool (CDP), AES-256 credential encryption, auto-screenshots in reports, code-level remediation correlation, SAST triage chunking, context window optimization, test user cleanup (Keycloak/Auth0/Okta), wizard dropdowns, attack chain improvements, architecture docs with Mermaid diagrams.

Co-authored-by: Sharang Parnerkar <parnerkarsharang@gmail.com>
Reviewed-on: https://gitea.meghsakha.com/sharang/compliance-scanner-agent/pulls/16
2026-03-17 20:32:20 +00:00
sharang acc5b86aa4 feat: AI-driven automated penetration testing (#12)
CI / Clippy (push) Failing after 1m51s
CI / Security Audit (push) Successful in 2m1s
CI / Tests (push) Has been skipped
CI / Detect Changes (push) Has been skipped
CI / Deploy Agent (push) Has been skipped
CI / Deploy Dashboard (push) Has been skipped
CI / Deploy Docs (push) Has been skipped
CI / Format (push) Failing after 42s
CI / Deploy MCP (push) Has been skipped
2026-03-12 14:42:54 +00:00