Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34fafaefda | ||
|
|
556aee1d6d | ||
|
|
20250278bc | ||
|
|
5666348c57 | ||
|
|
459130b049 |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "Silent Send",
|
"name": "Silent Send",
|
||||||
"version": "0.9.46",
|
"version": "0.9.47",
|
||||||
"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.46",
|
"version": "0.9.47",
|
||||||
"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.46",
|
"version": "0.9.47",
|
||||||
"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",
|
||||||
|
|||||||
+3
-1
@@ -86,7 +86,9 @@ for attempt in $(seq 1 $MAX_ATTEMPTS); do
|
|||||||
echo "=== Attempt $attempt: signing v$NEW_VERSION ==="
|
echo "=== Attempt $attempt: signing v$NEW_VERSION ==="
|
||||||
|
|
||||||
# Capture output to check for specific errors
|
# Capture output to check for specific errors
|
||||||
OUTPUT=$(npx web-ext sign \
|
# NODE_OPTIONS forces IPv4 DNS resolution first — Node.js 18+ defaults to IPv6,
|
||||||
|
# which silently fails when the system can't reach addons.mozilla.org over IPv6.
|
||||||
|
OUTPUT=$(NODE_OPTIONS='--dns-result-order=ipv4first' npx web-ext sign \
|
||||||
--no-config-discovery \
|
--no-config-discovery \
|
||||||
--source-dir "$SCRIPT_DIR/dist/firefox" \
|
--source-dir "$SCRIPT_DIR/dist/firefox" \
|
||||||
--artifacts-dir "$SCRIPT_DIR/dist/firefox-signed" \
|
--artifacts-dir "$SCRIPT_DIR/dist/firefox-signed" \
|
||||||
|
|||||||
+26
-19
@@ -51,8 +51,8 @@
|
|||||||
|
|
||||||
for (const m of sorted) {
|
for (const m of sorted) {
|
||||||
if (!m.enabled || !m.real?.trim() || !m.substitute?.trim()) continue;
|
if (!m.enabled || !m.real?.trim() || !m.substitute?.trim()) continue;
|
||||||
const pattern = wordBoundary(m.real);
|
const escaped = esc(m.real);
|
||||||
const regex = new RegExp(pattern, m.caseSensitive ? 'g' : 'gi');
|
const regex = new RegExp(escaped, m.caseSensitive ? 'g' : 'gi');
|
||||||
let match;
|
let match;
|
||||||
while ((match = regex.exec(result)) !== null) {
|
while ((match = regex.exec(result)) !== null) {
|
||||||
replacements.push({
|
replacements.push({
|
||||||
@@ -71,8 +71,8 @@
|
|||||||
const sorted = [...maps].sort((a, b) => b.substitute.length - a.substitute.length);
|
const sorted = [...maps].sort((a, b) => b.substitute.length - a.substitute.length);
|
||||||
for (const m of sorted) {
|
for (const m of sorted) {
|
||||||
if (!m.enabled || !m.real?.trim() || !m.substitute?.trim()) continue;
|
if (!m.enabled || !m.real?.trim() || !m.substitute?.trim()) continue;
|
||||||
const pattern = wordBoundary(m.substitute);
|
const escaped = esc(m.substitute);
|
||||||
const regex = new RegExp(pattern, m.caseSensitive ? 'g' : 'gi');
|
const regex = new RegExp(escaped, m.caseSensitive ? 'g' : 'gi');
|
||||||
result = result.replace(regex, m.real);
|
result = result.replace(regex, m.real);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -82,15 +82,6 @@
|
|||||||
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add \b only on word-character edges so "not" doesn't match inside "nothing",
|
|
||||||
// while leaving non-word edges (e.g. "@foo") alone since they self-delimit.
|
|
||||||
function wordBoundary(str) {
|
|
||||||
const escaped = esc(str);
|
|
||||||
const left = /^\w/.test(str) ? '\\b' : '';
|
|
||||||
const right = /\w$/.test(str) ? '\\b' : '';
|
|
||||||
return left + escaped + right;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// Smart Pattern Engine (inline for page world)
|
// Smart Pattern Engine (inline for page world)
|
||||||
// ============================================================
|
// ============================================================
|
||||||
@@ -358,6 +349,22 @@
|
|||||||
|
|
||||||
const CONTEXT_WORDS_RE = /\b(?:born|birthday|dob|birth|passport|license|driver|ssn|social\s*security|address|zip|postal|date\s+of\s+birth)\b/i;
|
const CONTEXT_WORDS_RE = /\b(?:born|birthday|dob|birth|passport|license|driver|ssn|social\s*security|address|zip|postal|date\s+of\s+birth)\b/i;
|
||||||
|
|
||||||
|
// Some patterns (home paths, shell prompts, git remotes, env var assignments)
|
||||||
|
// match a compound string that only *contains* a configured value rather
|
||||||
|
// than equaling it exactly (e.g. "/home/johnsmith" contains the configured
|
||||||
|
// username "johnsmith"). A plain Set.has() exact-match check never fires
|
||||||
|
// for these, so the same configured value gets flagged as "unconfigured"
|
||||||
|
// every time. Length-gated to avoid short tokens suppressing unrelated
|
||||||
|
// findings via accidental substring collision.
|
||||||
|
function matchesConfiguredValue(value, configured) {
|
||||||
|
const lower = value.toLowerCase();
|
||||||
|
if (configured.has(lower)) return true;
|
||||||
|
for (const c of configured) {
|
||||||
|
if (c.length >= 3 && lower.includes(c)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Common English words that are capitalized but aren't proper nouns.
|
// Common English words that are capitalized but aren't proper nouns.
|
||||||
// Used by the proper noun heuristic to reduce false positives.
|
// Used by the proper noun heuristic to reduce false positives.
|
||||||
const COMMON_CAPITALIZED = new Set([
|
const COMMON_CAPITALIZED = new Set([
|
||||||
@@ -496,7 +503,7 @@
|
|||||||
let m;
|
let m;
|
||||||
while ((m = pat.re.exec(text)) !== null) {
|
while ((m = pat.re.exec(text)) !== null) {
|
||||||
const val = m[0];
|
const val = m[0];
|
||||||
if (configured.has(val.toLowerCase())) continue;
|
if (matchesConfiguredValue(val, configured)) continue;
|
||||||
if (pat.skip && pat.skip.test(val)) continue;
|
if (pat.skip && pat.skip.test(val)) continue;
|
||||||
findings.push({ name: pat.name, value: val, hint: pat.hint, category: pat.cat });
|
findings.push({ name: pat.name, value: val, hint: pat.hint, category: pat.cat });
|
||||||
}
|
}
|
||||||
@@ -1052,8 +1059,8 @@
|
|||||||
const pairs = getRevealPairs();
|
const pairs = getRevealPairs();
|
||||||
let result = text;
|
let result = text;
|
||||||
for (const p of pairs) {
|
for (const p of pairs) {
|
||||||
const pattern = wordBoundary(p.from);
|
const escaped = esc(p.from);
|
||||||
const regex = new RegExp(pattern, p.caseSensitive ? 'g' : 'gi');
|
const regex = new RegExp(escaped, p.caseSensitive ? 'g' : 'gi');
|
||||||
result = result.replace(regex, p.to);
|
result = result.replace(regex, p.to);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -1094,9 +1101,9 @@
|
|||||||
const pairs = getRevealPairs();
|
const pairs = getRevealPairs();
|
||||||
let result = text;
|
let result = text;
|
||||||
for (const p of pairs) {
|
for (const p of pairs) {
|
||||||
const pattern = wordBoundary(p.to);
|
const escaped = esc(p.to); // p.to is the real value
|
||||||
const regex = new RegExp(pattern, p.caseSensitive ? 'g' : 'gi');
|
const regex = new RegExp(escaped, p.caseSensitive ? 'g' : 'gi');
|
||||||
result = result.replace(regex, p.from);
|
result = result.replace(regex, p.from); // p.from is the substitute
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-1
@@ -129,6 +129,22 @@ const PII_PATTERNS = [
|
|||||||
// Context words that make ambiguous patterns more likely to be PII
|
// Context words that make ambiguous patterns more likely to be PII
|
||||||
const CONTEXT_WORDS = /\b(?:born|birthday|dob|birth|passport|license|driver|ssn|social\s*security|address|home|live|lives|reside|zip|postal)\b/i;
|
const CONTEXT_WORDS = /\b(?:born|birthday|dob|birth|passport|license|driver|ssn|social\s*security|address|home|live|lives|reside|zip|postal)\b/i;
|
||||||
|
|
||||||
|
// Some patterns (home paths, shell prompts, git remotes, env var assignments)
|
||||||
|
// match a compound string that only *contains* a configured value rather than
|
||||||
|
// equaling it exactly (e.g. "/home/johnsmith" contains the configured
|
||||||
|
// username "johnsmith"). A plain Set.has() exact-match check never fires for
|
||||||
|
// these, so the same configured value gets flagged as "unconfigured" every
|
||||||
|
// time. Length-gated to avoid short tokens (e.g. a 2-char substitute)
|
||||||
|
// suppressing unrelated findings via accidental substring collision.
|
||||||
|
function matchesConfiguredValue(value, configured) {
|
||||||
|
const lower = value.toLowerCase();
|
||||||
|
if (configured.has(lower)) return true;
|
||||||
|
for (const c of configured) {
|
||||||
|
if (c.length >= 3 && lower.includes(c)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const AutoDetect = {
|
const AutoDetect = {
|
||||||
/**
|
/**
|
||||||
* Scan text for potential unconfigured PII.
|
* Scan text for potential unconfigured PII.
|
||||||
@@ -178,7 +194,7 @@ const AutoDetect = {
|
|||||||
const value = match[0];
|
const value = match[0];
|
||||||
|
|
||||||
// Skip if already configured
|
// Skip if already configured
|
||||||
if (configured.has(value.toLowerCase())) continue;
|
if (matchesConfiguredValue(value, configured)) continue;
|
||||||
|
|
||||||
// Skip excluded values (like 127.0.0.1)
|
// Skip excluded values (like 127.0.0.1)
|
||||||
if (pattern.exclude && pattern.exclude.test(value)) continue;
|
if (pattern.exclude && pattern.exclude.test(value)) continue;
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ const SubstitutionEngine = {
|
|||||||
for (const mapping of sorted) {
|
for (const mapping of sorted) {
|
||||||
if (!mapping.enabled || !mapping.real?.trim() || !mapping.substitute?.trim()) continue;
|
if (!mapping.enabled || !mapping.real?.trim() || !mapping.substitute?.trim()) continue;
|
||||||
|
|
||||||
const pattern = this._wordBoundaryPattern(mapping.real);
|
const escaped = this._escapeRegex(mapping.real);
|
||||||
const regex = new RegExp(pattern, mapping.caseSensitive ? 'g' : 'gi');
|
const regex = new RegExp(escaped, mapping.caseSensitive ? 'g' : 'gi');
|
||||||
let match;
|
let match;
|
||||||
|
|
||||||
while ((match = regex.exec(result)) !== null) {
|
while ((match = regex.exec(result)) !== null) {
|
||||||
@@ -56,8 +56,8 @@ const SubstitutionEngine = {
|
|||||||
for (const mapping of sorted) {
|
for (const mapping of sorted) {
|
||||||
if (!mapping.enabled || !mapping.real?.trim() || !mapping.substitute?.trim()) continue;
|
if (!mapping.enabled || !mapping.real?.trim() || !mapping.substitute?.trim()) continue;
|
||||||
|
|
||||||
const pattern = this._wordBoundaryPattern(mapping.substitute);
|
const escaped = this._escapeRegex(mapping.substitute);
|
||||||
const regex = new RegExp(pattern, mapping.caseSensitive ? 'g' : 'gi');
|
const regex = new RegExp(escaped, mapping.caseSensitive ? 'g' : 'gi');
|
||||||
result = result.replace(regex, mapping.real);
|
result = result.replace(regex, mapping.real);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,8 +73,8 @@ const SubstitutionEngine = {
|
|||||||
for (const mapping of mappings) {
|
for (const mapping of mappings) {
|
||||||
if (!mapping.enabled || !mapping.real?.trim()) continue;
|
if (!mapping.enabled || !mapping.real?.trim()) continue;
|
||||||
|
|
||||||
const pattern = this._wordBoundaryPattern(mapping.real);
|
const escaped = this._escapeRegex(mapping.real);
|
||||||
const regex = new RegExp(pattern, mapping.caseSensitive ? 'g' : 'gi');
|
const regex = new RegExp(escaped, mapping.caseSensitive ? 'g' : 'gi');
|
||||||
|
|
||||||
if (regex.test(text)) {
|
if (regex.test(text)) {
|
||||||
found.push({
|
found.push({
|
||||||
@@ -105,8 +105,8 @@ const SubstitutionEngine = {
|
|||||||
for (const mapping of sorted) {
|
for (const mapping of sorted) {
|
||||||
if (!mapping.enabled || !mapping.real?.trim() || !mapping.substitute?.trim()) continue;
|
if (!mapping.enabled || !mapping.real?.trim() || !mapping.substitute?.trim()) continue;
|
||||||
|
|
||||||
const pattern = this._wordBoundaryPattern(mapping.real);
|
const escaped = this._escapeRegex(mapping.real);
|
||||||
const regex = new RegExp(pattern, mapping.caseSensitive ? 'g' : 'gi');
|
const regex = new RegExp(escaped, mapping.caseSensitive ? 'g' : 'gi');
|
||||||
let match;
|
let match;
|
||||||
|
|
||||||
while ((match = regex.exec(original)) !== null) {
|
while ((match = regex.exec(original)) !== null) {
|
||||||
@@ -145,16 +145,6 @@ const SubstitutionEngine = {
|
|||||||
_escapeRegex(str) {
|
_escapeRegex(str) {
|
||||||
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||||
},
|
},
|
||||||
|
|
||||||
// Wrap an escaped literal in \b only on edges that are word characters,
|
|
||||||
// so "not" → "bad" matches "not" but not "nothing", while mappings whose
|
|
||||||
// edges aren't word chars (e.g. "@foo", "foo.com ") still work.
|
|
||||||
_wordBoundaryPattern(str) {
|
|
||||||
const escaped = this._escapeRegex(str);
|
|
||||||
const left = /^\w/.test(str) ? '\\b' : '';
|
|
||||||
const right = /\w$/.test(str) ? '\\b' : '';
|
|
||||||
return left + escaped + right;
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Support both module and content-script contexts
|
// Support both module and content-script contexts
|
||||||
|
|||||||
@@ -345,18 +345,6 @@ test('Disabled mapping is skipped', () => {
|
|||||||
if (result.text.includes('Alex Demo')) throw 'Disabled mapping should not substitute';
|
if (result.text.includes('Alex Demo')) throw 'Disabled mapping should not substitute';
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Mapping matches whole words only', () => {
|
|
||||||
const result = SubstitutionEngine.substitute('nothing is not a thing, not even this', [
|
|
||||||
{ real: 'not', substitute: 'bad', enabled: true }
|
|
||||||
]);
|
|
||||||
if (result.text.includes('bahing') || result.text.includes('badhing')) {
|
|
||||||
throw `Should not match inside "nothing", got: ${result.text}`;
|
|
||||||
}
|
|
||||||
if (!/\bbad\b/.test(result.text)) {
|
|
||||||
throw `Should still match standalone "not", got: ${result.text}`;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// SMART PATTERNS
|
// SMART PATTERNS
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user