saktum 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/package.json +1 -1
- package/saktum.mjs +81 -26
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Saktum Check
|
|
2
2
|
|
|
3
3
|
**Test your MCP server in one command:** conformance, sign-in, security mapped to the **OWASP MCP Top 10**, agent
|
|
4
|
-
experience, what your tools cost an agent in context, and performance.
|
|
5
|
-
signed result anyone can verify.
|
|
4
|
+
experience, what your tools cost an agent in context, and performance. Two grades (**trust** and **agent readiness**),
|
|
5
|
+
plain findings, a fix for each, and a signed result anyone can verify.
|
|
6
6
|
|
|
7
7
|
```
|
|
8
8
|
npx saktum check -- npx -y @your/mcp-server # a local server
|
|
@@ -32,7 +32,9 @@ Runs on your machine. Nothing is uploaded. Your own environment variables are ne
|
|
|
32
32
|
Evidence: at handleCall (/home/deploy/acme-mcp/src/handlers.js:42:11)
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
**Two grades.** *Trust* covers conformance, sign-in and security; *agent readiness* covers whether agents can choose and
|
|
36
|
+
use your tools safely and cheaply (danger annotations, descriptions, context cost). Readiness never changes the trust
|
|
37
|
+
grade. Every report ends with **OWASP MCP Top 10 coverage**: which categories this run tested and which come later.
|
|
36
38
|
|
|
37
39
|
## What it checks (v0.1: 24 checks)
|
|
38
40
|
|
package/package.json
CHANGED
package/saktum.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Saktum Check 0.1.
|
|
2
|
+
// Saktum Check 0.1.4 (private beta). Licensed Apache-2.0; bundled dependencies keep their own licences.
|
|
3
3
|
import { createRequire as __saktumCreateRequire } from "node:module";
|
|
4
4
|
const require = __saktumCreateRequire(import.meta.url);
|
|
5
5
|
var __create = Object.create;
|
|
@@ -17166,11 +17166,11 @@ var require_format = __commonJS({
|
|
|
17166
17166
|
}
|
|
17167
17167
|
function getFormat(fmtDef) {
|
|
17168
17168
|
const code = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(schema)}` : void 0;
|
|
17169
|
-
const
|
|
17169
|
+
const fmt2 = gen.scopeValue("formats", { key: schema, ref: fmtDef, code });
|
|
17170
17170
|
if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) {
|
|
17171
|
-
return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._)`${
|
|
17171
|
+
return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._)`${fmt2}.validate`];
|
|
17172
17172
|
}
|
|
17173
|
-
return ["string", fmtDef,
|
|
17173
|
+
return ["string", fmtDef, fmt2];
|
|
17174
17174
|
}
|
|
17175
17175
|
function validCondition() {
|
|
17176
17176
|
if (typeof formatDef == "object" && !(formatDef instanceof RegExp) && formatDef.async) {
|
|
@@ -18793,8 +18793,8 @@ var require_limit = __commonJS({
|
|
|
18793
18793
|
ref: self.formats,
|
|
18794
18794
|
code: opts.code.formats
|
|
18795
18795
|
});
|
|
18796
|
-
const
|
|
18797
|
-
cxt.fail$data((0, codegen_1.or)((0, codegen_1._)`typeof ${
|
|
18796
|
+
const fmt2 = gen.const("fmt", (0, codegen_1._)`${fmts}[${fCxt.schemaCode}]`);
|
|
18797
|
+
cxt.fail$data((0, codegen_1.or)((0, codegen_1._)`typeof ${fmt2} != "object"`, (0, codegen_1._)`${fmt2} instanceof RegExp`, (0, codegen_1._)`typeof ${fmt2}.compare != "function"`, compareCode(fmt2)));
|
|
18798
18798
|
}
|
|
18799
18799
|
function validateFormat() {
|
|
18800
18800
|
const format = fCxt.schema;
|
|
@@ -18804,15 +18804,15 @@ var require_limit = __commonJS({
|
|
|
18804
18804
|
if (typeof fmtDef != "object" || fmtDef instanceof RegExp || typeof fmtDef.compare != "function") {
|
|
18805
18805
|
throw new Error(`"${keyword}": format "${format}" does not define "compare" function`);
|
|
18806
18806
|
}
|
|
18807
|
-
const
|
|
18807
|
+
const fmt2 = gen.scopeValue("formats", {
|
|
18808
18808
|
key: format,
|
|
18809
18809
|
ref: fmtDef,
|
|
18810
18810
|
code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format)}` : void 0
|
|
18811
18811
|
});
|
|
18812
|
-
cxt.fail$data(compareCode(
|
|
18812
|
+
cxt.fail$data(compareCode(fmt2));
|
|
18813
18813
|
}
|
|
18814
|
-
function compareCode(
|
|
18815
|
-
return (0, codegen_1._)`${
|
|
18814
|
+
function compareCode(fmt2) {
|
|
18815
|
+
return (0, codegen_1._)`${fmt2}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`;
|
|
18816
18816
|
}
|
|
18817
18817
|
},
|
|
18818
18818
|
dependencies: ["format"]
|
|
@@ -19860,7 +19860,7 @@ var EMBEDDED_CONTRACTS = { "envelope.schema.json": `{
|
|
|
19860
19860
|
}
|
|
19861
19861
|
}
|
|
19862
19862
|
}
|
|
19863
|
-
`, "result.schema.json": '{\n "$schema": "https://json-schema.org/draft/2020-12/schema",\n "$id": "https://saktum.dev/schemas/result/0.1.json",\n "title": "Saktum Trust Check result",\n "description": "The canonical result of one run. Every report format is rendered from this model. Evidence is a hash plus a short, sanitised excerpt; raw payloads never appear.",\n "type": "object",\n "required": [\n "resultFormat",\n "tool",\n "target",\n "packs",\n "findings",\n "scores",\n "metrics",\n "run"\n ],\n "additionalProperties": false,\n "properties": {\n "resultFormat": {\n "const": "0.1"\n },\n "tool": {\n "type": "object",\n "required": [\n "name",\n "version"\n ],\n "additionalProperties": false,\n "properties": {\n "name": {\n "const": "saktum-trust-check"\n },\n "version": {\n "type": "string"\n }\n }\n },\n "target": {\n "type": "object",\n "required": [\n "transport",\n "description"\n ],\n "additionalProperties": false,\n "properties": {\n "transport": {\n "enum": [\n "stdio",\n "streamable-http"\n ]\n },\n "description": {\n "type": "string"\n },\n "protocolVersion": {\n "type": "string"\n },\n "serverInfo": {\n "type": "object"\n },\n "toolsFingerprint": {\n "type": "string",\n "pattern": "^sha256:[0-9a-f]{64}$"\n },\n "toolCount": {\n "type": "integer",\n "minimum": 0\n }\n }\n },\n "packs": {\n "type": "array",\n "items": {\n "type": "object",\n "required": [\n "id",\n "version",\n "hash"\n ],\n "additionalProperties": false,\n "properties": {\n "id": {\n "type": "string"\n },\n "version": {\n "type": "string"\n },\n "hash": {\n "type": "string",\n "pattern": "^sha256:[0-9a-f]{64}$"\n }\n }\n }\n },\n "findings": {\n "type": "array",\n "items": {\n "$ref": "#/$defs/finding"\n }\n },\n "scores": {\n "type": "object",\n "required": [\n "overall",\n "capped",\n "categories"\n ],\n "additionalProperties": false,\n "properties": {\n "overall": {\n "type": [\n "integer",\n "null"\n ],\n "minimum": 0,\n "maximum": 100\n },\n "capped": {\n "type": "boolean"\n },\n "categories": {\n "type": "object",\n "additionalProperties": {\n "type": [\n "integer",\n "null"\n ]\n }\n }\n }\n },\n "metrics": {\n "type": "object",\n "additionalProperties": false,\n "properties": {\n "contextCostTokens": {\n "type": "integer",\n "minimum": 0\n },\n "largestTools": {\n "type": "array",\n "items": {\n "type": "object",\n "required": [\n "tool",\n "tokens"\n ],\n "properties": {\n "tool": {\n "type": "string"\n },\n "tokens": {\n "type": "integer"\n }\n }\n }\n },\n "contextCostPer1kTurnsUsd": {\n "type": "number",\n "minimum": 0,\n "description": "Estimated cost of loading the tool definitions on 1,000 agent turns at pricePerMTokUsd. Reported only."\n },\n "pricePerMTokUsd": {\n "type": "number",\n "minimum": 0\n },\n "performance": {\n "type": "object",\n "additionalProperties": false,\n "properties": {\n "initMs": {\n "type": "integer",\n "minimum": 0\n },\n "listMs": {\n "type": "integer",\n "minimum": 0\n },\n "listBytes": {\n "type": "integer",\n "minimum": 0\n },\n "rssMb": {\n "type": "number",\n "minimum": 0\n },\n "cpuPct": {\n "type": "number",\n "minimum": 0\n },\n "burst": {\n "type": "object",\n "additionalProperties": false,\n "properties": {\n "requests": {\n "type": "integer"\n },\n "ok": {\n "type": "integer"\n },\n "rateLimited": {\n "type": "integer"\n },\n "errors": {\n "type": "integer"\n },\n "p95Ms": {\n "type": "integer"\n }\n }\n }\n }\n }\n }\n },\n "run": {\n "type": "object",\n "required": [\n "startedAt",\n "durationMs",\n "mode",\n "runner",\n "sandbox"\n ],\n "additionalProperties": false,\n "properties": {\n "startedAt": {\n "type": "string",\n "format": "date-time"\n },\n "durationMs": {\n "type": "integer",\n "minimum": 0\n },\n "mode": {\n "enum": [\n "passive",\n "active"\n ]\n },\n "runner": {\n "enum": [\n "self",\n "hosted"\n ],\n "description": "self: run and signed by the user, proves integrity not independence. hosted: run and signed by Saktum (later)."\n },\n "sandbox": {\n "enum": [\n "none",\n "docker"\n ],\n "description": "Whether local servers ran inside a container sandbox."\n }\n }\n },\n "signature": {\n "type": "object",\n "required": [\n "alg",\n "kid",\n "jws"\n ],\n "additionalProperties": false,\n "properties": {\n "alg": {\n "const": "EdDSA"\n },\n "kid": {\n "type": "string",\n "pattern": "^did:key:z"\n },\n "jws": {\n "type": "string"\n }\n }\n },\n "grade": {\n "enum": [\n "A",\n "B",\n "C",\n "D",\n "F",\n null\n ],\n "description": "Letter grade from the trust score: A 90-100, B 80-89, C 70-79, D 50-69, F below 50 or any failed critical check."\n },\n "summary": {\n "type": "array",\n "maxItems": 5,\n "items": {\n "type": "string",\n "maxLength": 400\n },\n "description": "Plain-language summary sentences shown first in every report."\n },\n "assuranceLevel": {\n "enum": [\n "L1",\n "L2",\n "L3",\n "L4"\n ],\n "description": "L1 self-tested (Saktum Check); L2 independently tested; L3 certified; L4 continuously certified."\n }\n },\n "$defs": {\n "finding": {\n "type": "object",\n "required": [\n "check",\n "pack",\n "status",\n "severity",\n "title"\n ],\n "additionalProperties": false,\n "properties": {\n "check": {\n "type": "string"\n },\n "pack": {\n "type": "string"\n },\n "status": {\n "enum": [\n "pass",\n "fail",\n "skipped",\n "inconclusive",\n "info"\n ]\n },\n "severity": {\n "enum": [\n "critical",\n "high",\n "medium",\n "low",\n "info"\n ]\n },\n "scored": {\n "type": "boolean"\n },\n "title": {\n "type": "string"\n },\n "subject": {\n "type": "string"\n },\n "message": {\n "type": "string"\n },\n "fix": {\n "type": "string"\n },\n "references": {\n "type": "array",\n "items": {\n "type": "string"\n }\n },\n "evidence": {\n "type": "object",\n "additionalProperties": false,\n "properties": {\n "hash": {\n "type": "string"\n },\n "excerpt": {\n "type": "string",\n "maxLength": 240\n }\n }\n }\n }\n }\n }\n}\n', "test-cases.schema.json": '{\n "$schema": "https://json-schema.org/draft/2020-12/schema",\n "$id": "https://saktum.dev/schemas/test-cases/0.1.json",\n "title": "Saktum Trust Check functional test cases (saktum.tests.yaml)",\n "type": "object",\n "required": ["testsFormat", "tests"],\n "additionalProperties": false,\n "properties": {\n "testsFormat": { "const": "0.1" },\n "tests": {\n "type": "array",\n "items": {\n "type": "object",\n "required": ["id", "tool", "input", "expect"],\n "additionalProperties": false,\n "properties": {\n "id": { "type": "string" },\n "tool": { "type": "string" },\n "input": { "type": "object" },\n "sideEffects": { "type": "boolean", "default": false, "description": "Tests with side effects run only against owned targets." },\n "expect": {\n "type": "object",\n "additionalProperties": false,\n "properties": {\n "isError": { "type": "boolean" },\n "textContains": { "type": "string" },\n "structured": { "type": "object" },\n "outputSchema": { "type": "boolean" },\n "latencyMs": { "type": "object", "properties": { "lt": { "type": "integer" } }, "additionalProperties": false }\n }\n }\n }\n }\n }\n }\n}\n' };
|
|
19863
|
+
`, "result.schema.json": '{\n "$schema": "https://json-schema.org/draft/2020-12/schema",\n "$id": "https://saktum.dev/schemas/result/0.1.json",\n "title": "Saktum Trust Check result",\n "description": "The canonical result of one run. Every report format is rendered from this model. Evidence is a hash plus a short, sanitised excerpt; raw payloads never appear.",\n "type": "object",\n "required": [\n "resultFormat",\n "tool",\n "target",\n "packs",\n "findings",\n "scores",\n "metrics",\n "run"\n ],\n "additionalProperties": false,\n "properties": {\n "resultFormat": {\n "const": "0.1"\n },\n "tool": {\n "type": "object",\n "required": [\n "name",\n "version"\n ],\n "additionalProperties": false,\n "properties": {\n "name": {\n "const": "saktum-trust-check"\n },\n "version": {\n "type": "string"\n }\n }\n },\n "target": {\n "type": "object",\n "required": [\n "transport",\n "description"\n ],\n "additionalProperties": false,\n "properties": {\n "transport": {\n "enum": [\n "stdio",\n "streamable-http"\n ]\n },\n "description": {\n "type": "string"\n },\n "protocolVersion": {\n "type": "string"\n },\n "serverInfo": {\n "type": "object"\n },\n "toolsFingerprint": {\n "type": "string",\n "pattern": "^sha256:[0-9a-f]{64}$"\n },\n "toolCount": {\n "type": "integer",\n "minimum": 0\n }\n }\n },\n "packs": {\n "type": "array",\n "items": {\n "type": "object",\n "required": [\n "id",\n "version",\n "hash"\n ],\n "additionalProperties": false,\n "properties": {\n "id": {\n "type": "string"\n },\n "version": {\n "type": "string"\n },\n "hash": {\n "type": "string",\n "pattern": "^sha256:[0-9a-f]{64}$"\n }\n }\n }\n },\n "findings": {\n "type": "array",\n "items": {\n "$ref": "#/$defs/finding"\n }\n },\n "scores": {\n "type": "object",\n "required": [\n "overall",\n "capped",\n "categories"\n ],\n "additionalProperties": false,\n "properties": {\n "overall": {\n "type": [\n "integer",\n "null"\n ],\n "minimum": 0,\n "maximum": 100\n },\n "capped": {\n "type": "boolean"\n },\n "categories": {\n "type": "object",\n "additionalProperties": {\n "type": [\n "integer",\n "null"\n ]\n }\n }\n }\n },\n "metrics": {\n "type": "object",\n "additionalProperties": false,\n "properties": {\n "contextCostTokens": {\n "type": "integer",\n "minimum": 0\n },\n "largestTools": {\n "type": "array",\n "items": {\n "type": "object",\n "required": [\n "tool",\n "tokens"\n ],\n "properties": {\n "tool": {\n "type": "string"\n },\n "tokens": {\n "type": "integer"\n }\n }\n }\n },\n "contextCostPer1kTurnsUsd": {\n "type": "number",\n "minimum": 0,\n "description": "Estimated cost of loading the tool definitions on 1,000 agent turns at pricePerMTokUsd. Reported only."\n },\n "pricePerMTokUsd": {\n "type": "number",\n "minimum": 0\n },\n "performance": {\n "type": "object",\n "additionalProperties": false,\n "properties": {\n "initMs": {\n "type": "integer",\n "minimum": 0\n },\n "listMs": {\n "type": "integer",\n "minimum": 0\n },\n "listBytes": {\n "type": "integer",\n "minimum": 0\n },\n "rssMb": {\n "type": "number",\n "minimum": 0\n },\n "cpuPct": {\n "type": "number",\n "minimum": 0\n },\n "burst": {\n "type": "object",\n "additionalProperties": false,\n "properties": {\n "requests": {\n "type": "integer"\n },\n "ok": {\n "type": "integer"\n },\n "rateLimited": {\n "type": "integer"\n },\n "errors": {\n "type": "integer"\n },\n "p95Ms": {\n "type": "integer"\n }\n }\n }\n }\n }\n }\n },\n "run": {\n "type": "object",\n "required": [\n "startedAt",\n "durationMs",\n "mode",\n "runner",\n "sandbox"\n ],\n "additionalProperties": false,\n "properties": {\n "startedAt": {\n "type": "string",\n "format": "date-time"\n },\n "durationMs": {\n "type": "integer",\n "minimum": 0\n },\n "mode": {\n "enum": [\n "passive",\n "active"\n ]\n },\n "runner": {\n "enum": [\n "self",\n "hosted"\n ],\n "description": "self: run and signed by the user, proves integrity not independence. hosted: run and signed by Saktum (later)."\n },\n "sandbox": {\n "enum": [\n "none",\n "docker"\n ],\n "description": "Whether local servers ran inside a container sandbox."\n }\n }\n },\n "signature": {\n "type": "object",\n "required": [\n "alg",\n "kid",\n "jws"\n ],\n "additionalProperties": false,\n "properties": {\n "alg": {\n "const": "EdDSA"\n },\n "kid": {\n "type": "string",\n "pattern": "^did:key:z"\n },\n "jws": {\n "type": "string"\n }\n }\n },\n "grade": {\n "enum": [\n "A",\n "B",\n "C",\n "D",\n "F",\n null\n ],\n "description": "Letter grade from the trust score: A 90-100, B 80-89, C 70-79, D 50-69, F below 50 or any failed critical check."\n },\n "summary": {\n "type": "array",\n "maxItems": 5,\n "items": {\n "type": "string",\n "maxLength": 400\n },\n "description": "Plain-language summary sentences shown first in every report."\n },\n "assuranceLevel": {\n "enum": [\n "L1",\n "L2",\n "L3",\n "L4"\n ],\n "description": "L1 self-tested (Saktum Check); L2 independently tested; L3 certified; L4 continuously certified."\n },\n "readiness": {\n "description": "Agent readiness: a second grade beside trust (annotations, descriptions, context cost), never mixed into the trust score.",\n "oneOf": [\n {\n "type": "null"\n },\n {\n "type": "object",\n "additionalProperties": false,\n "required": [\n "score",\n "grade",\n "toolsAnnotated",\n "toolsDescribed",\n "toolCount",\n "contextTokens"\n ],\n "properties": {\n "score": {\n "type": "integer",\n "minimum": 0,\n "maximum": 100\n },\n "grade": {\n "enum": [\n "A",\n "B",\n "C",\n "D",\n "F",\n null\n ]\n },\n "toolsAnnotated": {\n "type": "integer",\n "minimum": 0\n },\n "toolsDescribed": {\n "type": "integer",\n "minimum": 0\n },\n "toolCount": {\n "type": "integer",\n "minimum": 0\n },\n "contextTokens": {\n "type": "integer",\n "minimum": 0\n },\n "topImprovement": {\n "type": "string",\n "maxLength": 300\n }\n }\n }\n ]\n },\n "coverage": {\n "type": "object",\n "additionalProperties": false,\n "properties": {\n "trustChecksRun": {\n "type": "integer",\n "minimum": 0\n }\n }\n }\n },\n "$defs": {\n "finding": {\n "type": "object",\n "required": [\n "check",\n "pack",\n "status",\n "severity",\n "title"\n ],\n "additionalProperties": false,\n "properties": {\n "check": {\n "type": "string"\n },\n "pack": {\n "type": "string"\n },\n "status": {\n "enum": [\n "pass",\n "fail",\n "skipped",\n "inconclusive",\n "info"\n ]\n },\n "severity": {\n "enum": [\n "critical",\n "high",\n "medium",\n "low",\n "info"\n ]\n },\n "scored": {\n "type": "boolean"\n },\n "title": {\n "type": "string"\n },\n "subject": {\n "type": "string"\n },\n "message": {\n "type": "string"\n },\n "fix": {\n "type": "string"\n },\n "references": {\n "type": "array",\n "items": {\n "type": "string"\n }\n },\n "evidence": {\n "type": "object",\n "additionalProperties": false,\n "properties": {\n "hash": {\n "type": "string"\n },\n "excerpt": {\n "type": "string",\n "maxLength": 240\n }\n }\n }\n }\n }\n }\n}\n', "test-cases.schema.json": '{\n "$schema": "https://json-schema.org/draft/2020-12/schema",\n "$id": "https://saktum.dev/schemas/test-cases/0.1.json",\n "title": "Saktum Trust Check functional test cases (saktum.tests.yaml)",\n "type": "object",\n "required": ["testsFormat", "tests"],\n "additionalProperties": false,\n "properties": {\n "testsFormat": { "const": "0.1" },\n "tests": {\n "type": "array",\n "items": {\n "type": "object",\n "required": ["id", "tool", "input", "expect"],\n "additionalProperties": false,\n "properties": {\n "id": { "type": "string" },\n "tool": { "type": "string" },\n "input": { "type": "object" },\n "sideEffects": { "type": "boolean", "default": false, "description": "Tests with side effects run only against owned targets." },\n "expect": {\n "type": "object",\n "additionalProperties": false,\n "properties": {\n "isError": { "type": "boolean" },\n "textContains": { "type": "string" },\n "structured": { "type": "object" },\n "outputSchema": { "type": "boolean" },\n "latencyMs": { "type": "object", "properties": { "lt": { "type": "integer" } }, "additionalProperties": false }\n }\n }\n }\n }\n }\n }\n}\n' };
|
|
19864
19864
|
var EMBEDDED_PACKS = { "agent-experience.yaml": 'packFormat: "0.1"\nid: agent-experience\nversion: 0.1.0\ncategory: agent-experience\ndescription: How easily and cheaply agents can use the server. Reported, never part of the trust score.\nchecks:\n - id: ax.context-cost\n title: Context cost of tool definitions\n severity: info\n safety: passive\n scored: false\n steps: [{ action: analyse, analyser: context-cost }]\n fix: Shorten long descriptions, split large servers, and drop tools agents rarely need.\n - id: ax.annotations\n title: Tools declare annotations\n severity: low\n safety: passive\n steps: [{ action: analyse, analyser: annotations-present }]\n fix: Set readOnlyHint, destructiveHint, idempotentHint and openWorldHint on every tool so clients can warn before risky actions.\n references: ["MCP specification: tool annotations", "OWASP MCP Top 10: MCP02 Privilege Escalation via Scope Creep (undeclared write and destructive tools)"]\n - id: ax.short-descriptions\n title: Tools have usable descriptions\n severity: low\n safety: passive\n steps: [{ action: analyse, analyser: short-descriptions }]\n fix: Describe what the tool does, when to use it and when not to, in at least a full sentence.\n', "auth.yaml": `packFormat: "0.1"
|
|
19865
19865
|
id: auth
|
|
19866
19866
|
version: 0.1.0
|
|
@@ -31930,7 +31930,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
31930
31930
|
};
|
|
31931
31931
|
|
|
31932
31932
|
// packages/transports/dist/index.js
|
|
31933
|
-
var USER_AGENT = "saktum-check/0.1.
|
|
31933
|
+
var USER_AGENT = "saktum-check/0.1.4 (+https://saktum.dev/check)";
|
|
31934
31934
|
var LIMITS = { requestTimeoutMs: 1e4, connectTimeoutMs: 6e4, maxResponseChars: 5e6 };
|
|
31935
31935
|
var LimitError = class extends Error {
|
|
31936
31936
|
};
|
|
@@ -32060,7 +32060,7 @@ var INIT_BODY = JSON.stringify({
|
|
|
32060
32060
|
jsonrpc: "2.0",
|
|
32061
32061
|
id: 1,
|
|
32062
32062
|
method: "initialize",
|
|
32063
|
-
params: { protocolVersion: "2025-06-18", capabilities: {}, clientInfo: { name: "saktum-trust-check-probe", version: "0.1.
|
|
32063
|
+
params: { protocolVersion: "2025-06-18", capabilities: {}, clientInfo: { name: "saktum-trust-check-probe", version: "0.1.4" } }
|
|
32064
32064
|
});
|
|
32065
32065
|
async function httpRequest(url2, init = {}) {
|
|
32066
32066
|
const t0 = Date.now();
|
|
@@ -32690,10 +32690,11 @@ function gradeFor(overall, capped) {
|
|
|
32690
32690
|
return "C";
|
|
32691
32691
|
return "D";
|
|
32692
32692
|
}
|
|
32693
|
-
function summarise(r, noGrade) {
|
|
32693
|
+
function summarise(r, noGrade, isTrust = () => true) {
|
|
32694
32694
|
const signInRequired = noGrade?.kind === "sign-in";
|
|
32695
|
-
const
|
|
32696
|
-
const
|
|
32695
|
+
const trust = r.findings.filter(isTrust);
|
|
32696
|
+
const fails = trust.filter((f) => f.status === "fail" && f.scored).sort((a, b) => ORDER.indexOf(a.severity) - ORDER.indexOf(b.severity));
|
|
32697
|
+
const passed = trust.filter((f) => f.status === "pass" && f.scored).length;
|
|
32697
32698
|
const counts = ORDER.slice(0, 4).map((s) => [s, fails.filter((f) => f.severity === s).length]).filter(([, n]) => n > 0);
|
|
32698
32699
|
const lines = [];
|
|
32699
32700
|
if (signInRequired)
|
|
@@ -32705,16 +32706,22 @@ function summarise(r, noGrade) {
|
|
|
32705
32706
|
else if (r.grade === null || r.grade === void 0)
|
|
32706
32707
|
lines.push("No grade: too few checks could run against this server to grade it fairly.");
|
|
32707
32708
|
else if (fails.length === 0)
|
|
32708
|
-
lines.push(`
|
|
32709
|
+
lines.push(`Trust grade ${r.grade}: all ${passed} checks that apply passed.`);
|
|
32709
32710
|
else
|
|
32710
|
-
lines.push(`
|
|
32711
|
+
lines.push(`Trust grade ${r.grade}: ${fails.length} problem${fails.length === 1 ? "" : "s"} found (${counts.map(([s, n]) => `${n} ${s}`).join(", ")}); ${passed} checks passed.`);
|
|
32712
|
+
const rd = r.readiness;
|
|
32713
|
+
const readinessLine = rd && rd.grade && rd.topImprovement ? `Agent readiness ${rd.grade}: ${rd.topImprovement}.` : void 0;
|
|
32711
32714
|
if (fails[0]) {
|
|
32712
32715
|
const first = (fails[0].message ?? fails[0].title).split(/(?<=\.)\s/)[0].replace(/\.$/, "");
|
|
32713
32716
|
lines.push(`Fix first (${fails[0].severity}): ${first.charAt(0).toLowerCase()}${first.slice(1)}.`);
|
|
32714
|
-
} else
|
|
32717
|
+
} else if (readinessLine)
|
|
32718
|
+
lines.push(readinessLine);
|
|
32719
|
+
else
|
|
32715
32720
|
lines.push("Nothing to fix in this run; keep running it in CI to catch regressions.");
|
|
32716
32721
|
if (signInRequired)
|
|
32717
32722
|
lines.push('Most checks need sign-in: re-run with --header "Authorization: Bearer <token>" to test the tools themselves.');
|
|
32723
|
+
else if (readinessLine && fails[0])
|
|
32724
|
+
lines.push(readinessLine);
|
|
32718
32725
|
else if (r.metrics.contextCostTokens !== void 0) {
|
|
32719
32726
|
const money = r.metrics.contextCostPer1kTurnsUsd !== void 0 ? `, about $${r.metrics.contextCostPer1kTurnsUsd.toFixed(2)} per 1,000 turns` : "";
|
|
32720
32727
|
lines.push(`Agents spend about ${r.metrics.contextCostTokens.toLocaleString("en-US")} tokens reading these tools on every turn${money}.`);
|
|
@@ -32722,8 +32729,46 @@ function summarise(r, noGrade) {
|
|
|
32722
32729
|
return lines;
|
|
32723
32730
|
}
|
|
32724
32731
|
|
|
32732
|
+
// packages/testkit-core/dist/readiness.js
|
|
32733
|
+
var READINESS = {
|
|
32734
|
+
weights: { annotations: 0.3, descriptions: 0.4, cost: 0.3 },
|
|
32735
|
+
/** Full credit for context cost up to this many tokens per turn, falling linearly to zero at zeroCreditTokens. */
|
|
32736
|
+
fullCreditTokens: 1e4,
|
|
32737
|
+
zeroCreditTokens: 6e4,
|
|
32738
|
+
/** Same threshold as the ax.short-descriptions check. */
|
|
32739
|
+
minDescriptionChars: 20
|
|
32740
|
+
};
|
|
32741
|
+
var hasAnnotations = (t) => Boolean(t.annotations && Object.keys(t.annotations).length > 0);
|
|
32742
|
+
var usableDescription = (t) => (t.description ?? "").trim().length >= READINESS.minDescriptionChars;
|
|
32743
|
+
var fmt = (n) => n.toLocaleString("en-US");
|
|
32744
|
+
function readinessFor(tools) {
|
|
32745
|
+
if (tools.length === 0)
|
|
32746
|
+
return null;
|
|
32747
|
+
const annotated = tools.filter(hasAnnotations).length;
|
|
32748
|
+
const described = tools.filter(usableDescription).length;
|
|
32749
|
+
const tokens = contextCost(tools).contextCostTokens;
|
|
32750
|
+
const { fullCreditTokens: full, zeroCreditTokens: zero, weights: w } = READINESS;
|
|
32751
|
+
const costCredit = tokens <= full ? 1 : tokens >= zero ? 0 : 1 - (tokens - full) / (zero - full);
|
|
32752
|
+
const parts = { annotations: annotated / tools.length, descriptions: described / tools.length, cost: costCredit };
|
|
32753
|
+
const score2 = Math.round(100 * (w.annotations * parts.annotations + w.descriptions * parts.descriptions + w.cost * parts.cost));
|
|
32754
|
+
const losses = [
|
|
32755
|
+
{ lost: w.annotations * (1 - parts.annotations), text: `declare danger annotations (readOnlyHint, destructiveHint) on ${tools.length - annotated} of ${tools.length} tools` },
|
|
32756
|
+
{ lost: w.descriptions * (1 - parts.descriptions), text: `write usable descriptions for ${tools.length - described} of ${tools.length} tools` },
|
|
32757
|
+
{ lost: w.cost * (1 - parts.cost), text: `trim tool definitions: agents read ${fmt(tokens)} tokens of them on every turn` }
|
|
32758
|
+
].sort((a, b) => b.lost - a.lost);
|
|
32759
|
+
return {
|
|
32760
|
+
score: score2,
|
|
32761
|
+
grade: gradeFor(score2, false) ?? null,
|
|
32762
|
+
toolsAnnotated: annotated,
|
|
32763
|
+
toolsDescribed: described,
|
|
32764
|
+
toolCount: tools.length,
|
|
32765
|
+
contextTokens: tokens,
|
|
32766
|
+
topImprovement: losses[0].lost > 5e-3 ? losses[0].text : void 0
|
|
32767
|
+
};
|
|
32768
|
+
}
|
|
32769
|
+
|
|
32725
32770
|
// packages/testkit-core/dist/engine.js
|
|
32726
|
-
var ENGINE_VERSION = "0.1.
|
|
32771
|
+
var ENGINE_VERSION = "0.1.4";
|
|
32727
32772
|
var UNKNOWN_TOOL = "saktum_trust_check_no_such_tool";
|
|
32728
32773
|
var INVALID_TOKEN = "saktum-check-deliberately-invalid-token";
|
|
32729
32774
|
var BURST_REQUESTS = 20;
|
|
@@ -32741,10 +32786,10 @@ var baseOf = (pack, check) => ({
|
|
|
32741
32786
|
references: check.references
|
|
32742
32787
|
});
|
|
32743
32788
|
var MIN_GRADED_CHECKS = 5;
|
|
32744
|
-
function finish(target, opts, startedAt, findings, extra, metrics, sandbox, noGrade) {
|
|
32789
|
+
function finish(target, opts, startedAt, findings, extra, metrics, sandbox, noGrade, readiness = null) {
|
|
32745
32790
|
const categoryOf = (id) => opts.packs.find((p) => p.pack.id === id)?.pack.category ?? "other";
|
|
32746
32791
|
const scores = score(findings, categoryOf);
|
|
32747
|
-
const ran = findings.filter((f) => f.scored && (f.status === "pass" || f.status === "fail")).length;
|
|
32792
|
+
const ran = findings.filter((f) => f.scored && (f.status === "pass" || f.status === "fail") && categoryOf(f.pack) in TRUST_WEIGHTS).length;
|
|
32748
32793
|
const reason = noGrade ?? (ran < MIN_GRADED_CHECKS ? { kind: "too-few" } : void 0);
|
|
32749
32794
|
const grade = reason ? null : gradeFor(scores.overall, scores.capped);
|
|
32750
32795
|
const r = {
|
|
@@ -32757,9 +32802,11 @@ function finish(target, opts, startedAt, findings, extra, metrics, sandbox, noGr
|
|
|
32757
32802
|
grade,
|
|
32758
32803
|
assuranceLevel: "L1",
|
|
32759
32804
|
metrics,
|
|
32805
|
+
readiness,
|
|
32806
|
+
coverage: { trustChecksRun: ran },
|
|
32760
32807
|
run: { startedAt: startedAt.toISOString(), durationMs: Date.now() - startedAt.getTime(), mode: opts.mode ?? "passive", runner: "self", sandbox }
|
|
32761
32808
|
};
|
|
32762
|
-
r.summary = summarise(r, reason);
|
|
32809
|
+
r.summary = summarise(r, reason, (f) => categoryOf(f.pack) in TRUST_WEIGHTS);
|
|
32763
32810
|
return r;
|
|
32764
32811
|
}
|
|
32765
32812
|
async function burst(session) {
|
|
@@ -32879,7 +32926,7 @@ async function runTrustCheck(target, opts) {
|
|
|
32879
32926
|
delete metrics.contextCostPer1kTurnsUsd;
|
|
32880
32927
|
}
|
|
32881
32928
|
const noGrade = signInRequired ? { kind: "sign-in" } : listError ? { kind: "list-failed", error: sanitizeText(listError, 160) } : tools.length === 0 ? { kind: "no-tools", toolsCapability: Boolean(session?.capabilities?.tools) } : void 0;
|
|
32882
|
-
return finish(target, { ...opts, mode }, startedAt, findings, session ? { protocolVersion: session.protocolVersion, serverInfo: session.serverInfo, toolsFingerprint: fingerprint, toolCount: tools.length } : { toolCount: 0 }, metrics, session?.sandbox ?? "none", noGrade);
|
|
32929
|
+
return finish(target, { ...opts, mode }, startedAt, findings, session ? { protocolVersion: session.protocolVersion, serverInfo: session.serverInfo, toolsFingerprint: fingerprint, toolCount: tools.length } : { toolCount: 0 }, metrics, session?.sandbox ?? "none", noGrade, session && !listError ? readinessFor(tools) : null);
|
|
32883
32930
|
} finally {
|
|
32884
32931
|
if (session && !opts.session)
|
|
32885
32932
|
await session.close();
|
|
@@ -32891,6 +32938,7 @@ var SEV_ORDER = ["critical", "high", "medium", "low", "info"];
|
|
|
32891
32938
|
var rank = (s) => SEV_ORDER.indexOf(s);
|
|
32892
32939
|
var SYMBOL = { fail: "\u2717 FAIL", inconclusive: "! INCONCLUSIVE", pass: "\u2713 PASS", skipped: "- SKIPPED", info: "i INFO" };
|
|
32893
32940
|
var FEEDBACK_URL = "https://github.com/soodhere/saktum-check/discussions";
|
|
32941
|
+
var COVERAGE_NOTE = "v0.1 tests conformance, sign-in basics and security hygiene; deeper sign-in, injection and supply-chain checks arrive in v0.2 to v0.6.";
|
|
32894
32942
|
var DISCLAIMER = "Findings describe this server at the time of the run. They are not a guarantee of security or correctness.";
|
|
32895
32943
|
var SELF_SIGNED_NOTE = "Assurance level L1 (self-tested): the signature proves this report was not changed after the run, not that it was run independently.";
|
|
32896
32944
|
var OWASP_MCP = [
|
|
@@ -32943,7 +32991,13 @@ function renderTerminal(r) {
|
|
|
32943
32991
|
if (r.run.sandbox === "none" && r.target.transport === "stdio")
|
|
32944
32992
|
lines.push("Note: the local server ran without a sandbox. Only run servers you trust this way.");
|
|
32945
32993
|
lines.push("");
|
|
32946
|
-
|
|
32994
|
+
const ran = r.coverage?.trustChecksRun;
|
|
32995
|
+
lines.push(` TRUST ${r.grade ?? "-"}${r.scores.overall !== null ? ` (score ${r.scores.overall}${r.scores.capped ? ", capped: a critical check failed" : ""}${ran !== void 0 ? ` \xB7 ${ran} checks` : ""})` : ""}`);
|
|
32996
|
+
if (r.readiness) {
|
|
32997
|
+
const rd = r.readiness;
|
|
32998
|
+
lines.push(` AGENT READINESS ${rd.grade ?? "-"} (score ${rd.score} \xB7 annotations ${rd.toolsAnnotated}/${rd.toolCount} tools \xB7 ${rd.contextTokens.toLocaleString("en-US")} tokens per turn)`);
|
|
32999
|
+
}
|
|
33000
|
+
lines.push(` ${COVERAGE_NOTE}`);
|
|
32947
33001
|
for (const line of r.summary ?? [])
|
|
32948
33002
|
lines.push(` ${s(line, 300)}`);
|
|
32949
33003
|
lines.push("");
|
|
@@ -32993,7 +33047,8 @@ function renderHtml(r) {
|
|
|
32993
33047
|
<style>body{font:15px/1.5 system-ui,sans-serif;max-width:960px;margin:2rem auto;padding:0 1rem}table{border-collapse:collapse;width:100%;margin:1rem 0}td{border-top:1px solid #ddd;padding:.5rem;vertical-align:top}.grade{font-size:3rem;font-weight:700}.fail td:first-child{font-weight:600}code{font-size:13px}</style></head><body>
|
|
32994
33048
|
<h1>Saktum Check report</h1>
|
|
32995
33049
|
<p>${e(r.target.description)} · ${e(r.target.serverInfo?.["name"] ?? "")} ${e(r.target.serverInfo?.["version"] ?? "")} · ${r.target.toolCount ?? 0} tools</p>
|
|
32996
|
-
<p class="grade">
|
|
33050
|
+
<p class="grade">Trust ${e(r.grade ?? "-")}${r.readiness ? ` · Agent readiness ${e(r.readiness.grade ?? "-")}` : ""}</p>
|
|
33051
|
+
<p><small>${e(COVERAGE_NOTE)}</small></p>
|
|
32997
33052
|
${(r.summary ?? []).map((l) => `<p>${e(l)}</p>`).join("")}
|
|
32998
33053
|
<table>${rows}</table>
|
|
32999
33054
|
<h2>OWASP MCP Top 10 coverage</h2><table>${cov}</table>
|