Repository navigation
fix(pii): mask texts over spaCy's length limit and drop encoded files from logs - #9979
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge; no actionable issues remain from this review. SummaryHandles text beyond spaCy's length limit and removes encoded file bodies from execution logs.
Reviews (4) · Last reviewed commit: "fix(pii): keep every NER window's spans ..." · Reviewed by Greptile |
b8b946e to
5ff04d2
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 9 files
Confidence score: 4/5
- The oversized-text and binary-log checks in
apps/sim/scripts/test-pii-redaction-e2e.tswon't run automatically because the script isn't registered in the package or CI workflows. Add an entry that provides the required service and environment.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/sim/scripts/test-pii-redaction-e2e.ts">
<violation number="1" location="apps/sim/scripts/test-pii-redaction-e2e.ts:1">
P2: This E2E script is not registered in `apps/sim/package.json` and no workflow invokes it, so the oversized-text and binary-log checks never run automatically. Add a package or CI entry with the required service and environment setup.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
…ong for one NER pass
…acement to the log - Presidio runs pattern and custom recognizers over the whole text and spaCy NER in overlapping windows when a text exceeds spaCy's max_length, so no match can straddle a cut; the app no longer splits texts - Encoded file bodies are replaced only in the execution log (explicit replaceEncodedBinary option set by the log entry points); live data keeps every string on the masking path - Data URL headers are parsed through the first comma, and log-mode detection no longer requires mixed character classes - e2e: setup failures are recorded in the report
…ata: case-insensitively - Long-text NER windows also run the pattern entities when a score_threshold is set, so context-boosted matches clear it as they do on short texts - The data: URI scheme is matched case-insensitively - e2e asserts each name is masked as one <PERSON> span and is registered as test:pii-redaction:e2e
5ff04d2 to
aefa16a
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
…ur found them NER reads context, so a window can find a name the previous one missed or cut short; spans are now only deduplicated by exact position, and overlapping spans are left to the anonymizer to merge
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
max_length(1,000,000) instead of failing with E088 → 500. Pattern, checksum, and custom recognizers run once over the whole text (they have no length limit, so no match can straddle a cut). Only spaCy NER runs in 100k-character windows that overlap by 1,000 characters, with spans shifted to whole-text offsets and merged. Texts under the limit and regex-only requests take exactly the same path as beforedata:URLs, and bare base64 ≥1 KiB, optionally wrapped) are replaced with[BINARY_CONTENT_REDACTED]in the execution log only. That is an explicitreplaceEncodedBinaryoption set by the log entry points (redactPIIFromExecution,redactLargeValueRefs). Text masking can't see PII inside a file, and replacing can only over-redact. Live data (workflow input, block outputs, memory) keeps every string on the masking path, so nothing skips redaction because of its shapeType of Change
Testing
apps/sim/scripts/test-pii-redaction-e2e.tsagainst a running app plus a real Presidio container (docker/pii.Dockerfile), report written toPII_E2E_REPORT_PATH[REDACTION_FAILED], and live block output aborts the run after ~62s_analyze_longwith a marker at 14 window-edge offsets: 14/14 found exactly oncebun run --cwd apps/sim teston the PII files: 66 passed. Biome,check:explicit-any,check:comment-hygiene,check:utils,check:test-patterns,check:file-namespass locally; full lint/type-check/check:auditsrun in CIChecklist
test-auditauthoring gate)