feat(governance): Governance: PII Scan node with deterministic tealtiger guardrails - #549
Open
CodeBhavyaG wants to merge 1 commit into
Open
CodeBhavyaG wants to merge 1 commit into
CodeBhavyaG wants to merge 1 commit into
Conversation
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #547
Summary
Adds a Governance: PII Scan plugin node that enforces deterministic
guardrails on graph execution, backed by the
tealtigerpackage(>=1.5.0, Apache-2.0) — no LLM calls, no network, sub-2.5ms per evaluation.
Node features
observe(fail-open, report only) /monitor/enforcedetect(report only) /redact(typed tokens:[REDACTED_SSN]) /blockOutputs:
output(transformed text),decision(
{action: ALLOW|REDACT|DENY, findings[], risk_score, mode, detect_types, correlation_id, latency_ms}),blocked(boolean).The
decisionobject doubles as a per-execution audit record, per thegovernance design in the issue. Observe mode never transforms or blocks;
tealtiger errors fail open and surface as a
tealtiger-errorfindinginstead of crashing the graph.
Bugs hit along the way (and fixes)
{pii: true, ...}flagsdon't exist on
TealGuardConfig; a fresh TealGuard registers nothing.Fixed by registering
PIIDetectionGuardrailexplicitly.(
redact/mask)TealGuard.check()collapses the guardrail result toALLOW / risk 0and discardsdetections[]/redactedText. Fixed bywiring
GuardrailEngine+PIIDetectionGuardraildirectly.builtins (
fs,crypto) and unused provider SDKs whose trees areNode-only (aws-sdk, google genai, cohere). Fixed in the app via the
importexport condition, browser shims for fs/crypto (crypto-jsbased), and stubs for the unused SDKs. Note for tealtiger maintainers:
an unknown
detectTypeskey failing silently is a footgun worththrowing on.
Files changed
packages/core/src/plugins/governance/— new plugin +GovernanceNodepackages/core/src/plugins.ts,packages/app/src/plugins.ts— plugin registrationpackages/core/package.json—tealtiger@^1.5.0dependencypackages/app/vite.config.ts— ESM condition + browser aliasespackages/app/src/shims/nodeBuiltins.ts— fs/crypto shims + provider stubspackages/app/package.json—crypto-js(shim)yarn.lock— lockfileHow to test
1. Unit tests
2. In the Rivet app
yarn dev # vite dev app (the installed desktop app won't include this)3. Latency
Each evaluation is pure regex: 0.2–2.5ms (measured), deterministic across runs.