agentlint 0.1.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 +32 -0
- package/LICENSE +190 -0
- package/README.md +246 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +351 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/diff/index.d.ts +16 -0
- package/dist/diff/index.d.ts.map +1 -0
- package/dist/diff/index.js +204 -0
- package/dist/diff/index.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/ir/index.d.ts +2 -0
- package/dist/ir/index.d.ts.map +1 -0
- package/dist/ir/index.js +18 -0
- package/dist/ir/index.js.map +1 -0
- package/dist/ir/types.d.ts +369 -0
- package/dist/ir/types.d.ts.map +1 -0
- package/dist/ir/types.js +12 -0
- package/dist/ir/types.js.map +1 -0
- package/dist/parsers/base.d.ts +104 -0
- package/dist/parsers/base.d.ts.map +1 -0
- package/dist/parsers/base.js +373 -0
- package/dist/parsers/base.js.map +1 -0
- package/dist/parsers/claude.d.ts +30 -0
- package/dist/parsers/claude.d.ts.map +1 -0
- package/dist/parsers/claude.js +453 -0
- package/dist/parsers/claude.js.map +1 -0
- package/dist/parsers/cursor.d.ts +24 -0
- package/dist/parsers/cursor.d.ts.map +1 -0
- package/dist/parsers/cursor.js +305 -0
- package/dist/parsers/cursor.js.map +1 -0
- package/dist/parsers/factory.d.ts +30 -0
- package/dist/parsers/factory.d.ts.map +1 -0
- package/dist/parsers/factory.js +78 -0
- package/dist/parsers/factory.js.map +1 -0
- package/dist/parsers/index.d.ts +5 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/index.js +21 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/policy/index.d.ts +3 -0
- package/dist/policy/index.d.ts.map +1 -0
- package/dist/policy/index.js +19 -0
- package/dist/policy/index.js.map +1 -0
- package/dist/policy/loader.d.ts +23 -0
- package/dist/policy/loader.d.ts.map +1 -0
- package/dist/policy/loader.js +252 -0
- package/dist/policy/loader.js.map +1 -0
- package/dist/policy/types.d.ts +79 -0
- package/dist/policy/types.d.ts.map +1 -0
- package/dist/policy/types.js +99 -0
- package/dist/policy/types.js.map +1 -0
- package/dist/reports/index.d.ts +14 -0
- package/dist/reports/index.d.ts.map +1 -0
- package/dist/reports/index.js +54 -0
- package/dist/reports/index.js.map +1 -0
- package/dist/reports/json.d.ts +16 -0
- package/dist/reports/json.d.ts.map +1 -0
- package/dist/reports/json.js +126 -0
- package/dist/reports/json.js.map +1 -0
- package/dist/reports/sarif.d.ts +20 -0
- package/dist/reports/sarif.d.ts.map +1 -0
- package/dist/reports/sarif.js +169 -0
- package/dist/reports/sarif.js.map +1 -0
- package/dist/reports/text.d.ts +25 -0
- package/dist/reports/text.d.ts.map +1 -0
- package/dist/reports/text.js +283 -0
- package/dist/reports/text.js.map +1 -0
- package/dist/reports/types.d.ts +88 -0
- package/dist/reports/types.d.ts.map +1 -0
- package/dist/reports/types.js +6 -0
- package/dist/reports/types.js.map +1 -0
- package/dist/rules/base.d.ts +16 -0
- package/dist/rules/base.d.ts.map +1 -0
- package/dist/rules/base.js +48 -0
- package/dist/rules/base.js.map +1 -0
- package/dist/rules/engine.d.ts +61 -0
- package/dist/rules/engine.d.ts.map +1 -0
- package/dist/rules/engine.js +195 -0
- package/dist/rules/engine.js.map +1 -0
- package/dist/rules/execution.d.ts +33 -0
- package/dist/rules/execution.d.ts.map +1 -0
- package/dist/rules/execution.js +154 -0
- package/dist/rules/execution.js.map +1 -0
- package/dist/rules/filesystem.d.ts +36 -0
- package/dist/rules/filesystem.d.ts.map +1 -0
- package/dist/rules/filesystem.js +227 -0
- package/dist/rules/filesystem.js.map +1 -0
- package/dist/rules/hook.d.ts +25 -0
- package/dist/rules/hook.d.ts.map +1 -0
- package/dist/rules/hook.js +112 -0
- package/dist/rules/hook.js.map +1 -0
- package/dist/rules/index.d.ts +12 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +28 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/instruction.d.ts +25 -0
- package/dist/rules/instruction.d.ts.map +1 -0
- package/dist/rules/instruction.js +162 -0
- package/dist/rules/instruction.js.map +1 -0
- package/dist/rules/network.d.ts +33 -0
- package/dist/rules/network.d.ts.map +1 -0
- package/dist/rules/network.js +145 -0
- package/dist/rules/network.js.map +1 -0
- package/dist/rules/observability.d.ts +25 -0
- package/dist/rules/observability.d.ts.map +1 -0
- package/dist/rules/observability.js +105 -0
- package/dist/rules/observability.js.map +1 -0
- package/dist/rules/scope.d.ts +37 -0
- package/dist/rules/scope.d.ts.map +1 -0
- package/dist/rules/scope.js +173 -0
- package/dist/rules/scope.js.map +1 -0
- package/dist/rules/secrets.d.ts +35 -0
- package/dist/rules/secrets.d.ts.map +1 -0
- package/dist/rules/secrets.js +273 -0
- package/dist/rules/secrets.js.map +1 -0
- package/dist/rules/types.d.ts +58 -0
- package/dist/rules/types.d.ts.map +1 -0
- package/dist/rules/types.js +6 -0
- package/dist/rules/types.js.map +1 -0
- package/dist/scanner.d.ts +61 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/scanner.js +441 -0
- package/dist/scanner.js.map +1 -0
- package/dist/utils/hash.d.ts +28 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/hash.js +94 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +18 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +76 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AgentLint - Static analysis and security scanner for AI agent configuration files
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.compareScanResults = exports.Scanner = exports.DEFAULT_POLICY = exports.generateDefaultConfig = exports.validatePolicy = exports.loadPolicy = exports.generateDiffSarifReport = exports.SarifReportGenerator = exports.generateDiffJsonReport = exports.JsonReportGenerator = exports.generateDiffTextReport = exports.TextReportGenerator = exports.generateDiffReport = exports.generateReport = void 0;
|
|
23
|
+
// Export IR types (core data structures)
|
|
24
|
+
__exportStar(require("./ir/types"), exports);
|
|
25
|
+
// Export parsers
|
|
26
|
+
__exportStar(require("./parsers"), exports);
|
|
27
|
+
// Export rules
|
|
28
|
+
__exportStar(require("./rules"), exports);
|
|
29
|
+
// Export reports (excluding types to avoid conflicts)
|
|
30
|
+
var reports_1 = require("./reports");
|
|
31
|
+
Object.defineProperty(exports, "generateReport", { enumerable: true, get: function () { return reports_1.generateReport; } });
|
|
32
|
+
Object.defineProperty(exports, "generateDiffReport", { enumerable: true, get: function () { return reports_1.generateDiffReport; } });
|
|
33
|
+
var text_1 = require("./reports/text");
|
|
34
|
+
Object.defineProperty(exports, "TextReportGenerator", { enumerable: true, get: function () { return text_1.TextReportGenerator; } });
|
|
35
|
+
Object.defineProperty(exports, "generateDiffTextReport", { enumerable: true, get: function () { return text_1.generateDiffTextReport; } });
|
|
36
|
+
var json_1 = require("./reports/json");
|
|
37
|
+
Object.defineProperty(exports, "JsonReportGenerator", { enumerable: true, get: function () { return json_1.JsonReportGenerator; } });
|
|
38
|
+
Object.defineProperty(exports, "generateDiffJsonReport", { enumerable: true, get: function () { return json_1.generateDiffJsonReport; } });
|
|
39
|
+
var sarif_1 = require("./reports/sarif");
|
|
40
|
+
Object.defineProperty(exports, "SarifReportGenerator", { enumerable: true, get: function () { return sarif_1.SarifReportGenerator; } });
|
|
41
|
+
Object.defineProperty(exports, "generateDiffSarifReport", { enumerable: true, get: function () { return sarif_1.generateDiffSarifReport; } });
|
|
42
|
+
// Export policy (use PolicyConfig from policy, not ir/types which has different structure)
|
|
43
|
+
var loader_1 = require("./policy/loader");
|
|
44
|
+
Object.defineProperty(exports, "loadPolicy", { enumerable: true, get: function () { return loader_1.loadPolicy; } });
|
|
45
|
+
Object.defineProperty(exports, "validatePolicy", { enumerable: true, get: function () { return loader_1.validatePolicy; } });
|
|
46
|
+
Object.defineProperty(exports, "generateDefaultConfig", { enumerable: true, get: function () { return loader_1.generateDefaultConfig; } });
|
|
47
|
+
var types_1 = require("./policy/types");
|
|
48
|
+
Object.defineProperty(exports, "DEFAULT_POLICY", { enumerable: true, get: function () { return types_1.DEFAULT_POLICY; } });
|
|
49
|
+
// Export scanner
|
|
50
|
+
var scanner_1 = require("./scanner");
|
|
51
|
+
Object.defineProperty(exports, "Scanner", { enumerable: true, get: function () { return scanner_1.Scanner; } });
|
|
52
|
+
// Export diff
|
|
53
|
+
var diff_1 = require("./diff");
|
|
54
|
+
Object.defineProperty(exports, "compareScanResults", { enumerable: true, get: function () { return diff_1.compareScanResults; } });
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;AAEH,yCAAyC;AACzC,6CAA2B;AAE3B,iBAAiB;AACjB,4CAA0B;AAE1B,eAAe;AACf,0CAAwB;AAExB,sDAAsD;AACtD,qCAA+D;AAAtD,yGAAA,cAAc,OAAA;AAAE,6GAAA,kBAAkB,OAAA;AAC3C,uCAA6E;AAApE,2GAAA,mBAAmB,OAAA;AAAE,8GAAA,sBAAsB,OAAA;AACpD,uCAA6E;AAApE,2GAAA,mBAAmB,OAAA;AAAE,8GAAA,sBAAsB,OAAA;AACpD,yCAAgF;AAAvE,6GAAA,oBAAoB,OAAA;AAAE,gHAAA,uBAAuB,OAAA;AAGtD,2FAA2F;AAC3F,0CAAoF;AAA3E,oGAAA,UAAU,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,+GAAA,qBAAqB,OAAA;AAC1D,wCAAgD;AAAvC,uGAAA,cAAc,OAAA;AAGvB,iBAAiB;AACjB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAGhB,cAAc;AACd,+BAA4C;AAAnC,0GAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ir/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
package/dist/ir/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ir/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB"}
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentLint Internal IR Schema v0.1
|
|
3
|
+
* Core type definitions for the intermediate representation
|
|
4
|
+
*/
|
|
5
|
+
export declare const IR_SCHEMA_VERSION = "agentlint.ir.v0.1";
|
|
6
|
+
export declare const REPORT_VERSION = "agentlint.report.v1.0";
|
|
7
|
+
export declare const PERMISSIONS_VERSION = "agentlint.permissions.v0.1";
|
|
8
|
+
export type Severity = 'low' | 'medium' | 'high';
|
|
9
|
+
export type ToolFamily = 'claude' | 'cursor' | 'generic' | 'unknown';
|
|
10
|
+
export type DocType = 'skill' | 'agent' | 'hook' | 'rules' | 'memory' | 'unknown';
|
|
11
|
+
export type DocFormat = 'markdown' | 'text' | 'shell' | 'json' | 'yaml' | 'unknown';
|
|
12
|
+
export type ParseStatus = 'ok' | 'partial' | 'failed';
|
|
13
|
+
export type ContextType = 'interactive' | 'hook' | 'ci' | 'unknown';
|
|
14
|
+
export type TriggerType = 'on_edit' | 'pre_commit' | 'post_edit' | 'on_pr' | 'scheduled' | 'manual' | 'unknown';
|
|
15
|
+
export type ActionType = 'shell_exec' | 'file_read' | 'file_write' | 'network_call' | 'git_operation' | 'tool_integration' | 'unknown';
|
|
16
|
+
export type EvidenceKind = 'substring' | 'regex' | 'heuristic';
|
|
17
|
+
export type NetworkDirection = 'outbound' | 'inbound' | 'unknown';
|
|
18
|
+
export type FilesystemOperation = 'read' | 'write' | 'delete' | 'chmod' | 'unknown';
|
|
19
|
+
export type GitOperation = 'commit' | 'push' | 'checkout' | 'merge' | 'tag' | 'rebase' | 'unknown';
|
|
20
|
+
export type LinkKind = 'url' | 'file_ref' | 'mcp_server' | 'unknown';
|
|
21
|
+
export type CapabilityType = 'filesystem' | 'shell_exec' | 'network' | 'secrets' | 'git' | 'ci_modification' | 'unknown';
|
|
22
|
+
export type ScanStatus = 'pass' | 'warn' | 'fail';
|
|
23
|
+
export interface SourceRef {
|
|
24
|
+
source_id: string;
|
|
25
|
+
repo_url?: string;
|
|
26
|
+
repo_host?: string;
|
|
27
|
+
git_ref?: string;
|
|
28
|
+
scan_root: string;
|
|
29
|
+
collected_at: string;
|
|
30
|
+
hashes: {
|
|
31
|
+
algo: string;
|
|
32
|
+
tree_hash?: string;
|
|
33
|
+
file_hashes?: Record<string, string>;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface ParseResult {
|
|
37
|
+
status: ParseStatus;
|
|
38
|
+
confidence: number;
|
|
39
|
+
errors: string[];
|
|
40
|
+
notes: string[];
|
|
41
|
+
}
|
|
42
|
+
export interface Anchors {
|
|
43
|
+
start_line: number;
|
|
44
|
+
end_line: number;
|
|
45
|
+
}
|
|
46
|
+
export interface InstructionBlock {
|
|
47
|
+
block_id: string;
|
|
48
|
+
kind: 'rule' | 'guideline' | 'command' | 'narrative' | 'unknown';
|
|
49
|
+
text: string;
|
|
50
|
+
anchors: Anchors;
|
|
51
|
+
}
|
|
52
|
+
export interface ContextTrigger {
|
|
53
|
+
type: TriggerType;
|
|
54
|
+
details?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface ContextProfile {
|
|
57
|
+
primary: ContextType;
|
|
58
|
+
triggers: ContextTrigger[];
|
|
59
|
+
requires_user_confirmation?: boolean;
|
|
60
|
+
runs_in_privileged_env?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface Evidence {
|
|
63
|
+
kind: EvidenceKind;
|
|
64
|
+
value: string;
|
|
65
|
+
confidence: number;
|
|
66
|
+
}
|
|
67
|
+
export interface ShellDetails {
|
|
68
|
+
command?: string;
|
|
69
|
+
dynamic?: boolean;
|
|
70
|
+
patterns?: string[];
|
|
71
|
+
allowlist_hint?: string[];
|
|
72
|
+
}
|
|
73
|
+
export interface FilesystemDetails {
|
|
74
|
+
operation: FilesystemOperation;
|
|
75
|
+
paths: string[];
|
|
76
|
+
sensitive_paths_touched?: string[];
|
|
77
|
+
}
|
|
78
|
+
export interface NetworkDetails {
|
|
79
|
+
direction: NetworkDirection;
|
|
80
|
+
domains?: string[];
|
|
81
|
+
urls?: string[];
|
|
82
|
+
protocols?: string[];
|
|
83
|
+
fetches_executable?: boolean;
|
|
84
|
+
}
|
|
85
|
+
export interface GitDetails {
|
|
86
|
+
operation: GitOperation;
|
|
87
|
+
ref?: string;
|
|
88
|
+
remote?: string;
|
|
89
|
+
}
|
|
90
|
+
export interface SecretsDetails {
|
|
91
|
+
reads_env_vars?: string[];
|
|
92
|
+
reads_files?: string[];
|
|
93
|
+
propagates_to?: ('shell' | 'network' | 'file' | 'unknown')[];
|
|
94
|
+
}
|
|
95
|
+
export interface Action {
|
|
96
|
+
action_id: string;
|
|
97
|
+
type: ActionType;
|
|
98
|
+
context: ContextType;
|
|
99
|
+
summary: string;
|
|
100
|
+
anchors: Anchors;
|
|
101
|
+
shell?: ShellDetails;
|
|
102
|
+
filesystem?: FilesystemDetails;
|
|
103
|
+
network?: NetworkDetails;
|
|
104
|
+
git?: GitDetails;
|
|
105
|
+
secrets?: SecretsDetails;
|
|
106
|
+
evidence: Evidence[];
|
|
107
|
+
}
|
|
108
|
+
export interface DocumentLink {
|
|
109
|
+
kind: LinkKind;
|
|
110
|
+
target: string;
|
|
111
|
+
anchors: Anchors;
|
|
112
|
+
}
|
|
113
|
+
export interface AgentDocument {
|
|
114
|
+
doc_id: string;
|
|
115
|
+
source_id: string;
|
|
116
|
+
path: string;
|
|
117
|
+
tool_family: ToolFamily;
|
|
118
|
+
doc_type: DocType;
|
|
119
|
+
format: DocFormat;
|
|
120
|
+
hash: {
|
|
121
|
+
algo: string;
|
|
122
|
+
value: string;
|
|
123
|
+
};
|
|
124
|
+
parse: ParseResult;
|
|
125
|
+
declared_intents?: string[];
|
|
126
|
+
instruction_blocks: InstructionBlock[];
|
|
127
|
+
actions: Action[];
|
|
128
|
+
capabilities: Capability[];
|
|
129
|
+
context_profile: ContextProfile;
|
|
130
|
+
links: DocumentLink[];
|
|
131
|
+
}
|
|
132
|
+
export interface CapabilityScope {
|
|
133
|
+
filesystem?: {
|
|
134
|
+
read?: string[];
|
|
135
|
+
write?: string[];
|
|
136
|
+
delete?: string[];
|
|
137
|
+
};
|
|
138
|
+
shell_exec?: {
|
|
139
|
+
enabled?: boolean;
|
|
140
|
+
allowed_commands?: string[];
|
|
141
|
+
deny_patterns?: string[];
|
|
142
|
+
};
|
|
143
|
+
network?: {
|
|
144
|
+
outbound?: boolean;
|
|
145
|
+
inbound?: boolean;
|
|
146
|
+
allowed_domains?: string[];
|
|
147
|
+
allowed_urls?: string[];
|
|
148
|
+
};
|
|
149
|
+
secrets?: {
|
|
150
|
+
env_vars?: string[];
|
|
151
|
+
files?: string[];
|
|
152
|
+
};
|
|
153
|
+
git?: {
|
|
154
|
+
allowed_ops?: string[];
|
|
155
|
+
allowed_remotes?: string[];
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
export interface Capability {
|
|
159
|
+
cap_id: string;
|
|
160
|
+
type: CapabilityType;
|
|
161
|
+
scope: CapabilityScope;
|
|
162
|
+
derived_from_actions: string[];
|
|
163
|
+
confidence: number;
|
|
164
|
+
}
|
|
165
|
+
export interface CapabilitySummary {
|
|
166
|
+
filesystem: {
|
|
167
|
+
read: string[];
|
|
168
|
+
write: string[];
|
|
169
|
+
touches_sensitive_paths: string[];
|
|
170
|
+
};
|
|
171
|
+
shell_exec: {
|
|
172
|
+
enabled: boolean;
|
|
173
|
+
dynamic_detected: boolean;
|
|
174
|
+
examples: string[];
|
|
175
|
+
};
|
|
176
|
+
network: {
|
|
177
|
+
outbound: boolean;
|
|
178
|
+
inbound: boolean;
|
|
179
|
+
allowed_domains: string[];
|
|
180
|
+
fetches_executable: boolean;
|
|
181
|
+
};
|
|
182
|
+
secrets: {
|
|
183
|
+
env_vars_referenced: string[];
|
|
184
|
+
files_referenced: string[];
|
|
185
|
+
propagation_detected: boolean;
|
|
186
|
+
};
|
|
187
|
+
git: {
|
|
188
|
+
ops: string[];
|
|
189
|
+
};
|
|
190
|
+
contexts: {
|
|
191
|
+
has_hooks: boolean;
|
|
192
|
+
has_ci_context: boolean;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
export interface PermissionManifest {
|
|
196
|
+
manifest_version: string;
|
|
197
|
+
permissions: {
|
|
198
|
+
filesystem: {
|
|
199
|
+
read: string[];
|
|
200
|
+
write: string[];
|
|
201
|
+
delete: string[];
|
|
202
|
+
};
|
|
203
|
+
shell_exec: {
|
|
204
|
+
enabled: boolean;
|
|
205
|
+
allowed_commands: string[];
|
|
206
|
+
};
|
|
207
|
+
network: {
|
|
208
|
+
outbound: boolean;
|
|
209
|
+
allowed_domains: string[];
|
|
210
|
+
};
|
|
211
|
+
secrets: {
|
|
212
|
+
env_vars: string[];
|
|
213
|
+
files: string[];
|
|
214
|
+
};
|
|
215
|
+
git: {
|
|
216
|
+
allowed_ops: string[];
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
export interface FindingLocation {
|
|
221
|
+
path: string;
|
|
222
|
+
start_line: number;
|
|
223
|
+
end_line: number;
|
|
224
|
+
}
|
|
225
|
+
export interface RelatedAction {
|
|
226
|
+
action_type: ActionType;
|
|
227
|
+
context: ContextType;
|
|
228
|
+
summary: string;
|
|
229
|
+
anchors: Anchors;
|
|
230
|
+
}
|
|
231
|
+
export interface FindingFingerprints {
|
|
232
|
+
stable: string;
|
|
233
|
+
location: string;
|
|
234
|
+
content: string;
|
|
235
|
+
}
|
|
236
|
+
export interface Finding {
|
|
237
|
+
finding_id: string;
|
|
238
|
+
rule_id: string;
|
|
239
|
+
group: string;
|
|
240
|
+
severity: Severity;
|
|
241
|
+
title: string;
|
|
242
|
+
description: string;
|
|
243
|
+
message: string;
|
|
244
|
+
recommendation: string;
|
|
245
|
+
confidence: number;
|
|
246
|
+
tags: string[];
|
|
247
|
+
location: FindingLocation;
|
|
248
|
+
evidence: Evidence[];
|
|
249
|
+
related_actions: RelatedAction[];
|
|
250
|
+
fingerprints: FindingFingerprints;
|
|
251
|
+
}
|
|
252
|
+
export interface DocumentSummary {
|
|
253
|
+
doc_id: string;
|
|
254
|
+
path: string;
|
|
255
|
+
tool_family: ToolFamily;
|
|
256
|
+
doc_type: DocType;
|
|
257
|
+
format: DocFormat;
|
|
258
|
+
hash: string;
|
|
259
|
+
parse: ParseResult;
|
|
260
|
+
context_profile: ContextProfile;
|
|
261
|
+
action_counts: {
|
|
262
|
+
shell_exec: number;
|
|
263
|
+
file_write: number;
|
|
264
|
+
network_call: number;
|
|
265
|
+
secrets: number;
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
export interface ToolInfo {
|
|
269
|
+
name: string;
|
|
270
|
+
version: string;
|
|
271
|
+
commit?: string;
|
|
272
|
+
build: {
|
|
273
|
+
os: string;
|
|
274
|
+
arch: string;
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
export interface ScanInputs {
|
|
278
|
+
scan_root: string;
|
|
279
|
+
sources: SourceRef[];
|
|
280
|
+
include: string[];
|
|
281
|
+
exclude: string[];
|
|
282
|
+
tool_mode: 'auto' | 'claude' | 'cursor';
|
|
283
|
+
}
|
|
284
|
+
export interface PolicyConfig {
|
|
285
|
+
ci_mode: boolean;
|
|
286
|
+
fail_on: Severity | 'none';
|
|
287
|
+
warn_on: Severity | 'none';
|
|
288
|
+
min_confidence: number;
|
|
289
|
+
rules_disabled: string[];
|
|
290
|
+
severity_overrides: Record<string, Severity>;
|
|
291
|
+
}
|
|
292
|
+
export interface ReportSummary {
|
|
293
|
+
documents_scanned: number;
|
|
294
|
+
files_matched: number;
|
|
295
|
+
parse: {
|
|
296
|
+
ok: number;
|
|
297
|
+
partial: number;
|
|
298
|
+
failed: number;
|
|
299
|
+
};
|
|
300
|
+
contexts: {
|
|
301
|
+
has_hooks: boolean;
|
|
302
|
+
has_ci_context: boolean;
|
|
303
|
+
};
|
|
304
|
+
counts_by_severity: {
|
|
305
|
+
high: number;
|
|
306
|
+
medium: number;
|
|
307
|
+
low: number;
|
|
308
|
+
};
|
|
309
|
+
status: ScanStatus;
|
|
310
|
+
exit_code: number;
|
|
311
|
+
}
|
|
312
|
+
export interface ToolError {
|
|
313
|
+
code: 'CONFIG_INVALID' | 'PARSE_FAILED' | 'INTERNAL_ERROR';
|
|
314
|
+
message: string;
|
|
315
|
+
details?: Record<string, unknown>;
|
|
316
|
+
}
|
|
317
|
+
export interface DiffChange {
|
|
318
|
+
change_id: string;
|
|
319
|
+
type: string;
|
|
320
|
+
severity: Severity;
|
|
321
|
+
message: string;
|
|
322
|
+
details: Record<string, unknown>;
|
|
323
|
+
}
|
|
324
|
+
export interface DiffResult {
|
|
325
|
+
base: {
|
|
326
|
+
ref: string;
|
|
327
|
+
tree_hash: string;
|
|
328
|
+
};
|
|
329
|
+
target: {
|
|
330
|
+
ref: string;
|
|
331
|
+
tree_hash: string;
|
|
332
|
+
};
|
|
333
|
+
summary: {
|
|
334
|
+
capability_expansion: boolean;
|
|
335
|
+
new_high_findings: number;
|
|
336
|
+
status: ScanStatus;
|
|
337
|
+
exit_code: number;
|
|
338
|
+
};
|
|
339
|
+
changes: DiffChange[];
|
|
340
|
+
new_findings: Finding[];
|
|
341
|
+
resolved_findings: Finding[];
|
|
342
|
+
}
|
|
343
|
+
export interface AgentConfigBundle {
|
|
344
|
+
schema_version: string;
|
|
345
|
+
bundle_id: string;
|
|
346
|
+
generated_at: string;
|
|
347
|
+
sources: SourceRef[];
|
|
348
|
+
documents: AgentDocument[];
|
|
349
|
+
capability_summary: CapabilitySummary;
|
|
350
|
+
recommended_permissions?: PermissionManifest;
|
|
351
|
+
annotations?: Record<string, unknown>;
|
|
352
|
+
}
|
|
353
|
+
export interface AgentLintReport {
|
|
354
|
+
report_version: string;
|
|
355
|
+
schema_version: string;
|
|
356
|
+
generated_at: string;
|
|
357
|
+
tool: ToolInfo;
|
|
358
|
+
inputs: ScanInputs;
|
|
359
|
+
policy: PolicyConfig;
|
|
360
|
+
summary: ReportSummary;
|
|
361
|
+
documents: DocumentSummary[];
|
|
362
|
+
capability_summary: CapabilitySummary;
|
|
363
|
+
recommended_permissions: PermissionManifest;
|
|
364
|
+
findings: Finding[];
|
|
365
|
+
diff: DiffResult | null;
|
|
366
|
+
errors: ToolError[];
|
|
367
|
+
annotations: Record<string, unknown>;
|
|
368
|
+
}
|
|
369
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ir/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AACrD,eAAO,MAAM,cAAc,0BAA0B,CAAC;AACtD,eAAO,MAAM,mBAAmB,+BAA+B,CAAC;AAGhE,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AACjD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AACrE,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAClF,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SA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EAAE,OAAO,EAAE,CAAC;CAC9B;AAGD,MAAM,WAAW,iBAAiB;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,kBAAkB,EAAE,iBAAiB,CAAC;IACtC,uBAAuB,CAAC,EAAE,kBAAkB,CAAC;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAGD,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,aAAa,CAAC;IACvB,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,kBAAkB,EAAE,iBAAiB,CAAC;IACtC,uBAAuB,EAAE,kBAAkB,CAAC;IAC5C,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC"}
|
package/dist/ir/types.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AgentLint Internal IR Schema v0.1
|
|
4
|
+
* Core type definitions for the intermediate representation
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.PERMISSIONS_VERSION = exports.REPORT_VERSION = exports.IR_SCHEMA_VERSION = void 0;
|
|
8
|
+
// Schema version constant
|
|
9
|
+
exports.IR_SCHEMA_VERSION = 'agentlint.ir.v0.1';
|
|
10
|
+
exports.REPORT_VERSION = 'agentlint.report.v1.0';
|
|
11
|
+
exports.PERMISSIONS_VERSION = 'agentlint.permissions.v0.1';
|
|
12
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ir/types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,0BAA0B;AACb,QAAA,iBAAiB,GAAG,mBAAmB,CAAC;AACxC,QAAA,cAAc,GAAG,uBAAuB,CAAC;AACzC,QAAA,mBAAmB,GAAG,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base parser interface and utilities
|
|
3
|
+
*/
|
|
4
|
+
import { AgentDocument, Action, Capability, ContextProfile, ContextType, DocFormat, DocType, ToolFamily, Anchors } from '../ir/types';
|
|
5
|
+
/**
|
|
6
|
+
* Parser result containing the document and any errors
|
|
7
|
+
*/
|
|
8
|
+
export interface ParserResult {
|
|
9
|
+
document: AgentDocument | null;
|
|
10
|
+
errors: string[];
|
|
11
|
+
warnings: string[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Parser options
|
|
15
|
+
*/
|
|
16
|
+
export interface ParserOptions {
|
|
17
|
+
sourceId: string;
|
|
18
|
+
minConfidence: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Base parser class
|
|
22
|
+
*/
|
|
23
|
+
export declare abstract class BaseParser {
|
|
24
|
+
protected sourceId: string;
|
|
25
|
+
protected minConfidence: number;
|
|
26
|
+
constructor(options: ParserOptions);
|
|
27
|
+
/**
|
|
28
|
+
* Parse a file and return the document
|
|
29
|
+
*/
|
|
30
|
+
abstract parse(filePath: string, content: string): ParserResult;
|
|
31
|
+
/**
|
|
32
|
+
* Get the tool family this parser handles
|
|
33
|
+
*/
|
|
34
|
+
abstract getToolFamily(): ToolFamily;
|
|
35
|
+
/**
|
|
36
|
+
* Check if this parser can handle the given file
|
|
37
|
+
*/
|
|
38
|
+
abstract canHandle(filePath: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Create a base document structure
|
|
41
|
+
*/
|
|
42
|
+
protected createBaseDocument(filePath: string, content: string, docType: DocType, format: DocFormat): AgentDocument;
|
|
43
|
+
/**
|
|
44
|
+
* Create default context profile based on document type
|
|
45
|
+
*/
|
|
46
|
+
protected createDefaultContextProfile(docType: DocType): ContextProfile;
|
|
47
|
+
/**
|
|
48
|
+
* Create a shell exec action
|
|
49
|
+
*/
|
|
50
|
+
protected createShellAction(command: string, anchors: Anchors, context: ContextType, dynamic?: boolean, confidence?: number): Action;
|
|
51
|
+
/**
|
|
52
|
+
* Create a network action
|
|
53
|
+
*/
|
|
54
|
+
protected createNetworkAction(url: string, anchors: Anchors, context: ContextType, fetchesExecutable?: boolean, confidence?: number): Action;
|
|
55
|
+
/**
|
|
56
|
+
* Create a file write action
|
|
57
|
+
*/
|
|
58
|
+
protected createFileWriteAction(paths: string[], anchors: Anchors, context: ContextType, confidence?: number): Action;
|
|
59
|
+
/**
|
|
60
|
+
* Create a secrets access action
|
|
61
|
+
*/
|
|
62
|
+
protected createSecretsAction(envVars: string[], files: string[], anchors: Anchors, context: ContextType, propagatesTo?: ('shell' | 'network' | 'file')[], confidence?: number): Action;
|
|
63
|
+
/**
|
|
64
|
+
* Derive capabilities from actions
|
|
65
|
+
*/
|
|
66
|
+
protected deriveCapabilities(actions: Action[]): Capability[];
|
|
67
|
+
/**
|
|
68
|
+
* Merge action details into capability scope
|
|
69
|
+
*/
|
|
70
|
+
private mergeActionIntoCapability;
|
|
71
|
+
/**
|
|
72
|
+
* Extract dynamic execution patterns from a command
|
|
73
|
+
*/
|
|
74
|
+
protected extractDynamicPatterns(command: string): string[];
|
|
75
|
+
/**
|
|
76
|
+
* Extract domain from URL
|
|
77
|
+
*/
|
|
78
|
+
protected extractDomain(url: string): string | null;
|
|
79
|
+
/**
|
|
80
|
+
* Check if a path is considered sensitive
|
|
81
|
+
*/
|
|
82
|
+
protected isSensitivePath(path: string): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Known secret environment variables
|
|
85
|
+
*/
|
|
86
|
+
protected readonly KNOWN_SECRET_VARS: string[];
|
|
87
|
+
/**
|
|
88
|
+
* Check if an environment variable is a known secret
|
|
89
|
+
*/
|
|
90
|
+
protected isKnownSecretVar(varName: string): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Extract environment variable references from text
|
|
93
|
+
*/
|
|
94
|
+
protected extractEnvVars(text: string): string[];
|
|
95
|
+
/**
|
|
96
|
+
* Extract URLs from text
|
|
97
|
+
*/
|
|
98
|
+
protected extractUrls(text: string): string[];
|
|
99
|
+
/**
|
|
100
|
+
* Check if URL points to executable content
|
|
101
|
+
*/
|
|
102
|
+
protected isExecutableUrl(url: string): boolean;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/parsers/base.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,aAAa,EACb,MAAM,EAEN,UAAU,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,OAAO,EAIP,UAAU,EACV,OAAO,EAOR,MAAM,aAAa,CAAC;AAGrB;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,8BAAsB,UAAU;IAC9B,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC;gB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