Merge pull request #78 from outis1one/clDemoe/fix-pii-mapping-persist-5qJzt
Cl demoe/fix pii mapping persist 5q jzt
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "Silent Send",
|
"name": "Silent Send",
|
||||||
"version": "0.9.45",
|
"version": "0.9.46",
|
||||||
"description": "Intercepts personal info and substitutes it with user-defined replacements before sending to AI services.",
|
"description": "Intercepts personal info and substitutes it with user-defined replacements before sending to AI services.",
|
||||||
"browser_specific_settings": {
|
"browser_specific_settings": {
|
||||||
"gecko": {
|
"gecko": {
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "Silent Send",
|
"name": "Silent Send",
|
||||||
"version": "0.9.45",
|
"version": "0.9.46",
|
||||||
"description": "Intercepts personal info and substitutes it with user-defined replacements before sending to AI services.",
|
"description": "Intercepts personal info and substitutes it with user-defined replacements before sending to AI services.",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"storage",
|
"storage",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "silent-send",
|
"name": "silent-send",
|
||||||
"version": "0.9.45",
|
"version": "0.9.46",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "Browser extension that substitutes personal data before sending to AI services",
|
"description": "Browser extension that substitutes personal data before sending to AI services",
|
||||||
|
|||||||
+23
-3
@@ -280,7 +280,7 @@
|
|||||||
// 4. Auto-detect: scan the FINAL text for unconfigured PII
|
// 4. Auto-detect: scan the FINAL text for unconfigured PII
|
||||||
// Auto-redact if enabled, otherwise just warn
|
// Auto-redact if enabled, otherwise just warn
|
||||||
if (settings.autoDetect !== false) {
|
if (settings.autoDetect !== false) {
|
||||||
const warnings = autoDetectPII(finalText, identity, { detectProperNouns: settings.detectProperNouns === true })
|
const warnings = autoDetectPII(finalText, identity, { detectProperNouns: settings.detectProperNouns === true, mappings })
|
||||||
.filter(w => !ignoredDetections.has(w.value));
|
.filter(w => !ignoredDetections.has(w.value));
|
||||||
if (warnings.length > 0) {
|
if (warnings.length > 0) {
|
||||||
// Auto-redact detected PII in the outbound text
|
// Auto-redact detected PII in the outbound text
|
||||||
@@ -471,6 +471,14 @@
|
|||||||
addAll(ident.names); addAll(ident.emails);
|
addAll(ident.names); addAll(ident.emails);
|
||||||
addAll(ident.usernames); addAll(ident.hostnames); addAll(ident.phones);
|
addAll(ident.usernames); addAll(ident.hostnames); addAll(ident.phones);
|
||||||
}
|
}
|
||||||
|
// Also skip values covered by mappings (both real and substitute)
|
||||||
|
if (opts?.mappings) {
|
||||||
|
for (const m of opts.mappings) {
|
||||||
|
if (!m.enabled) continue;
|
||||||
|
if (m.real) configured.add(m.real.toLowerCase());
|
||||||
|
if (m.substitute) configured.add(m.substitute.toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const findings = [];
|
const findings = [];
|
||||||
for (const pat of PII_PATTERNS) {
|
for (const pat of PII_PATTERNS) {
|
||||||
@@ -1412,7 +1420,19 @@
|
|||||||
preSendWarningEl.classList.remove('visible');
|
preSendWarningEl.classList.remove('visible');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to mappings via background script (handles encryption)
|
// Optimistically add to local mappings so re-scan skips this value
|
||||||
|
const tempMapping = {
|
||||||
|
id: crypto.randomUUID(),
|
||||||
|
real, substitute: fake,
|
||||||
|
category: cat,
|
||||||
|
caseSensitive: false,
|
||||||
|
enabled: true,
|
||||||
|
createdAt: Date.now(),
|
||||||
|
};
|
||||||
|
mappings = [...mappings, tempMapping];
|
||||||
|
|
||||||
|
// Persist via background script (handles encryption);
|
||||||
|
// update local mappings with the authoritative list on success
|
||||||
addMappingViaBackground({ real, substitute: fake, category: cat })
|
addMappingViaBackground({ real, substitute: fake, category: cat })
|
||||||
.then(updatedMappings => {
|
.then(updatedMappings => {
|
||||||
if (updatedMappings.length) mappings = updatedMappings;
|
if (updatedMappings.length) mappings = updatedMappings;
|
||||||
@@ -1509,7 +1529,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const warnings = autoDetectPII(text, identity, { detectProperNouns: settings.detectProperNouns === true })
|
const warnings = autoDetectPII(text, identity, { detectProperNouns: settings.detectProperNouns === true, mappings })
|
||||||
.filter(w => !ignoredDetections.has(w.value));
|
.filter(w => !ignoredDetections.has(w.value));
|
||||||
if (warnings.length > 0) {
|
if (warnings.length > 0) {
|
||||||
showPreSendWarning(warnings, target);
|
showPreSendWarning(warnings, target);
|
||||||
|
|||||||
Reference in New Issue
Block a user