Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/scan.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ export function collectFiles(target) {
const out = [];
const st = existsSync(target) ? statSync(target) : null;
if (!st) return out;
if (st.isFile()) { out.push(target); return out; }
if (st.isFile()) {
const name = basename(target);
const e = extname(name).toLowerCase();
if (CODE_EXT.has(e) || TEXT_EXT.has(e) || (e === "" && hasShebang(target))) out.push(target);
return out;
}
const walk = (dir) => {
for (const name of readdirSync(dir)) {
if (SKIP_DIR.has(name)) continue;
Expand Down
Binary file added test/fixtures/binary-target.bin
Binary file not shown.
7 changes: 7 additions & 0 deletions test/skill-audit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ test("clean skill produces zero findings", () => {
assert.equal(findings.length, 0, JSON.stringify(findings, null, 2));
});

test("single-file binary targets are not collected for scanning", () => {
const binary = fixture("binary-target.bin");
assert.deepEqual(collectFiles(binary), []);
assert.equal(scanSkill(binary).files, 0);
assert.deepEqual(scanSkill(binary).findings, []);
});

test("extensionless shebang scripts are scanned while plain files stay ignored", () => {
const root = fixture("extensionless-shebang-skill");
const files = collectFiles(root);
Expand Down
Loading