Skip to content

fix(guardrails): route PII validation through app runtime - #7227

Merged
TheodoreSpeaks merged 2 commits into
stagingfrom
fix/guardrail
Aug 28, 2026
Merged

fix(guardrails): route PII validation through app runtime#7227
TheodoreSpeaks merged 2 commits into
stagingfrom
fix/guardrail

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • Route PII guardrail validation through an authenticated app-runtime capability
  • Keep manual and scheduled execution on the same validation path

Type of Change

  • Bug fix

Testing

  • 41 focused Vitest tests
  • bun run lint
  • Scoped app/auth type-check
  • Block registry and 39 repository audits

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 28, 2026 8:39pm

Request Review

@greptile-apps

greptile-apps Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR routes single-text PII guardrail validation through an authenticated app-runtime capability so foreground and scheduled execution use the same Presidio-reachable path.

  • Adds a bounded, authenticated PII validation endpoint and shared request/response contracts.
  • Adds a cross-runtime validation client with cancellation propagation and bounded response parsing.
  • Preserves PII verdict metadata while converting non-abort capability failures into fail-closed results.
  • Adds input, entity-count, and response-size limits around Presidio processing.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/lib/internal/guardrails/operations.ts Routes PII validation through the HTTP capability and converts non-abort failures into PII-shaped fail-closed results before the wrapper restores verdict metadata.
apps/sim/lib/guardrails/validation-client.ts Implements the authenticated cross-runtime request with input validation, cancellation propagation, bounded response reads, and response-schema validation.
apps/sim/app/api/guardrails/pii/validate/route.ts Adds an auth-before-parse app boundary that invokes Presidio validation with request cancellation and validates the returned contract.
apps/sim/lib/guardrails/validate_pii.ts Adds strict Presidio response validation and bounded materialization while preserving fail-closed behavior.
apps/sim/lib/api/contracts/hotspots.ts Defines strict bounded request and response schemas for the single-text PII capability.

Sequence Diagram

sequenceDiagram
  participant Runtime as Workflow runtime
  participant Client as PII validation client
  participant App as Authenticated app endpoint
  participant Presidio as Internal Presidio service
  Runtime->>Client: Validate text with cancellation signal
  Client->>App: POST /api/guardrails/pii/validate + internal JWT
  App->>App: Authenticate and validate bounded input
  App->>Presidio: Analyze and optionally anonymize
  Presidio-->>App: Bounded validation result
  App-->>Client: Schema-validated verdict
  Client-->>Runtime: PII result
  alt Non-abort capability failure
    Runtime->>Runtime: Return fail-closed PII verdict with original metadata
  end
Loading

Reviews (3): Last reviewed commit: "fix(guardrails): bound PII validation re..." | Re-trigger Greptile

Comment thread apps/sim/lib/guardrails/validation-client.ts
Comment thread apps/sim/app/api/guardrails/pii/validate/route.ts
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 7 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/api/contracts/hotspots.ts Outdated
Comment thread apps/sim/lib/api/contracts/hotspots.ts Outdated
Comment thread apps/sim/lib/internal/guardrails/operations.ts Outdated
Comment thread apps/sim/lib/guardrails/validation-client.ts
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks
TheodoreSpeaks merged commit 1ade0f4 into staging Aug 28, 2026
26 checks passed
@TheodoreSpeaks
TheodoreSpeaks deleted the fix/guardrail branch August 28, 2026 22:20
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.

1 participant