feat(nullpii): mask template syntax ranges from PII detection#44
Open
lBroth wants to merge 1 commit into
Open
Conversation
After PR #43 stripped the PUA sentinels around user-authored `{{...}}`, the GLiNER model still tagged template variable names (`short-kebab-case-slug`, `user_name`, …) as `private_person`. Vault substitution then nested the PII placeholder inside the user's template, producing bracket-broken output like `{{{{PII_PRIVATE_PERSON_*}}}}`. This adds a post-filter that finds the syntactic ranges of common templating dialects and drops any span overlapping one of them: - `{{ ... }}` (Mustache / Handlebars / Vue / Jinja2 expression) - `${ ... }` (JS / TS template literal) - `<% ... %>` (ERB / EJS) - `{% ... %}` (Jinja2 / Twig statement) Partial overlap counts — a span crossing `}}` would also corrupt bracket count after vault substitution. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
After #43 stripped the PUA sentinels around user-authored
{{...}}, the GLiNER model still tagged template variable names (short-kebab-case-slug,user_name, …) asprivate_person. Vault substitution then nested the PII placeholder inside the user's template, producing bracket-broken output like{{{{PII_PRIVATE_PERSON_*}}}}.This adds a post-filter that finds the syntactic ranges of common templating dialects and drops any span overlapping one of them:
{{ ... }}— Mustache / Handlebars / Vue / Jinja2 expression${ ... }— JS / TS template literal<% ... %>— ERB / EJS{% ... %}— Jinja2 / Twig statementPartial overlap counts — a span crossing
}}would also corrupt bracket count after vault substitution.Files
src/template-mask.ts(new) —findTemplateRanges,dropSpansInsideTemplatessrc/nullpii.ts— wire post-applyThresholds, pre-refineSpanBoundariestest/template-mask.test.ts(new) — 11 unit teststest/nullpii.test.ts— integration: recognizer FP inside{{...}}gets maskedTest plan
npm test— 283 passing (was 271)npm run typecheck/lint/build— clean{{short-kebab-case-slug}}survives round-trip without nested-brace garbageNotes
{{ {{x}} }}resolves on inner pair (acceptable trade-off; outer becomes bare braces which GLiNER no longer sentinel-confuses).🤖 Generated with Claude Code