guardlink 1.0.0
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/CHANGELOG.md +30 -0
- package/LICENSE +21 -0
- package/README.md +344 -0
- package/dist/agents/config.d.ts +46 -0
- package/dist/agents/config.d.ts.map +1 -0
- package/dist/agents/config.js +189 -0
- package/dist/agents/config.js.map +1 -0
- package/dist/agents/index.d.ts +24 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +42 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/launcher.d.ts +54 -0
- package/dist/agents/launcher.d.ts.map +1 -0
- package/dist/agents/launcher.js +152 -0
- package/dist/agents/launcher.js.map +1 -0
- package/dist/agents/prompts.d.ts +14 -0
- package/dist/agents/prompts.d.ts.map +1 -0
- package/dist/agents/prompts.js +120 -0
- package/dist/agents/prompts.js.map +1 -0
- package/dist/analyze/index.d.ts +80 -0
- package/dist/analyze/index.d.ts.map +1 -0
- package/dist/analyze/index.js +306 -0
- package/dist/analyze/index.js.map +1 -0
- package/dist/analyze/llm.d.ts +52 -0
- package/dist/analyze/llm.d.ts.map +1 -0
- package/dist/analyze/llm.js +295 -0
- package/dist/analyze/llm.js.map +1 -0
- package/dist/analyze/prompts.d.ts +14 -0
- package/dist/analyze/prompts.d.ts.map +1 -0
- package/dist/analyze/prompts.js +205 -0
- package/dist/analyze/prompts.js.map +1 -0
- package/dist/analyzer/index.d.ts +5 -0
- package/dist/analyzer/index.d.ts.map +1 -0
- package/dist/analyzer/index.js +5 -0
- package/dist/analyzer/index.js.map +1 -0
- package/dist/analyzer/sarif.d.ts +84 -0
- package/dist/analyzer/sarif.d.ts.map +1 -0
- package/dist/analyzer/sarif.js +149 -0
- package/dist/analyzer/sarif.js.map +1 -0
- package/dist/cli/index.d.ts +25 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +821 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/dashboard/data.d.ts +52 -0
- package/dist/dashboard/data.d.ts.map +1 -0
- package/dist/dashboard/data.js +93 -0
- package/dist/dashboard/data.js.map +1 -0
- package/dist/dashboard/diagrams.d.ts +25 -0
- package/dist/dashboard/diagrams.d.ts.map +1 -0
- package/dist/dashboard/diagrams.js +243 -0
- package/dist/dashboard/diagrams.js.map +1 -0
- package/dist/dashboard/generate.d.ts +17 -0
- package/dist/dashboard/generate.d.ts.map +1 -0
- package/dist/dashboard/generate.js +1258 -0
- package/dist/dashboard/generate.js.map +1 -0
- package/dist/dashboard/index.d.ts +7 -0
- package/dist/dashboard/index.d.ts.map +1 -0
- package/dist/dashboard/index.js +7 -0
- package/dist/dashboard/index.js.map +1 -0
- package/dist/diff/engine.d.ts +51 -0
- package/dist/diff/engine.d.ts.map +1 -0
- package/dist/diff/engine.js +153 -0
- package/dist/diff/engine.js.map +1 -0
- package/dist/diff/format.d.ts +10 -0
- package/dist/diff/format.d.ts.map +1 -0
- package/dist/diff/format.js +111 -0
- package/dist/diff/format.js.map +1 -0
- package/dist/diff/git.d.ts +24 -0
- package/dist/diff/git.d.ts.map +1 -0
- package/dist/diff/git.js +85 -0
- package/dist/diff/git.js.map +1 -0
- package/dist/diff/index.d.ts +7 -0
- package/dist/diff/index.d.ts.map +1 -0
- package/dist/diff/index.js +7 -0
- package/dist/diff/index.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/init/detect.d.ts +42 -0
- package/dist/init/detect.d.ts.map +1 -0
- package/dist/init/detect.js +185 -0
- package/dist/init/detect.js.map +1 -0
- package/dist/init/index.d.ts +39 -0
- package/dist/init/index.d.ts.map +1 -0
- package/dist/init/index.js +228 -0
- package/dist/init/index.js.map +1 -0
- package/dist/init/picker.d.ts +32 -0
- package/dist/init/picker.d.ts.map +1 -0
- package/dist/init/picker.js +105 -0
- package/dist/init/picker.js.map +1 -0
- package/dist/init/templates.d.ts +25 -0
- package/dist/init/templates.d.ts.map +1 -0
- package/dist/init/templates.js +263 -0
- package/dist/init/templates.js.map +1 -0
- package/dist/mcp/index.d.ts +12 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +18 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/lookup.d.ts +27 -0
- package/dist/mcp/lookup.d.ts.map +1 -0
- package/dist/mcp/lookup.js +282 -0
- package/dist/mcp/lookup.js.map +1 -0
- package/dist/mcp/server.d.ts +41 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +388 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/suggest.d.ts +35 -0
- package/dist/mcp/suggest.d.ts.map +1 -0
- package/dist/mcp/suggest.js +268 -0
- package/dist/mcp/suggest.js.map +1 -0
- package/dist/parser/comment-strip.d.ts +15 -0
- package/dist/parser/comment-strip.d.ts.map +1 -0
- package/dist/parser/comment-strip.js +76 -0
- package/dist/parser/comment-strip.js.map +1 -0
- package/dist/parser/index.d.ts +10 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +9 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/normalize.d.ts +22 -0
- package/dist/parser/normalize.d.ts.map +1 -0
- package/dist/parser/normalize.js +42 -0
- package/dist/parser/normalize.js.map +1 -0
- package/dist/parser/parse-file.d.ts +18 -0
- package/dist/parser/parse-file.d.ts.map +1 -0
- package/dist/parser/parse-file.js +68 -0
- package/dist/parser/parse-file.js.map +1 -0
- package/dist/parser/parse-line.d.ts +21 -0
- package/dist/parser/parse-line.d.ts.map +1 -0
- package/dist/parser/parse-line.js +230 -0
- package/dist/parser/parse-line.js.map +1 -0
- package/dist/parser/parse-project.d.ts +31 -0
- package/dist/parser/parse-project.d.ts.map +1 -0
- package/dist/parser/parse-project.js +281 -0
- package/dist/parser/parse-project.js.map +1 -0
- package/dist/report/index.d.ts +6 -0
- package/dist/report/index.d.ts.map +1 -0
- package/dist/report/index.js +6 -0
- package/dist/report/index.js.map +1 -0
- package/dist/report/mermaid.d.ts +15 -0
- package/dist/report/mermaid.d.ts.map +1 -0
- package/dist/report/mermaid.js +260 -0
- package/dist/report/mermaid.js.map +1 -0
- package/dist/report/report.d.ts +16 -0
- package/dist/report/report.d.ts.map +1 -0
- package/dist/report/report.js +211 -0
- package/dist/report/report.js.map +1 -0
- package/dist/tui/commands.d.ts +42 -0
- package/dist/tui/commands.d.ts.map +1 -0
- package/dist/tui/commands.js +1216 -0
- package/dist/tui/commands.js.map +1 -0
- package/dist/tui/config.d.ts +27 -0
- package/dist/tui/config.d.ts.map +1 -0
- package/dist/tui/config.js +27 -0
- package/dist/tui/config.js.map +1 -0
- package/dist/tui/format.d.ts +63 -0
- package/dist/tui/format.d.ts.map +1 -0
- package/dist/tui/format.js +253 -0
- package/dist/tui/format.js.map +1 -0
- package/dist/tui/index.d.ts +18 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +470 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/input.d.ts +63 -0
- package/dist/tui/input.d.ts.map +1 -0
- package/dist/tui/input.js +454 -0
- package/dist/tui/input.js.map +1 -0
- package/dist/types/index.d.ts +254 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +97 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GuardLink SARIF — Convert threat model findings to SARIF 2.1.0.
|
|
3
|
+
*
|
|
4
|
+
* SARIF (Static Analysis Results Interchange Format) is consumed by:
|
|
5
|
+
* - GitHub Advanced Security (code scanning alerts)
|
|
6
|
+
* - VS Code SARIF Viewer extension
|
|
7
|
+
* - Azure DevOps
|
|
8
|
+
* - SonarQube, Snyk, etc.
|
|
9
|
+
*
|
|
10
|
+
* We emit results for:
|
|
11
|
+
* 1. Unmitigated exposures (the primary security findings)
|
|
12
|
+
* 2. Parse errors (annotation syntax problems)
|
|
13
|
+
* 3. Dangling references (broken #id refs)
|
|
14
|
+
*
|
|
15
|
+
* @exposes #sarif to #info-disclosure [low] cwe:CWE-200 -- "SARIF output contains detailed threat model findings"
|
|
16
|
+
* @accepts #info-disclosure on #sarif -- "SARIF export for security tools is the intended feature"
|
|
17
|
+
* @exposes #sarif to #arbitrary-write [high] cwe:CWE-73 -- "SARIF written to user-specified output path"
|
|
18
|
+
* @mitigates #sarif against #arbitrary-write using #path-validation -- "CLI resolves output path before write"
|
|
19
|
+
* @flows #parser -> #sarif via ThreatModel -- "SARIF generator receives parsed threat model"
|
|
20
|
+
* @flows #sarif -> External_Security_Tools via SARIF_JSON -- "Output consumed by GitHub, VS Code, etc."
|
|
21
|
+
*/
|
|
22
|
+
// ─── Rule definitions ────────────────────────────────────────────────
|
|
23
|
+
const RULES = [
|
|
24
|
+
{
|
|
25
|
+
id: 'guardlink/unmitigated-exposure',
|
|
26
|
+
name: 'UnmitigatedExposure',
|
|
27
|
+
shortDescription: { text: 'Asset exposed to threat with no mitigation or acceptance' },
|
|
28
|
+
fullDescription: { text: 'An @exposes annotation exists but no matching @mitigates or @accepts covers this (asset, threat) pair. This represents an acknowledged but unaddressed security risk.' },
|
|
29
|
+
helpUri: 'https://guardlink.bugb.io/docs/exposures',
|
|
30
|
+
defaultConfiguration: { level: 'warning' },
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: 'guardlink/unmitigated-critical',
|
|
34
|
+
name: 'UnmitigatedCriticalExposure',
|
|
35
|
+
shortDescription: { text: 'Critical/high severity exposure with no mitigation' },
|
|
36
|
+
fullDescription: { text: 'A critical or high severity exposure exists without mitigation. This should be addressed before deployment.' },
|
|
37
|
+
helpUri: 'https://guardlink.bugb.io/docs/exposures',
|
|
38
|
+
defaultConfiguration: { level: 'error' },
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'guardlink/parse-error',
|
|
42
|
+
name: 'AnnotationParseError',
|
|
43
|
+
shortDescription: { text: 'Malformed GuardLink annotation' },
|
|
44
|
+
fullDescription: { text: 'A GuardLink annotation could not be parsed. Check syntax against the specification.' },
|
|
45
|
+
helpUri: 'https://guardlink.bugb.io/docs/syntax',
|
|
46
|
+
defaultConfiguration: { level: 'error' },
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'guardlink/dangling-ref',
|
|
50
|
+
name: 'DanglingReference',
|
|
51
|
+
shortDescription: { text: 'Reference to undefined threat, control, or asset ID' },
|
|
52
|
+
fullDescription: { text: 'An annotation references a #id that is not defined anywhere in the project.' },
|
|
53
|
+
helpUri: 'https://guardlink.bugb.io/docs/definitions',
|
|
54
|
+
defaultConfiguration: { level: 'warning' },
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
export function generateSarif(model, diagnostics = [], danglingRefs = [], options = {}) {
|
|
58
|
+
const { includeDiagnostics = true, includeDanglingRefs = true } = options;
|
|
59
|
+
const results = [];
|
|
60
|
+
// ── Unmitigated exposures ──
|
|
61
|
+
const mitigated = new Set();
|
|
62
|
+
const accepted = new Set();
|
|
63
|
+
for (const m of model.mitigations)
|
|
64
|
+
mitigated.add(`${m.asset}::${m.threat}`);
|
|
65
|
+
for (const a of model.acceptances)
|
|
66
|
+
accepted.add(`${a.asset}::${a.threat}`);
|
|
67
|
+
for (const e of model.exposures) {
|
|
68
|
+
const key = `${e.asset}::${e.threat}`;
|
|
69
|
+
if (mitigated.has(key) || accepted.has(key))
|
|
70
|
+
continue;
|
|
71
|
+
// Severity filter
|
|
72
|
+
if (options.minSeverity && !meetsMinSeverity(e.severity, options.minSeverity))
|
|
73
|
+
continue;
|
|
74
|
+
const isCritical = e.severity === 'critical' || e.severity === 'high';
|
|
75
|
+
const ruleId = isCritical ? 'guardlink/unmitigated-critical' : 'guardlink/unmitigated-exposure';
|
|
76
|
+
const level = isCritical ? 'error' : 'warning';
|
|
77
|
+
const threat = e.threat.startsWith('#') ? e.threat.slice(1) : e.threat;
|
|
78
|
+
const desc = e.description ? `: ${e.description}` : '';
|
|
79
|
+
results.push({
|
|
80
|
+
ruleId,
|
|
81
|
+
level,
|
|
82
|
+
message: { text: `${e.asset} is exposed to ${threat}${desc}` },
|
|
83
|
+
locations: [locationFrom(e.location.file, e.location.line)],
|
|
84
|
+
properties: {
|
|
85
|
+
severity: e.severity || 'unset',
|
|
86
|
+
asset: e.asset,
|
|
87
|
+
threat: e.threat,
|
|
88
|
+
...(e.external_refs.length > 0 ? { externalRefs: e.external_refs } : {}),
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
// ── Parse errors ──
|
|
93
|
+
if (includeDiagnostics) {
|
|
94
|
+
for (const d of diagnostics) {
|
|
95
|
+
if (d.level !== 'error')
|
|
96
|
+
continue;
|
|
97
|
+
results.push({
|
|
98
|
+
ruleId: 'guardlink/parse-error',
|
|
99
|
+
level: 'error',
|
|
100
|
+
message: { text: d.message },
|
|
101
|
+
locations: [locationFrom(d.file, d.line)],
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// ── Dangling refs ──
|
|
106
|
+
if (includeDanglingRefs) {
|
|
107
|
+
for (const d of danglingRefs) {
|
|
108
|
+
results.push({
|
|
109
|
+
ruleId: 'guardlink/dangling-ref',
|
|
110
|
+
level: 'warning',
|
|
111
|
+
message: { text: d.message },
|
|
112
|
+
locations: [locationFrom(d.file, d.line)],
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
$schema: 'https://raw.githubusercontent.com/oasis-tcs/sarif-spec/main/sarif-2.1/schema/sarif-schema-2.1.0.json',
|
|
118
|
+
version: '2.1.0',
|
|
119
|
+
runs: [{
|
|
120
|
+
tool: {
|
|
121
|
+
driver: {
|
|
122
|
+
name: 'GuardLink',
|
|
123
|
+
version: '1.0.0',
|
|
124
|
+
informationUri: 'https://guardlink.bugb.io',
|
|
125
|
+
rules: RULES,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
results,
|
|
129
|
+
}],
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
// ─── Helpers ─────────────────────────────────────────────────────────
|
|
133
|
+
function locationFrom(file, line) {
|
|
134
|
+
// SARIF uses forward-slash URIs
|
|
135
|
+
const uri = file.replace(/\\/g, '/');
|
|
136
|
+
return {
|
|
137
|
+
physicalLocation: {
|
|
138
|
+
artifactLocation: { uri },
|
|
139
|
+
region: { startLine: line },
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
const SEV_ORDER = { critical: 0, high: 1, medium: 2, low: 3 };
|
|
144
|
+
function meetsMinSeverity(actual, min) {
|
|
145
|
+
if (!actual || !min)
|
|
146
|
+
return true;
|
|
147
|
+
return (SEV_ORDER[actual] ?? 4) <= (SEV_ORDER[min] ?? 4);
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=sarif.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sarif.js","sourceRoot":"","sources":["../../src/analyzer/sarif.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAsDH,wEAAwE;AAExE,MAAM,KAAK,GAAgB;IACzB;QACE,EAAE,EAAE,gCAAgC;QACpC,IAAI,EAAE,qBAAqB;QAC3B,gBAAgB,EAAE,EAAE,IAAI,EAAE,0DAA0D,EAAE;QACtF,eAAe,EAAE,EAAE,IAAI,EAAE,uKAAuK,EAAE;QAClM,OAAO,EAAE,0CAA0C;QACnD,oBAAoB,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;KAC3C;IACD;QACE,EAAE,EAAE,gCAAgC;QACpC,IAAI,EAAE,6BAA6B;QACnC,gBAAgB,EAAE,EAAE,IAAI,EAAE,oDAAoD,EAAE;QAChF,eAAe,EAAE,EAAE,IAAI,EAAE,6GAA6G,EAAE;QACxI,OAAO,EAAE,0CAA0C;QACnD,oBAAoB,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;KACz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C,KAAK,EAAE,KAAK;qBACb;iBACF;gBACD,OAAO;aACR,CAAC;KACH,CAAC;AACJ,CAAC;AAED,wEAAwE;AAExE,SAAS,YAAY,CAAC,IAAY,EAAE,IAAY;IAC9C,gCAAgC;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACrC,OAAO;QACL,gBAAgB,EAAE;YAChB,gBAAgB,EAAE,EAAE,GAAG,EAAE;YACzB,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;SAC5B;KACF,CAAC;AACJ,CAAC;AAED,MAAM,SAAS,GAA2B,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;AAEtF,SAAS,gBAAgB,CAAC,MAAiB,EAAE,GAAc;IACzD,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACjC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* GuardLink CLI — Reference Implementation
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* guardlink init [dir] Initialize GuardLink in a project
|
|
7
|
+
* guardlink parse [dir] Parse annotations, output ThreatModel JSON
|
|
8
|
+
* guardlink status [dir] Show annotation coverage summary
|
|
9
|
+
* guardlink validate [dir] Check for syntax errors and dangling refs
|
|
10
|
+
* guardlink analyze [framework] AI-powered threat analysis (STRIDE, DREAD, etc.)
|
|
11
|
+
* guardlink annotate <prompt> Launch coding agent for annotation
|
|
12
|
+
* guardlink config <action> Manage LLM provider configuration
|
|
13
|
+
*
|
|
14
|
+
* @exposes #cli to #path-traversal [high] cwe:CWE-22 -- "Accepts directory paths from command line arguments"
|
|
15
|
+
* @exposes #cli to #arbitrary-write [high] cwe:CWE-73 -- "Writes reports and SARIF to user-specified output paths"
|
|
16
|
+
* @accepts #arbitrary-write on #cli -- "Intentional feature: users specify output paths for reports"
|
|
17
|
+
* @mitigates #cli against #path-traversal using #path-validation -- "resolve() normalizes paths before passing to submodules"
|
|
18
|
+
* @boundary between #cli and #parser (#cli-parser-boundary) -- "CLI is the primary user input trust boundary"
|
|
19
|
+
* @flows User -> #cli via argv -- "User provides directory paths and options via command line"
|
|
20
|
+
* @flows #cli -> #parser via parseProject -- "CLI dispatches parsed commands to parser"
|
|
21
|
+
* @flows #cli -> #report via generateReport -- "CLI writes report output"
|
|
22
|
+
* @flows #cli -> #init via initProject -- "CLI initializes project structure"
|
|
23
|
+
*/
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG"}
|