Skip to content

[New Plugin] Asqav - Quantum-safe audit trails#1580

Open
jagmarques wants to merge 1 commit intoPortkey-AI:mainfrom
jagmarques:feat/asqav-guardrail
Open

[New Plugin] Asqav - Quantum-safe audit trails#1580
jagmarques wants to merge 1 commit intoPortkey-AI:mainfrom
jagmarques:feat/asqav-guardrail

Conversation

@jagmarques
Copy link
Copy Markdown

Closes #1577

What this does

Adds an asqav guardrail plugin that signs every request and response with quantum-safe ML-DSA-65 signatures (NIST FIPS 204), creating tamper-proof audit trails with public verification URLs.

How it works

  • On beforeRequestHook: signs the outgoing request with the agent's key
  • On afterRequestHook: signs the incoming response
  • Each signed record gets a public verification URL for independent proof
  • Fails open by default (configurable) so signing issues never block traffic

Files

  • plugins/asqav/auditLog.ts - guardrail handler
  • plugins/asqav/manifest.json - plugin metadata
  • plugins/asqav/auditLog.test.ts - tests
  • plugins/index.ts - registration

Parameters

Parameter Type Default Description
agentId string portkey-gateway Agent identifier for audit records
includeContent boolean false Include request/response content in signed record
failOpen boolean true Continue if signing fails
timeout number 5000 API timeout in ms

Test results

PASS plugins/asqav/auditLog.test.ts
  asqav auditLog handler
    ✓ should fail with missing API key
    ✓ should fail closed when failOpen is false and API key is missing
    ✓ should use custom agentId from parameters
    ✓ should handle both beforeRequest and afterRequest hooks

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 815613599f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +35 to +36
const agentId =
parameters.agentId || context.metadata?.agentId || 'portkey-gateway';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Derive agent ID from trusted config only

When parameters.agentId is not set, this falls back to context.metadata?.agentId, but context.metadata is populated from the caller-provided x-portkey-metadata header (RequestContext.metadata). That lets any client spoof the X-Agent-Id used for signing, so audit records can be attributed to arbitrary agents and lose integrity guarantees.

Useful? React with 👍 / 👎.

const agentId =
parameters.agentId || context.metadata?.agentId || 'portkey-gateway';

const text = getText(context, eventType);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Sign the full request/response payload

Using getText(context, eventType) hashes only the “current content part” rather than the complete payload (for chat requests this is just the last message, and for chat responses only the first choice). In multi-turn chats or n>1 responses, changes outside that slice won’t affect the signature, so the plugin can report a valid audit signature for partially tampered traffic.

Useful? React with 👍 / 👎.

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.

Integration: Quantum-safe audit trails with asqav

1 participant