Merge pull request #55 from outis1one/claude/read-repo-YMu21

fix: restore working content.js from v2.0.14, bump 0.9.18
This commit is contained in:
Outis
2026-03-29 13:56:13 -04:00
committed by GitHub
5 changed files with 26 additions and 57 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "Silent Send", "name": "Silent Send",
"version": "0.9.17", "version": "0.9.18",
"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
View File
@@ -1,7 +1,7 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "Silent Send", "name": "Silent Send",
"version": "0.9.17", "version": "0.9.18",
"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
View File
@@ -1,6 +1,6 @@
{ {
"name": "silent-send", "name": "silent-send",
"version": "0.9.17", "version": "0.9.18",
"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",
+22 -53
View File
@@ -287,7 +287,7 @@
} }
// ============================================================ // ============================================================
// Combined substitution: smart patterns + explicit + auto-redact // Combined substitution: smart patterns + explicit + secret scan
// + auto-detect warning for unconfigured PII // + auto-detect warning for unconfigured PII
// ============================================================ // ============================================================
function substituteAll(text) { function substituteAll(text) {
@@ -301,12 +301,12 @@
const explicit = substitute(smart.text, mappings); const explicit = substitute(smart.text, mappings);
allReplacements.push(...explicit.replacements); allReplacements.push(...explicit.replacements);
// 3. Auto Redact (API keys, tokens, SSNs, credit cards, custom patterns, etc.) // 3. Secret scanner (API keys, tokens, SSNs, credit cards, etc.)
let finalText = explicit.text; let finalText = explicit.text;
if (settings.autoRedact !== false) { if (settings.autoRedact !== false) {
const redacted = runAutoRedact(finalText); const secrets = runAutoRedact(finalText);
allReplacements.push(...redacted.redactions); allReplacements.push(...secrets.redactions);
finalText = redacted.text; finalText = secrets.text;
} }
// 4. Auto-detect: scan the FINAL text for unconfigured PII // 4. Auto-detect: scan the FINAL text for unconfigured PII
@@ -672,9 +672,8 @@
} }
// ============================================================ // ============================================================
// Auto Redact (inline for page world) // Secret Scanner (inline for page world)
// Detects API keys, tokens, passwords, SSNs, credit cards, // Detects API keys, tokens, passwords, SSNs, credit cards, etc.
// plus user-defined custom patterns from settings.
// ============================================================ // ============================================================
const REDACT_PATTERNS = [ const REDACT_PATTERNS = [
// OpenAI // OpenAI
@@ -1473,17 +1472,13 @@
// session, preventing false positives (e.g. "user" in AI prose). // session, preventing false positives (e.g. "user" in AI prose).
function buildRevealPairs() { function buildRevealPairs() {
const pairs = []; const pairs = [];
const added = new Set();
// Helper: only add if this substitute was actually sent // Helper: only add if this substitute was actually sent
function addIfUsed(from, to, caseSensitive) { function addIfUsed(from, to, caseSensitive) {
if (!from || !to) return; if (!from || !to) return;
const key = from.toLowerCase(); const entry = sessionSubstitutions.get(from.toLowerCase());
if (added.has(key)) return;
const entry = sessionSubstitutions.get(key);
if (entry) { if (entry) {
pairs.push({ from, to, caseSensitive }); pairs.push({ from, to, caseSensitive });
added.add(key);
} }
} }
@@ -1496,9 +1491,9 @@
for (const e of (identity.emails || [])) { for (const e of (identity.emails || [])) {
addIfUsed(e.substitute, e.real); addIfUsed(e.substitute, e.real);
} }
// For names: DON'T add individual first/last — the smart pattern engine for (const n of (identity.names || [])) {
// combines them (e.g. "Ademo Demo" for "John Smith"). The catch-all addIfUsed(n.substitute, n.real);
// below picks up the combined form from sessionSubstitutions. }
for (const u of (identity.usernames || [])) { for (const u of (identity.usernames || [])) {
addIfUsed(u.substitute, u.real); addIfUsed(u.substitute, u.real);
} }
@@ -1510,45 +1505,27 @@
} }
} }
// Catch-all: add any session substitution not already covered above. // Also add auto-detect and secret scanner substitutions from this session
// This picks up combined names ("Ademo Demo" → "John Smith"),
// auto-detected PII, and auto-redacted secrets.
// Skip entries that are substrings of a longer entry (e.g. "Ademo"
// is part of "Ademo Demo") to prevent partial replacements.
const allKeys = [...sessionSubstitutions.keys()];
for (const [key, entry] of sessionSubstitutions) { for (const [key, entry] of sessionSubstitutions) {
if (added.has(key)) continue; if (!pairs.some(p => p.from.toLowerCase() === key)) {
// Skip if this entry's replaced value is a substring of a longer one pairs.push({ from: entry.replaced, to: entry.original });
const isPartOfLonger = allKeys.some(k => }
k !== key && k.includes(key) && sessionSubstitutions.has(k)
);
if (isPartOfLonger) continue;
pairs.push({ from: entry.replaced, to: entry.original });
added.add(key);
} }
pairs.sort((a, b) => b.from.length - a.from.length); pairs.sort((a, b) => b.from.length - a.from.length);
return pairs; return pairs;
} }
// Cache — invalidate when identity/mappings change or new substitutions happen // Cache — invalidate when config changes or new substitutions happen
// Settings-only updates (e.g. reveal toggle) do NOT invalidate
let _revealPairsCache = null; let _revealPairsCache = null;
let _lastSessionSubsSize = 0; let _revealPairsCacheSize = 0;
window.addEventListener('message', (event) => { window.addEventListener('message', (event) => {
if (event.data?.type === 'ss:config-updated') { if (event.data?.type === 'ss:config-updated') _revealPairsCache = null;
if (event.data.mappings || event.data.identity) _revealPairsCache = null;
}
if (event.data?.type === 'ss:substitution-performed') _revealPairsCache = null; if (event.data?.type === 'ss:substitution-performed') _revealPairsCache = null;
}); });
function getRevealPairs() { function getRevealPairs() {
// Rebuild if cache cleared OR if new substitutions were added if (!_revealPairsCache) _revealPairsCache = buildRevealPairs();
const currentSize = sessionSubstitutions.size;
if (!_revealPairsCache || currentSize !== _lastSessionSubsSize) {
_revealPairsCache = buildRevealPairs();
_lastSessionSubsSize = currentSize;
}
return _revealPairsCache; return _revealPairsCache;
} }
@@ -1698,13 +1675,13 @@
// Elements to skip when revealing (inputs, scripts, styles, extension UI, navigation) // Elements to skip when revealing (inputs, scripts, styles, extension UI, navigation)
const SKIP_REVEAL_TAGS = new Set([ const SKIP_REVEAL_TAGS = new Set([
'SCRIPT', 'STYLE', 'NOSCRIPT', 'IFRAME', 'INPUT', 'TEXTAREA', 'SELECT', 'SCRIPT', 'STYLE', 'NOSCRIPT', 'IFRAME', 'INPUT', 'TEXTAREA', 'SELECT',
'NAV', 'ASIDE', 'HEADER', 'FOOTER',
]); ]);
// Skip reveal in navigation and sidebars — but NOT broadly by class name, // Skip reveal in navigation, sidebars, headers, and other non-chat UI
// as sites like Claude.ai use "header" in class names for chat content areas
function isInNonChatArea(el) { function isInNonChatArea(el) {
if (!el) return false; if (!el) return false;
return !!el.closest('nav, aside, [role="navigation"], [role="complementary"], [data-sidebar]'); return !!el.closest('nav, aside, header, footer, [role="navigation"], [role="banner"], [role="complementary"], [data-sidebar], [class*="sidebar"], [class*="Sidebar"], [class*="nav-"], [class*="Nav"], [class*="menu"], [class*="Menu"], [class*="header"], [class*="Header"]');
} }
// Reveal ALL text on the page + apply highlights // Reveal ALL text on the page + apply highlights
@@ -1818,14 +1795,6 @@
prevRevealMode = settings.revealMode; prevRevealMode = settings.revealMode;
} }
// If reveal mode was already ON at page load, start the interval immediately
if (settings.revealMode) {
console.log('[Silent Send] Reveal mode ON (from saved settings)');
revealInterval = setInterval(() => {
if (settings.revealMode) revealAllResponses();
}, 2000);
}
// Hook into config updates to detect reveal toggle // Hook into config updates to detect reveal toggle
window.addEventListener('message', (event) => { window.addEventListener('message', (event) => {
if (event.source !== window) return; if (event.source !== window) return;
+1 -1
View File
@@ -631,7 +631,7 @@
</section> </section>
<footer> <footer>
<p>Silent Send v0.9.17</p> <p>Silent Send v0.9.18</p>
<p style="font-size:11px;color:#9ca3af;margin-top:6px;max-width:600px"> <p style="font-size:11px;color:#9ca3af;margin-top:6px;max-width:600px">
Silent Send is a convenience tool, not a security guarantee. Third-party sites may change how they send data at any time, which can cause missed substitutions without warning. You are responsible for verifying your data before sending. See the <a href="https://github.com/outis1one/silent-send/blob/main/LICENSE" target="_blank" style="color:#6b7280">LICENSE</a> for full terms. Silent Send is a convenience tool, not a security guarantee. Third-party sites may change how they send data at any time, which can cause missed substitutions without warning. You are responsible for verifying your data before sending. See the <a href="https://github.com/outis1one/silent-send/blob/main/LICENSE" target="_blank" style="color:#6b7280">LICENSE</a> for full terms.
</p> </p>