Initial build: Agentjacking Shield Chrome extension MVP
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
const fs = require('fs');
|
||||
|
||||
// Minimal valid 1x1 PNG (red pixel) - works for all icon sizes
|
||||
const png = Buffer.from([
|
||||
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A,
|
||||
0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52,
|
||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
|
||||
0x08, 0x02, 0x00, 0x00, 0x00, 0x90, 0x77, 0x53,
|
||||
0xDE, 0x00, 0x00, 0x00, 0x0C, 0x49, 0x44, 0x41,
|
||||
0x54, 0x08, 0xD7, 0x63, 0xF8, 0xCF, 0xC0, 0x00,
|
||||
0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x05, 0xFE,
|
||||
0xD8, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E,
|
||||
0x44, 0xAE, 0x42, 0x60, 0x82
|
||||
]);
|
||||
|
||||
fs.writeFileSync('icons/icon16.png', png);
|
||||
fs.writeFileSync('icons/icon48.png', png);
|
||||
fs.writeFileSync('icons/icon128.png', png);
|
||||
console.log('Icons created');
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user