mirror of
https://github.com/affaan-m/ECC.git
synced 2026-10-21 15:31:46 +02:00
21 lines
803 B
JavaScript
21 lines
803 B
JavaScript
#!/usr/bin/env node
|
|
const { readStdin, hookEnabled } = require('./adapter');
|
|
readStdin().then(raw => {
|
|
if (!hookEnabled('pre:read:sensitive-file-warning', ['minimal', 'standard', 'strict'])) {
|
|
process.stdout.write(raw);
|
|
return;
|
|
}
|
|
try {
|
|
const input = JSON.parse(raw);
|
|
const filePath = [input.file_path, input.path, input.file]
|
|
.find(value => typeof value === 'string' && value.trim()) || '';
|
|
if (/\.(env|key|pem)$|\.env\.|credentials|secret/i.test(filePath)) {
|
|
console.error('[ECC] WARNING: Reading sensitive file: ' + filePath);
|
|
console.error('[ECC] Ensure this data is not exposed in outputs');
|
|
}
|
|
} catch {
|
|
// Preserve the existing fail-open behavior for malformed Cursor payloads.
|
|
}
|
|
process.stdout.write(raw);
|
|
}).catch(() => process.exit(0));
|