Initial build: Agentjacking Shield Chrome extension MVP

This commit is contained in:
Bun Bun
2026-06-19 00:27:14 +00:00
commit 225ca3caca
20 changed files with 3361 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
import fs from 'fs';
import path from 'path';
const SECRET_PATTERNS = [
/eyJ[A-Za-z0-9_-]{20,}/,
/sk-[A-Za-z0-9]{20,}/,
/token\s*[:=]\s*["'][A-Za-z0-9]{20,}["']/,
];
const SCAN_DIRS = ['src', 'tests', 'dist', 'scripts'];
let found = false;
function scanFile(filePath) {
const content = fs.readFileSync(filePath, 'utf-8');
for (const pattern of SECRET_PATTERNS) {
const matches = content.match(pattern);
if (matches) {
console.log(`POTENTIAL SECRET: ${filePath}: ${matches[0].slice(0, 30)}...`);
found = true;
}
}
}
function scanDir(dir) {
if (!fs.existsSync(dir)) return;
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
scanDir(fullPath);
} else if (/\.(ts|js|json|html|css)$/.test(entry.name)) {
scanFile(fullPath);
}
}
}
for (const dir of SCAN_DIRS) {
scanDir(dir);
}
if (!found) {
console.log('No secrets detected in source files.');
} else {
process.exit(1);
}