On-device sensitive-detail detection + redaction (pre-send) - #32
Merged
Conversation
…ction Scan captured text and screen frames on-device before Analyze sends anything to GitHub Copilot, and redact whatever looks sensitive. - Text: secretlint (secrets) + checksum-validated structured-PII regex (email, credit-card+Luhn, SSN, phone) run inside the Analyze IPC handler and mask every outgoing describer tool field (get_timeline/get_events/get_narration) through a longest-first literal redactor. Non-blocking: Analyze always proceeds and returns a masked SensitiveReport for review. - Frames (Advanced protection, on by default): Tesseract.js OCR locates on-screen secrets/PII, plus entropy/credential-assignment heuristics and cross-feed of known text values; sharp blurs the matched boxes before any JPEG leaves the machine. Fail-closed: frames are withheld while OCR is provisioning or errored. OCR model pinned to an immutable commit and verified by SHA-256 before use. - The report persists next to the session (masked values + counts only, never raw) so it survives reopening an analyzed session. - Evals: evals/sensitive/* (hermetic run + real-image OCR + degraded-frame realistic gates). Adds @secretlint/* and tesseract.js(+core); the tesseract.js install script is reviewed and denied (opencollective banner, not needed). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 75a0080c-95f1-499f-b3b5-48d5a1ee29cb
adilei
force-pushed
the
adilei-local-sensitive-detail-highlighting
branch
from
August 6, 2026 08:18
45651b2 to
b009002
Compare
Pin OCR and Artistic dependency notices and source materials in the fail-closed release compliance bundle. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
adilei
marked this pull request as ready for review
August 6, 2026 10:27
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.
⛔ DO NOT MERGE — work-in-progress checkpoint
Opened to capture in-progress work on on-device sensitive-detail detection + redaction so we can pick it up later. This branch does not typecheck and is not runnable as-is (see Current state). It is a design + partial-implementation snapshot, not a reviewable change.
Goal
Detect and auto-redact sensitive/problematic details (secrets, PII, names) on-device before Skill Recorder sends captured session data to GitHub Copilot on Analyze. Fully local, MIT-compatible, and non-blocking — Analyze never stops; flagged values are redacted in the outgoing text and reported as "Redacted N details".
Design (locked)
Three detection layers → one non-blocking redactor:
@secretlint/core+ preset-recommend + pattern rule) — provider secrets, always on. AWS ID scan enabled (enableIDScanRule: true); JWTs via a custom pattern rule.common/sensitive.ts) — structured PII: email, credit-card (Luhn), SSN, phone. Always on, renderer-safe.Xenova/bert-base-NER(transformers.js, dtypeq8→model_quantized.onnx) — person/location/org. Opt-in "Advanced protection" toggle that downloads the model; never blocks Analyze (getPipelineForScan()returns null until cached).Overlapping matches collapse via
resolveOverlapsby rank (secrets 90 > structured-PII 40–55 > NER 30). UI report masks values (maskValue, 2+2 reveal); outgoing text is redacted with non-revealing••••.🚧 Why this is paused — architectural gap
get_framessends screen JPEGs inline to the model, and the LLM extracts data directly from those images — we have no OCR. So text-only redaction can't touch a secret that's visible on screen: we'd mask the text while shipping a screenshot of the same secret. Text redaction still uniquely covers voice narration, clipboard, and unsampled/off-screen text, but the feature is incomplete for on-screen secrets.Decision needed before resuming (any of):
sharp(already a dep). ~1–3 s/frame CPU + one dep.Current state
common/sensitive.ts— rewritten to v2 core (types + masking + structured-PII + generalizedresolveOverlaps). Detectors verified by hand.q8,enableCpuMemArena:falserequired under Electron).electron/sensitive/scanner.ts,common/sensitive.test.ts,electron/sensitive/scanner.test.ts,src/SensitiveReview.tsx, and the IPC/UI wiring reference removed v1 symbols (scanText,shannonEntropy,high-entropy). 6 knowntscerrors.Remaining work (bottom-up)
electron/sensitive/:secretlint-config.ts,secrets.ts,ner-model.ts,ner.ts,model-manager.ts(mirrorelectron/narration/{whisper,manager}.ts).scanner.ts→ asyncscanSession(id, nerPipeline?) → { report, values[] }merging all 3 layers.describer/{describer,tools}.ts(wrapget_timeline/get_events/get_narration); remove the blocking gate incommon/ipc.ts+electron/ipc.ts; wireSensitiveModelManager+ sensitive IPC channels inmain.ts/preload.cjs.SensitiveReview.tsx,Library.tsx,App.css).evals/sensitive/{corpus,score,run}.ts— LLM-free detection precision/recall + redaction leak-check; NER cases gated on cache.npm run compliance:preparefor new MIT deps + THIRD-PARTY notices; attributebert-base-NER. Review the secretlint transitivenpm auditfindings.How to resume
common/sensitive.tsis the source of truth for the v2 core. Implement theelectron/sensitive/*modules, then flip the scanner + tests + UI off the v1 symbols untilnpm run typecheckandnpm testpass. Detailed design notes and grounded API facts live in the session's plan doc.Co-authored-by: Copilot