Skip to content

feat(ai): add pyoaev support for AI adversarial exposure validation (#295)#296

Open
SamuelHassine wants to merge 2 commits into
mainfrom
feature/295-ai-adversarial-exposure-validation
Open

feat(ai): add pyoaev support for AI adversarial exposure validation (#295)#296
SamuelHassine wants to merge 2 commits into
mainfrom
feature/295-ai-adversarial-exposure-validation

Conversation

@SamuelHassine

Copy link
Copy Markdown
Member

Summary

  • Adds ai_request_marker / ai_target_endpoint signature types and a shared
    deterministic per-inject canary marker helper (pyoaev/signatures/ai_marker.py).
  • Adds inject_expectation.ai_expectations_for_source(source_id) to poll agentless
    DETECTION / PREVENTION expectations for AI defense collectors.
  • Adds an AiTargetManager (CRUD for AI Target assets) wired on the client.

These are the SDK building blocks for the AI adversarial exposure validation domain
(AI red-team injector + AI guardrail collector + openaev backend).

Dependency / merge order

Dependency root of the feature. Merge and release before:

  • injectors-python: ai-redteam injector
  • collectors: ai-guardrail and mitre-atlas collectors

Pairs with the openaev backend endpoints /api/injects/expectations/ai/{sourceId}
and /api/ai_targets.

Test plan

  • python -m compileall pyoaev
  • ruff / mypy per repo standards
  • Smoke test OpenAEV(...).ai_target CRUD and inject_expectation.ai_expectations_for_source

Closes #295

…295)

Add AI request marker / target endpoint signature types, a shared deterministic per-inject canary marker helper, ai_expectations_for_source to poll agentless detection/prevention expectations, and an AiTargetManager for AI Target assets.
Copilot AI review requested due to automatic review settings June 26, 2026 22:06
@github-actions github-actions Bot added the filigran team Item from the Filigran team. label Jun 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds initial SDK primitives for the AI adversarial exposure validation (AI red-team injector + AI defense collector) domain by introducing new signature types, a shared deterministic marker helper, an expectations polling helper for AI collectors, and a new AI Target CRUD manager exposed on the client.

Changes:

  • Add AI-related SignatureTypes and a deterministic build_marker() helper for correlating inject executions to AI defense telemetry.
  • Add InjectExpectationManager.ai_expectations_for_source(source_id) for polling agentless AI DETECTION/PREVENTION expectations.
  • Add AiTargetManager (CRUD for /ai_targets) and wire it onto OpenAEV as client.ai_target.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pyoaev/signatures/types.py Adds new AI signature enum values used for AI validation correlation.
pyoaev/signatures/ai_marker.py Introduces deterministic per-inject marker helper shared by injector/collectors.
pyoaev/apis/inject_expectation/inject_expectation.py Adds API helper to fetch AI-specific expectations for a collector/source.
pyoaev/apis/ai_target.py Adds new REST manager/object for AI Target assets CRUD.
pyoaev/apis/init.py Exposes the new AI Target API module via package exports.
pyoaev/client.py Wires AiTargetManager onto the main OpenAEV client.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +44 to +46
def ai_expectations_for_source(
self, source_id: str, **kwargs: Any
) -> Dict[str, Any]:
Comment on lines +13 to +15
def build_marker(inject_id: str, agent_id: str = "") -> str:
seed = f"{inject_id}:{agent_id}".encode("utf-8")
return "oaev" + hashlib.sha256(seed).hexdigest()[:16]
Comment thread pyoaev/apis/ai_target.py
Comment on lines +10 to +16
class AiTargetManager(
GetMixin, ListMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTManager
):
"""Manage AI Target assets (LLM endpoints / AI agents under adversarial test)."""

_path = "/ai_targets"
_obj_cls = AiTarget
Comment on lines +18 to +21
# AI adversarial validation: correlate AI defense (LLM firewall / guardrail) events back to a
# specific AI inject execution.
SIG_TYPE_AI_REQUEST_MARKER = "ai_request_marker"
SIG_TYPE_AI_TARGET_ENDPOINT = "ai_target_endpoint"
Adds ARTIFICIAL_INTELLIGENCE to SecurityDomains so AI red-team contracts can be bucketed under the AI security domain.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team Item from the Filigran team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ai): add pyoaev support for AI adversarial exposure validation

3 participants