Skip to content

[New] Respond to GenAI Credential Exposure - #162

Open
Mikaayenson wants to merge 11 commits into
elastic:mainfrom
Mikaayenson:feat/respond-genai-credential-exposure
Open

Mikaayenson wants to merge 11 commits into
elastic:mainfrom
Mikaayenson:feat/respond-genai-credential-exposure

Conversation

@Mikaayenson

@Mikaayenson Mikaayenson commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Use this when an AI provider API key has been exposed and must be revoked at the provider, not only recorded in the SIEM. Start from a credential-exposure alert or run it manually with non-secret metadata (provider, key id, and OpenAI project id when required). Prompt text and raw token values are never accepted as inputs. Audit by default logs the revoke plan. Enforce uses a customer-configured Anthropic or OpenAI Admin HTTP connector to deactivate or delete the key, then verifies status through the provider API. Enforce fails closed if the connector id is not configured. Note, this one requires admin to an enterprise Anthropic or OpenAI account to fully test.

respond-genai-credential-exposure__outcome-step

@Mikaayenson
Mikaayenson requested a review from a team as a code owner November 21, 2026 04:04
@github-actions
github-actions Bot requested a review from semd November 21, 2026 04:04
- Unified concurrency key uses resolved key_id for both alert and manual
- Removed __install__ connector consts; use connector-id: __install__.<name> directly per CONTRIBUTING.md
- Multi-alert reject guard (event.alerts.size > 1)
- Resolve provider + project_id from alert fields (gen_ai.provider, gen_ai.project.id) so OpenAI alerts work
- key_id charset allowlist rejects raw secrets before logging
- Removed on-failure: continue on revoke/delete HTTP steps (fail-closed)
- OpenAI verify: 404-as-error means verify_error present = confirmed deletion
- Removed error field echoing from audit log messages

@semd semd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition, and the provider calls match the Anthropic and OpenAI Admin APIs. A few things before merging: alert runs always pick Anthropic (L100), the key ID allowlist lets raw sk- secrets through (L129), a successful OpenAI delete is never reported as verified (L216), and rejected or unverified runs end as completed (L116, L200). I'd also add an analyst approval before enforcing (L172).

One question: which rule or integration produces gen_ai.provider, gen_ai.auth.key_id and gen_ai.project.id? I couldn't find them in Kibana's ECS package or in the other library templates, and if nothing sets them yet, alert runs always end as skipped.

Alert-field provider wins over manual-input defaults, raw sk- values fail closed,
unverified provider calls fail the run, and enforce waits for analyst approval.
Cover waitForApproval (1h) plus provider HTTP verify, and surface
project_id in the revoke approval message when present.

@semd semd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, all six addressed. Non-blocking: an alert without gen_ai.provider still falls back to the manual default anthropic (input defaults apply on alert runs), and cloud.provider is the hosting cloud (aws, gcp…), not the AI provider. The approval prompt shows the provider, so an analyst can catch it, but reading the provider only from gen_ai.provider on alert runs would be safer.

Only show project= for OpenAI revoke/audit prompts, and reject
non-proj_ project_id values without echoing them.
@Mikaayenson Mikaayenson self-assigned this Dec 2, 2026
Only run the proj_ format allowlist when project_id is non-empty so
blank OpenAI runs hit the clearer missing-field skip path.
@Mikaayenson
Mikaayenson requested a review from semd December 2, 2026 01:44
@Mikaayenson
Mikaayenson enabled auto-merge (squash) December 2, 2026 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants