Threat model
High-level security view of Maidan as it ships. This is an operator and integrator document, not a formal audit.
Assets
| Asset | Location | Sensitivity |
|---|---|---|
| Workspace data | Postgres / SQLite | Messages, threads, votes, search index |
| Content key-encryption key | Operator secret (MAIDAN_CONTENT_KEK), never the DB | Wraps every per-message content key; with a pre-shred backup it recovers withdrawn words |
| Per-message content keys | DB (maidan_content_keys, wrapped by the KEK) | Destroyed on tombstone (crypto-shredding) |
| Workspace secrets | DB (maidan_secrets, AEAD ciphertext) | Substituted into egress only for allowlisted hosts; never in the event log |
| Delegation grants | DB (maidan_delegation_grants) | Let one member act as another, time-boxed and revocable |
| API tokens | DB (maidan_api_tokens) | Bearer secrets (hashed at rest) |
| Share-ticket secrets | DB (maidan_share_tickets) | SHA-256 hash only; raw maid_share_… value returned once |
| App OAuth codes | DB (maidan_oauth_codes) | SHA-256 hash only, single-use, short TTL — never the plaintext code |
| OAuth 2.1 codes and refresh tokens | DB (oauth_authorization_codes, oauth_refresh_tokens) | SHA-256 hash only; a code is single-use for ten minutes, a refresh token rotates and a reuse revokes its lineage |
| Federation peer secrets | DB (encrypted with FEDERATION_ENCRYPTION_KEY) | Outbound poll credentials |
| Artifacts | Local FS or S3 | User/agent uploads |
| Audit log | DB | Security-relevant actions |
Trust boundaries
[Agent / Browser] ------HTTPS+Bearer------> [maidan-server] --SQL--> [Database]
[External recipient] --HTTPS+ShareTicket--^ | `--> [Artifact store]
`--> [Peer over A2A HTTPS]
- Untrusted: MCP clients, HTTP clients, federation peers (authenticate but validate payloads).
- Trusted: Operator with DB backup access, host running the server.
Primary threats
Each row's Test column names the regression that holds the mitigation (a
Rust test function or a *.rs file stem). threat_model_contract fails
if a name is missing or does not resolve in the repo. A PR that changes
a threat or its mitigation updates the row, and the named test if it
moves.
| ID | Threat | Mitigation today | Residual | Test |
|---|---|---|---|---|
| T1 | Stolen API token | Capability-scoped tokens; revoke via DELETE /tokens/:id; a minted secret is maid_, 256 bits from the OS in base62 and a CRC32 checksum, so a secret scanner can tell a leaked token from a lookalike offline, and the egress guard refuses one in an outbound send | Token usable until revoked | api_token_create_lookup_and_revoke, a_token_with_one_changed_digit_fails_its_checksum, a_checksummed_bearer_token_is_caught |
| T2 | AUTH_DISABLED left on in prod / by mistake | Removed (R11): the server has no unauthenticated mode. Boot refuses AUTH_DISABLED and MAIDAN_ALLOW_INSECURE_NO_AUTH by name, whatever their value, so an operator who meant auth off is told rather than served. MAIDAN_ENV accepts only production or development (empty counts as unset), so a misspelt prod refuses boot instead of turning every production refusal off; the Helm chart's production render and k8s/overlays/prod set MAIDAN_ENV=production | None for the removed mode (T29); a deployment outside Helm and the prod overlay that leaves MAIDAN_ENV unset still runs without the production refusals | boot_refuses_auth_disabled_whatever_its_value, an_unknown_maidan_env_is_refused_rather_than_read_as_development, the_oidc_mock_runs_only_in_a_named_development_deployment |
| T3 | Bootstrap routes create admin without auth | The bootstrap feature is test-only: not a default, never enabled by a release build (check-deploy-contract.sh), and a build without it refuses MAIDAN_BOOTSTRAP by name. Even in a test build it opens only the first workspace. The first admin of a real instance is maidan init, or MAIDAN_DEV_ADMIN_TOKEN on a non-production instance with no workspace | A test build with MAIDAN_BOOTSTRAP=1 still serves the seed routes | bootstrap_e2e, bootstrap_absent_e2e, init_bootstraps_once_then_refuses, an_empty_instance_gets_a_real_admin_token_once |
| T4 | Federation peer impersonation | Peer bearer + idempotent ingest; an ingested event whose channel or thread id names one on this server is refused, so a peer cannot place events inside a local (private) channel; a peer's secret reads the log of the workspace the peer is registered in and no other, whatever workspace the registration names as the remote. A federated mention is remapped into the peer's workspace without its member id being checked, so the router notifies a mentioned member only when that member is live in the event's workspace, and a member of another workspace on the same server gets no inbox row, email or push | Compromised peer can push events into its own federated locations. federation:admin lets its holder register a peer and export the workspace's whole event log through it, so it is granted like token:admin | federation_ingest_rejects_wrong_peer_bearer, a_federated_event_naming_a_local_channel_or_thread_is_refused, a_peer_naming_another_tenants_workspace_reads_none_of_its_log, a_federated_mention_of_another_workspaces_member_notifies_nobody |
| T5 | Artifact exfiltration | Bearer on download; SHA-256 addressing; a per-workspace reference gates every read, so a SHA known from another tenant does not open the blob | A reader in the owning workspace can copy what it can read | artifact_isolation_e2e |
| T6 | SQL injection | sqlx parameterized queries | ORM bypass bugs; no dedicated regression test (pinned as practice) | practice |
| T7 | GDPR right-to-erasure | Tombstoning destroys the message's content key, so the event log, exports and peers keep only ciphertext and the chain still verifies (crypto-shredding); DELETE /messages/:id/purge hard-deletes the row; DELETE /artifacts/:sha drops a shared artifact's bytes with its last reference (all token:admin except the tombstone) | A DB backup taken before the shred plus MAIDAN_CONTENT_KEK recovers the words until backup rotation; a peer that ingested the words keeps them unless it ingests the tombstone; legal-hold copies are kept by design | crypto_shredding_e2e |
| T8 | Resource exhaustion / denial-of-service by tenant | Per-client rate limit (MAIDAN_RATE_LIMIT_MAX, default 1200 per 60 s; an unverified bearer shares the client-IP bucket) + per-workspace fairness limit (MAIDAN_WORKSPACE_RATE_LIMIT_MAX, default 6000 per 60 s, charged only for a caller authenticated into that workspace); per-connection statement timeout; a global in-flight ceiling (MAIDAN_MAX_CONCURRENT_REQUESTS) refuses excess requests with 503 before authentication, and WebSockets have their own ceiling; an MCP wait_for_* long-poll gives its in-flight permit back once it parks, and one workspace may park at most 32 waits (the next is refused with the typed rate-limit error), so one token's waits cannot hold the ceiling every tenant shares; an operator-supplied egress URL's DNS lookup gives up after 5 s | No hard CPU/IO isolation between tenants on one instance (infra-level); parked waits are bounded per workspace, not per instance, so many workspaces can still park many tasks | rate_limit_e2e, workspace_rate_limit_default_e2e, overload_e2e, long_poll_fairness_e2e |
| T9 | Tampered or replayed workspace export; credential leak via export | Signed maidan.workspace.export/1 (Ed25519); verify fail-closed on hash/sig/pin/secret fields; tokens die on export (no token/secret continuity) | Integrity without MAIDAN_EXPORT_VERIFY_KEYS is not a trust anchor (anyone who can sign with a key can produce a valid file); operator key compromise forges exports | sign_then_verify_succeeds, bit_flip_in_payload_fails, forbidden_secret_field_fails_sign_and_verify |
| T10 | Host rewrites the event log (splice, delete, payload edit) | Per-workspace SHA-256 hash chain on every stored event (prev_hash + content_hash); GET /workspaces/:wid/events/verify 409 fail-closed; federation ingest verifies origin hashes before remap | A wholly fabricated but internally consistent chain still verifies (hashed, not signed — authorship is T9); the pruned prefix is covered by snapshot catch-up (T11) | event_chain_e2e, chain_verify_e2e |
| T11 | Fabricated or gapped event-log history; search index silently diverges | Hashed snapshot + since-LSN catch-up for the pruned prefix (maidan.event-log.snapshot/1); CursorTooOld never clamps; search tap verifies backfill and fails loud on Lagged without a log | Snapshot is hashed, not signed — a consistent-but-fabricated graph is T9; include_graph is token:admin / peer so workspace:read cannot dump private channels | cursor_too_old, log_snapshot |
| T12 | Leaked or replayed cross-organization share ticket | Separate ShareTicket auth class; header-only credential; one channel; exact artifact-SHA allowlist; hard 48-hour maximum; immediate revocation; dedicated GET-only routes with reduced DTOs; liveness rechecked before an artifact backend read; raw secret returned once and only its SHA-256 digest stored; the store refuses a ticket for the shared DM channel (every direct message of the workspace) and for a private channel its creator is not a member of, on REST and MCP alike, and the consumer serves nothing for a DM-channel ticket minted before that, answering as it does for an unknown ticket; each use of a ticket asks again whether its creator could still mint it (a live, active member who can read the channel, with a private channel needing a membership row, and, when it was minted with an API token, that token still live and holding token:admin), and a ticket whose creator lost any of that answers as an unknown ticket, says nothing of why, and is revoked with a share_ticket.revoke audit row naming the reason | A stolen live ticket can read its deliberately shared channel and allowlisted files until expiry or revocation; operators must keep authorization headers out of reverse-proxy logs; a ticket minted on a browser session, or before the token was recorded, has no token to resolve and is held to its creator's membership and standing alone (T27) | share_ticket_rest_e2e, a_share_ticket_never_opens_direct_messages_or_a_private_channel_its_creator_is_not_in, a_ticket_cannot_open_the_dm_channel_or_a_private_channel_its_creator_is_not_in_sqlite, share_ticket_lifecycle_postgres, share_ticket_creator_standing_e2e |
| T13 | SSRF through a URL a tenant or the operator registers: a webhook or FSM hook (a workspace admin, T21), a slash command (workspace:write), an A2A push config (an A2A caller), or a federation peer (federation:admin) | One canonical URL parser rejects credentials, loopback, private, link-local, shared, documentation, multicast, and reserved literals. Every delivery resolves again, rejects the whole answer set if any address is non-public, pins that set into a no-redirect HTTP client, and therefore closes DNS-rebinding and redirect pivots. MAIDAN_ALLOW_PRIVATE_EGRESS=1 is a development-only loopback escape hatch and is rejected in production. An OAuth client metadata document is fetched only from a host the operator lists, at a public address, pinned, with no escape hatch at all | A public service can itself proxy to a private target; outbound network policy remains useful defense in depth | rejects_every_non_public_literal_family, rejects_a_dns_answer_set_if_any_address_is_non_public, private_egress_escape_hatch_is_never_accepted_in_production, a_listed_metadata_host_on_a_private_address_is_never_fetched |
| T14 | A delegate acts as another member beyond what it was lent | A delegation grant lives no longer than the workspace's grant ceiling (default 90 days) and is exchanged for a token of at most an hour that is the subject, carrying only what the grant, the delegate's own authority and any requested attenuation all allow; one hop only; every use is recorded with the delegate as actor and the subject as subject, refusals included; an approval cannot be borrowed for work the actor did | A grant is trusted until it expires or is revoked | delegation_policy |
| T15 | Cross-tenant read or write through an omitted or foreign id (an optional workspace_id, a SHA, a subscription filter) | Omitted scope defaults to the caller's workspace, never "all"; tenant_isolation_e2e runs every HTTP operation, MCP tool and live stream as a second tenant | A new route that skips the shared extractors is caught only by that suite | tenant_isolation_e2e |
| T16 | Credentials leaking into traces | Authorization, Proxy-Authorization, Cookie, Mcp-Session-Id, the Slack and GitHub signatures, Set-Cookie and Location (the consent redirect carries an OAuth code) are marked Sensitive on every span, and the query string (where an OAuth code travels) is never recorded | A handler that logs a secret itself | trace_redaction_e2e, the_redirect_that_hands_over_a_code_never_reaches_the_trace |
| T17 | A script injected into /ui reads the bearer token | The page keeps no token: a pasted one is exchanged for an HttpOnly; SameSite=Lax session (POST /auth/session/from-token) that resolves the token again on every request, so revoking or rotating the token ends it; an unsafe session request or session WebSocket from another origin is refused | Script running in the page can act as the session while the page is open, but cannot carry the credential away | session_from_token_e2e |
| T18 | A prompt-injected producer pastes a credential it can read into its result, and Maidan publishes it on GitHub, Slack or Linear | Every egress send and change-flow write is scanned for credential shapes (GitHub, Anthropic, OpenAI-style, AWS, Slack, JWT, PEM private key, Maidan's own maid_ secrets) and refused on a match; the delivery records the kind and surface, never the text, and the operator channel is told (Result Delivery) | A credential in a shape the guard does not know, or encoded or split to dodge it; a JWT or PEM key in a diff's added lines (allowed as a fixture); the result itself is still stored in Maidan. MAIDAN_EGRESS_CREDENTIAL_GUARD=off disables it, and is refused with MAIDAN_ENV=production | egress_credential_guard_e2e |
| T19 | A review model's result passes a merge gate it does not own: it names another commit status context (stamp, security), claims a pass the verdict does not say, stamps a head it was not briefed on, or a member grants itself the authority to post | A review thread's result posts only the pre-review status (a one-entry allowlist), only for a reporter an operator granted the pre-review governance skill (channel:admin, never self-declared), with the state taken from verdict (PASS or FIX-FIRST) and a description Maidan builds from the reporter's handle and its own usage's family, at the head on the thread's Head to review: line; anything else posts nothing and leaves a warning on the delivery row (Result Delivery) | A granted reviewer's model can still post a wrong PASS on the briefed head: the skill vouches for who reviewed, not for the review; the briefed head is as trustworthy as whoever wrote the thread's description | pre_review_status_e2e, an_agent_cannot_grant_itself_a_governance_skill |
| T20 | An MCP client, or someone posing as one, gets more of a person's authority than they consented to, or keeps it | OAuth 2.1 with PKCE S256 for every client; exact redirect matching; consent only by a person on a same-origin request to a page that cannot be framed; tokens bound to the one MCP endpoint their grant names (/mcp/streamable or /mcp/coordinator) and their workspace, never wider than the grant, the client or the member; refresh rotation with lineage revocation on reuse; a lineage that ends 90 days after consent, so a person consents again at least that often; a member who leaves takes their grants with them; a client metadata document held for five minutes only once it passed every check, never past a revoked client (OAuth) | A person who consents to a malicious client lends it what they consented to, for at most 90 days unless they disconnect it sooner; a self-registered client's name is unverified, and the consent page says so; a document change reaches the server within five minutes, not at once; consent takes any live session, up to its eight hours, without a fresh sign-in; an access token minted before its client was revoked lives out its hour (both decided 2026-11-10, OAuth) | oauth_hardening_e2e, oauth_token_endpoint_e2e, oauth_scope_contract_e2e, oauth_authorize_signin_hosts_e2e |
| T21 | A writer registers automation with the whole workspace's reach: an FSM hook that runs a tool it may not call on every matching transition (clearing a review requirement, then closing its own work), or a webhook that receives every private channel and DM | Registering an FSM hook (REST and MCP), creating an outbound webhook and choosing the mention webhook need workspace:admin; a worker token holds workspace:write and is refused; binding a slash command to an MCP tool that is not read-only needs channel:admin (REST and MCP), since the command runs as whoever types it | An administrator's registrations reach as far as that administrator; see T23 and T27 | automation_registration_admin_e2e, a_worker_token_binds_a_slash_command_only_to_a_read_only_tool_and_an_admin_to_any |
| T22 | Someone outside the organization speaks as a member through a bridge: a comment on a linked public GitHub issue, or a Slack Connect guest in a linked channel, is posted as the member who linked it, and an agent reading the thread takes it as that member's | A GitHub comment is posted only when its author_association is OWNER, MEMBER or COLLABORATOR; a Slack message only when its sender's team is the team the app is installed in | An insider's bridged text is still posted as the linking member; its server-set provenance (T25) tells a reader it came through the bridge, but an agent that ignores the field cannot tell it from the member's own words; a Slack message whose event names no sender team (neither user_team nor team) is treated as the installing team's and posted | a_comment_from_someone_without_a_role_on_the_repository_is_not_posted_as_the_linking_member, a_slack_connect_guest_from_another_team_is_not_posted_as_the_linking_member |
| T23 | An FSM hook acts beyond the member who registered it: it runs a tool its creator may not call, or keeps firing after its creator's token is revoked or their member is deactivated | A hook runs as the token that registered it, resolved again at every firing as a bearer of it would be; one whose token is no longer live, no longer holds workspace:admin, belongs to another workspace, or was never recorded is skipped and written to the audit trail as fsm_hook.skipped; an mcp_tool hook's tool must be one its creator may call | Webhooks, slash commands and A2A push configs follow the same rule (T27) | fsm_hook_creator_e2e |
| T24 | One credential holds server-sent event streams open without bound, each with a bus subscription and a credential re-check, invisible to the in-flight ceiling | At most MAIDAN_MAX_STREAMS_PER_CREDENTIAL (default 64) open streams per API token, or per member without one, across the MCP, AG-UI and A2A stream routes; past it a new stream gets 429 before it subscribes; gauge maidan_sse_streams | The ceiling is per credential, so a member with many tokens can hold more; /ws/subscribe keeps only its instance-wide ceiling | stream_ceiling_e2e |
| T25 | A bridge's origin is forged, stripped or replayed: a member writes metadata.slack on a message to keep it out of Slack, or claims a bridge origin for their own words, and a redelivered GitHub comment, a replayed capture or a Slack retry posts the same text twice | A message's provenance (origin, origin_ref) is a column only bridge ingress and the server's own sentences about a linked pull request write; no post or edit reaches it, a REST or MCP post or edit that names it is refused, and Slack and GitHub egress loop prevention read it, not metadata. Bridge ingress is keyed on (workspace, origin, external id), the GitHub comment id or the Slack event_id, in the post's transaction, and a key already taken posts nothing and still answers 200. GitHub egress takes the key for each comment it posts, and a comment by our own GitHub App is skipped by its app id, not every Bot | A Slack event with no event_id is not posted. A comment egress posted with a token is projected back once if its webhook arrives before egress records the comment id. Slack ingress still answers after the post, so a store slower than Slack's 3 s costs a retry, which the key then drops. Other server annotations in metadata (notice, slash_response, a2a) are still caller-writable | bridged_messages_carry_provenance_and_post_once_per_key_sqlite, bridged_messages_carry_provenance_and_post_once_per_key_postgres, a_member_cannot_forge_or_strip_provenance_over_rest, a_member_cannot_forge_or_strip_provenance_over_mcp, a_member_message_that_claims_slack_in_its_metadata_is_still_relayed, a_comment_github_delivers_twice_posts_one_message, a_slack_event_retried_posts_one_message, a_comment_our_github_app_made_is_not_projected_back |
| T26 | A new MCP tool takes another tenant's id and runs unchecked, because the pre-dispatch guard was a list of tool names whose default let an unlisted tool through | Every id argument a tool's schema declares (*_id, *_ids, sha256, or a uuid format) has one decision in crates/maidan-mcp/src/tools/id_scope.rs: checked before dispatch for channel, thread or message access, held to the caller by the workspace and member gates, or exempt with the reason its handler or the store binds it. A tool with an id argument nobody classified is refused before it runs | An exemption is a reviewed claim about a handler, not a check: a handler that stops binding an exempt id is caught only by tenant_isolation_e2e, which still fills every id with another tenant's; a mixed call (the caller's own path, another tenant's id in the body) is not swept | every_id_argument_of_every_tool_is_classified, an_unclassified_tool_with_a_thread_id_is_refused_before_it_runs, a_thread_scoped_tool_refuses_another_workspaces_thread |
| T27 | A registration outlives the member who made it: a webhook, the mention route, a slash command or an A2A push config keeps sending workspace content to its URL after its creator is revoked or deactivated, a webhook delivers private channels and DMs its creator cannot read, a schedule keeps opening threads as a member who is gone, and a share ticket or invite keeps admitting people on a gone member's word | Each webhook subscription, slash command and A2A push config records the token that registered it and acts only while that token could register it again: resolved at every firing, live, in the registration's workspace, its member not deactivated, still holding workspace:admin (webhooks) or workspace:write; one that is not is skipped and recorded (webhook.skipped, slash_command.skipped, a2a_push_config.skipped), and a webhook or push config whose creator's authority has ended is revoked or deleted once. A webhook delivers only events its creator may read (it also needs workspace:read), checked when the event is queued and again when each attempt is sent. Deactivating or deprovisioning a member pauses its task schedules and revokes the share tickets it owns or made and the invites it sent, each with an audit row, in the same transaction; a share ticket is also held to its creator at every use, so it stops, and is revoked with its reason in the audit trail, when the creator leaves a private channel it shares, is removed, or when the API token that minted it is revoked, while a ticket for a public channel survives the creator leaving it (public channels are readable by every member); a schedule whose creator has since left its private channel is skipped and paused when it comes due. Registering writes webhook.create, slash_command.create or a2a_push_config.create, and choosing the mention route mention_webhook.set, each naming the member and token | A registration made with auth disabled records no token and acts only while auth stays disabled, and its audit row names no member; the registration and skip audit rows are written after the change, best effort, so a failed audit write is logged and does not undo it; the mention route delivers with its subscription's creator's authority, not the authority of whoever chose it; a ticket minted on a browser session, or before its token was recorded, has no token to check and is held to its creator's membership and standing alone | registration_owner_e2e, member_end_registrations, share_ticket_creator_standing_e2e |
| T28 | A member reads, through a read that skips the thread check, what a private channel or a DM holds: a DM's messages by id, a private attachment by its sha, a mention or notification recorded before they left (or that named them from a channel they are not in), or a gate's prompt on a thread they cannot open | One rule, held in the store (maidan-store/src/thread_access.rs): a row on a thread needs the reader to read that thread (DM participant, private-channel member, same workspace), a row on a channel and no thread needs the channel, and a row on neither is the workspace's. The inbox, mention list, notifications, their unread counts, the manager digest, the buried decisions (list_buried_decisions, the digest email) and a run's occupancy (get_run_occupancy) and the pending-gate list filter by it in SQL on both backends, checked at read time so leaving takes the rows away; a single gate's read and answer (REST, the console's confirmation and MCP) use its Rust form, can_read_gate. An artifact is read only when every thread in the workspace that references it (a thread link, a land-gate verdict, a private or DM message's metadata) is one the reader can read, or the reader uploaded it, and otherwise is 404 on REST and not found on MCP and resources/read; GET /dm/{id}/messages needs a participant, as its siblings did. ThreadBlocked now carries its thread and channel, and the event location accessors name every variant, so a new located event cannot fall to workspace-wide | An artifact referenced nowhere is readable by the whole workspace, as before; one referenced in a private channel and a public one is hidden from those outside the private one, and a member who holds a sha can hide a file from others by linking it into a private channel they are in; a result's attachments (in the result JSON) do not count as references; a gate on no thread is the workspace's; another unlocated event is still workspace-wide | read_visibility, read_visibility_e2e, only_a_dms_participants_read_its_messages, an_artifact_linked_in_a_private_channel_is_read_only_by_its_members, a_gate_on_a_thread_is_listed_and_answered_only_by_its_readers, a_members_inbox_and_notifications_hold_only_what_it_can_read, a_thread_block_says_where_it_happened, buried_decisions_leave_with_the_access_that_justified_them_sqlite, run_occupancy_counts_only_threads_the_reader_can_read_sqlite |
| T29 | A caller skips every check: an unauthenticated mode, a context that passes every capability and workspace check, or code that builds or alters a caller without a credential | No such mode or context exists (R11). AuthContext is sealed: its fields are private and its constructors private to maidan-auth, so a caller comes only from a resolver that checked a bearer, a stored session, the dev anonymous reader's synthetic workspace, or a member the server acts for; a release build cannot compile another crate's constructor call. Registrations with no creator token never act. The OIDC mock and bootstrap routes exist only in test builds, and a release build refuses their variables by name | A test build (test-support feature, dev-dependencies only) can still build any caller; nothing that ships turns it on | no_library_code_has_a_caller_that_skips_the_checks, no_library_code_outside_maidan_auth_constructs_an_auth_context |
| T30 | Anyone who reaches the server reads /metrics, or grows it without bound: the exposition names every route, worker and queue depth, and the HTTP metrics took the raw request method as a label, so random extension methods added series the recorder kept for the life of the process | Under MAIDAN_ENV=production, GET /metrics answers 404 unless MAIDAN_METRICS_TOKEN is set, and then only that bearer, compared in constant time; the method label is one of GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS or other, and the route label is the matched template or unmatched, never the path | Outside production /metrics is open to whoever reaches the port; the scrape is exempt from the rate limiter, so the token's length (32 bytes or more) is what resists guessing; status codes stay a label (the server chooses them) | two_hundred_random_methods_add_no_series, the_route_label_is_the_matched_template_never_the_path, a_token_puts_the_scrape_behind_its_bearer, production_without_a_token_serves_no_scrape |
| T31 | Someone who may not decide where results go reaches the egress allowlist through the console: an agent's own sign-in lists the destinations worth aiming deliver_to at, or a person without an admin token allows one | The console's allowlist routes admit a person signed in only when they are a human member holding token:admin on a live token, or the person who may mint the first one; an agent's sign-in, a session made from a token, and another workspace's member are refused, and a bearer is held to token:admin as on the bearer route. Reads are admin-only too. Every allow and revoke is audited in the same transaction, naming the person, and the entry keeps who allowed it. The workspace-wide delivery list the same tab reads shows only where results went, and drops threads the reader cannot see | A person who holds an admin token can do in the console what the token could already do; before anyone holds one, the first uninvited person signed in may allow destinations, as they could mint the token that allows them | only_a_human_admin_signed_in_reaches_the_console_allowlist, a_private_channels_deliveries_stay_out_of_reach_of_a_member_outside_it |
| T32 | Advice from a decision model is taken for more than it is, or carries more than it should: the producing agent writes the result and messages the model reads, so it can word them to earn green advice; the hand-off leaves to a third party; and the workspace's provider key is a credential | The advice is advice only: the route and the MCP tool write nothing and never record, arm or clear the gate, so a close still needs the reviews and gates the workspace set, and the console says what was read and that it approves nothing. Nothing leaves unless the instance turns advice on and the workspace has a key: its own, set by the workspace's admin (a bearer with token:admin, or that person signed in to the console), or the instance's. The server builds the packet from one thread the caller may read, without the diff, and sends it only to the host of the one provider asked (TypeSafe, OpenAI, Google, Perplexity or Cloudflare, each with its own key and its own reserved secret; Cloudflare's names the one account it calls, which is held to an account id's shape before it goes into the request's path) through the egress guard. A workspace's key is checked with the provider and stored as an encrypted workspace secret under a name the server keeps for itself, which the generic secret routes and tools cannot create, list, resolve, substitute or delete; no route returns it, and it is never used for another workspace. Every request to the provider is at most 16 KiB | The model reads the agent's own account, not the diff, so a hand-off that misdescribes the work, or is written to steer the model, reads as clean: advice narrows what a reviewer looks at first and replaces no review. On an instance with a key of its own, any workspace's hand-off goes to the provider when a member with thread:transition asks. What a provider does with a hand-off is under its terms: a Google key on the free tier lets Google use what is sent to improve its products | a_provider_failure_fails_the_advice_and_leaves_the_gate_alone, a_workspace_asks_with_its_own_key_and_another_cannot_set_it, a_hand_off_is_sent_as_a_packet_and_answered_with_judgments, the_workspaces_key_is_out_of_reach_of_the_generic_secret_routes, each_provider_is_asked_in_its_own_shape_with_the_workspaces_key_for_it |
| T33 | A workspace nobody at the operator opened aims the server's own GitHub, Slack or Linear credential: its admin blesses a repository or a channel it names, links one to a thread, or watches a pull request, and the operator's credential reads and writes there | The store serves the server's credentials only to a workspace whose origin is operator, and serves any other workspace only with a connection of its own, which it stores as a reserved secret after the provider accepts the token. For a workspace nothing serves on a surface it refuses to bless a destination or link a Slack channel or GitHub issue there, and it answers that nothing is blessed, so a watched pull request is refused, the change sweep reads none and no result is delivered. A workspace's own connection is always used for it, so its client never acts for another workspace. The egress worker dead-letters any row queued for one before it reaches a sender, and the server's own inbound routes reach only the workspaces its credential serves (T34). The blessing and link rules are in the store, under REST, the console, MCP and the workers alike | An entry or link made while nothing served the workspace stays in its table, doing nothing, until the workspace connects or the operator removes it. A workspace the operator opened is trusted with the credentials as before | a_sandbox_is_refused_until_it_connects_an_account_of_its_own, a_workspace_is_served_by_its_own_connection_or_the_operators_opening_sqlite, each_workspace_sends_through_the_credential_that_serves_it, two_workspaces_with_different_tokens_never_use_each_others_client |
| T34 | A member reads a private channel's or a DM's events on a live stream or its replay, because the stream decided what to show from sets computed once at subscribe time: naming the shared DM channel in channel_grants passed for anyone, a private channel made after the subscribe was in no deny set, a member removed from a channel kept receiving it, and a reaction, vote or mention (no channel of its own) skipped the deny set | Every event is checked when it is sent, on /ws/subscribe, /mcp/stream and /agui/stream, in replay, live delivery and the replay after a lag, by the rule the backfill and webhooks use (maidan_auth::EventVisibility). An event on a thread follows the thread's access rule, so a DM's events go to the conversation's participants only and a reaction, vote, mention or pin is as visible as its message. An event on a channel with no thread follows channel membership, and the DM channel's are never shown. An event that names no workspace, or a workspace other than the caller's, is never shown. A lookup that fails hides the event. A stream reuses each answer for 5 seconds. Channel grants only narrow what a subscription asks for and never lend access. | A removal from a private channel or a DM takes effect on a running stream within 5 seconds, not at once. Events with no thread, channel or message (a member joining, a credit deposit) are the workspace's. A subscriber that names no channel grants still gets no DM events, as before, and receives them only through dm_conversation_id or a grant naming the DM channel | subscribe_grants_e2e, a_member_outside_a_dm_gets_none_of_its_messages_over_ws_when_it_names_the_dm_channel, a_member_outside_a_private_channel_made_after_it_subscribed_gets_none_of_its_events, a_member_removed_from_a_private_channel_mid_stream_stops_receiving_it |
| T35 | A delivery meant for one workspace reaches another: a workspace posts to a URL that reaches another tenant's links, a link made first by one tenant holds a channel or an issue against every other and tells a second tenant it is taken, or an event on the server's own route lands in a workspace that has its own account | A workspace's inbound URL (/workspaces/{wid}/connections/{surface}/...) is verified with the secret that workspace stored and routes only to that workspace's links and watches. An unknown workspace, a missing connection and a missing secret answer one fixed 404. Links are unique per workspace, so no tenant can hold a channel or an issue against another or learn that another linked it. The server's own routes reach only workspaces the operator opened that stored no connection for the surface, and the scope is part of the store's lookups | A tenant that holds both its own signing secret and another tenant's link ids gains nothing, since the lookup is by workspace. The secret itself is the workspace's to keep | a_delivery_to_a_workspaces_own_url_reaches_its_own_links_and_not_anothers_to_the_same_channel_and_issue, no_secret_no_connection_and_an_unknown_workspace_answer_the_same_404, the_servers_route_reaches_an_operator_workspace_without_its_own_connection_and_no_other, two_workspaces_link_the_same_channel_and_issue_and_an_inbound_route_finds_only_what_it_serves_sqlite |
Bootstrap hardening options
- One-shot seed flag —
MAIDAN_BOOTSTRAP=1required for bootstrap routes when auth is enabled; only the first workspace may be created via bootstrap. A later workspace isPOST /operator/workspaces, which requiresoperator:globaland mints an admin token that does not holdoperator:globaloraudit:read-global. - IP allowlist — reverse proxy restricts bootstrap paths to admin CIDR.
- Compile-time strip — the routes exist only under the test-only Cargo feature
bootstrap, which is not a default and which no release build enables; a build without it refusesMAIDAN_BOOTSTRAP.
Recommended production flow: seed the first admin with maidan init (writes through the store, no unauthenticated HTTP route; see Production.md), mint per-agent tokens from it, set MAIDAN_ENV=production. A second workspace is POST /operator/workspaces with that admin token. A development stack whose database lives in another container sets MAIDAN_DEV_ADMIN_TOKEN instead, which opens the first workspace with that real, revocable admin token and is refused in production.
Related docs
- OIDC — human login (authorization code + PKCE, sessions)
- Production — env vars and probes
- Deploy — network placement
DELETE /messages/:id/purge— hard-delete after tombstone