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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ All notable changes to this project are documented here, following

### Fixed

- Include skipped files in SARIF output as tool execution notifications.

- Report scannable files that exceed the 2 MB size limit or cannot be read instead of
skipping them silently; include them in text and JSON output, log warnings on stderr,
and exit with code 1 when any file was skipped.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@royalpinto007/skill-audit",
"version": "0.1.7",
"version": "0.1.8",
"description": "Security scanner for agent skills. Scan a Claude/agent Skill for prompt-injection, dangerous shell, secret access, and exfiltration before you trust it. Zero dependencies, SARIF output, npx skill-audit <path>.",
"type": "module",
"bin": {
Expand Down
6 changes: 6 additions & 0 deletions src/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ export function sarifReport(result) {
properties: { category: f.category, severity: f.severity },
};
});
const notifications = (result.skipped ?? []).map((s) => ({
level: "warning",
message: { text: `Skipped ${s.file}: file was not scanned (${s.reason})` },
locations: [{ physicalLocation: { artifactLocation: { uri: s.file } } }],
}));
const results = findings.map((f) => ({
ruleId: f.rule,
level: SARIF_LEVEL[f.severity],
Expand All @@ -111,6 +116,7 @@ export function sarifReport(result) {
runs: [{
tool: { driver: { name: "skill-audit", informationUri: "https://github.com/AgentPostmortem/skill-audit", rules } },
results,
invocations: [{ executionSuccessful: true, toolExecutionNotifications: notifications }],
}],
}, null, 2);
}
Expand Down
10 changes: 10 additions & 0 deletions test/skill-audit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ test("sarif and json output are valid and well-formed", () => {
assert.ok(j.findings.length > 0);
});

test("sarif output reports skipped files as tool notifications", () => {
const result = { findings: [], skipped: [{ file: "big.sh", reason: "oversized", size: 2_000_001 }] };
const sarif = JSON.parse(sarifReport(result));
const notifications = sarif.runs[0].invocations[0].toolExecutionNotifications;
assert.equal(notifications.length, 1);
assert.equal(notifications[0].level, "warning");
assert.match(notifications[0].message.text, /big\.sh/);
assert.equal(notifications[0].locations[0].physicalLocation.artifactLocation.uri, "big.sh");
});

test("every rule has the required fields and a matcher", () => {
for (const r of RULES) {
assert.ok(r.id && r.severity && r.category && r.title && r.remediation, `rule missing fields: ${r.id}`);
Expand Down
Loading