@noego/trust 0.4.0 → 0.5.0-dev.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/README.md +926 -13
- package/dist/baseline-B0AplCuF.d.ts +362 -0
- package/dist/chunk-NG4KYWVW.js +6154 -0
- package/dist/chunk-NG4KYWVW.js.map +1 -0
- package/dist/chunk-OSSITT3R.js +156 -0
- package/dist/chunk-OSSITT3R.js.map +1 -0
- package/dist/chunk-V72KWVWP.js +2820 -0
- package/dist/chunk-V72KWVWP.js.map +1 -0
- package/dist/cli/index.js +1140 -63
- package/dist/cli/index.js.map +1 -1
- package/dist/core/index.d.ts +127 -0
- package/dist/core/index.js +115 -0
- package/dist/core/index.js.map +1 -0
- package/dist/eslint/index.d.ts +73 -167
- package/dist/eslint/index.js +320 -32
- package/dist/eslint/index.js.map +1 -1
- package/package.json +7 -4
- package/dist/chunk-YJYGTNJD.js +0 -2168
- package/dist/chunk-YJYGTNJD.js.map +0 -1
package/dist/eslint/index.js
CHANGED
|
@@ -1,67 +1,330 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
TrustPolicy,
|
|
3
|
+
acceptDirectiveFindings,
|
|
4
|
+
acceptanceOf,
|
|
5
|
+
alwaysExits,
|
|
6
|
+
catchProblem,
|
|
7
|
+
claimSpan,
|
|
8
|
+
droppedResultContext,
|
|
9
|
+
droppedResultData,
|
|
10
|
+
droppedResultsIn,
|
|
11
|
+
emptyTrustConfig,
|
|
12
|
+
entryMatches,
|
|
13
|
+
guardOf,
|
|
14
|
+
nameBasedGuardContext,
|
|
15
|
+
policyFor,
|
|
16
|
+
redundantGuardData,
|
|
17
|
+
redundantGuardsIn,
|
|
18
|
+
throwProblem,
|
|
19
|
+
typeClaimContext,
|
|
20
|
+
typeClaimsIn,
|
|
21
|
+
typedGuardContext,
|
|
22
|
+
untrustedCallProblem,
|
|
23
|
+
untrustedHandoffData,
|
|
24
|
+
untrustedHandoffsIn,
|
|
25
|
+
untrustedValueContext,
|
|
26
|
+
untrustedValueData,
|
|
27
|
+
untrustedValueMessageId,
|
|
28
|
+
untrustedValuesIn
|
|
29
|
+
} from "../chunk-V72KWVWP.js";
|
|
30
|
+
import {
|
|
31
|
+
ACCEPT_DIRECTIVE,
|
|
32
|
+
ACCEPT_DIRECTIVE_MESSAGES,
|
|
33
|
+
CATCH_ORIGIN,
|
|
34
|
+
DEFAULT_RULE_SETTINGS,
|
|
35
|
+
DIRECTIVE_ORIGIN,
|
|
36
|
+
DROPPED_RESULT_MESSAGES,
|
|
37
|
+
DROPPED_RESULT_RULE,
|
|
4
38
|
OriginResolver,
|
|
5
39
|
PRESETS,
|
|
40
|
+
REDUNDANT_GUARD_MESSAGES,
|
|
41
|
+
REDUNDANT_GUARD_ORIGIN,
|
|
42
|
+
REDUNDANT_GUARD_RULE,
|
|
43
|
+
THROW_MESSAGES,
|
|
6
44
|
THROW_RULE,
|
|
45
|
+
TYPE_CLAIM_KINDS,
|
|
46
|
+
TYPE_CLAIM_MESSAGES,
|
|
47
|
+
TYPE_CLAIM_RULE,
|
|
7
48
|
TrustConfigError,
|
|
8
|
-
|
|
49
|
+
UNANALYZABLE_ORIGIN,
|
|
9
50
|
UNTRUSTED_CALL_MESSAGES,
|
|
10
51
|
UNTRUSTED_CALL_RULE,
|
|
52
|
+
UNTRUSTED_VALUE_MESSAGES,
|
|
53
|
+
UNTRUSTED_VALUE_RULE,
|
|
54
|
+
VALIDATOR_DIRECTIVE,
|
|
55
|
+
WHOLE_BASELINE,
|
|
11
56
|
Zones,
|
|
12
|
-
alwaysExits,
|
|
13
|
-
catchProblem,
|
|
14
57
|
compareToBaseline,
|
|
15
58
|
countFindings,
|
|
16
59
|
effectiveTrustList,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
60
|
+
effectiveTypeTrustList,
|
|
61
|
+
isInsideValidator,
|
|
62
|
+
isMarkedValidator,
|
|
63
|
+
isRuleEnabled,
|
|
20
64
|
loadTrustConfig,
|
|
65
|
+
loadTrustConfigCached,
|
|
66
|
+
loadTypeScript,
|
|
21
67
|
normalizeOrigin,
|
|
22
|
-
originFromMessage,
|
|
23
68
|
parseBaseline,
|
|
24
69
|
serializeBaseline,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} from "../chunk-YJYGTNJD.js";
|
|
70
|
+
updateBaseline
|
|
71
|
+
} from "../chunk-NG4KYWVW.js";
|
|
28
72
|
|
|
29
|
-
// src/eslint/
|
|
30
|
-
|
|
31
|
-
|
|
73
|
+
// src/eslint/rule-setup.ts
|
|
74
|
+
import { resolve } from "path";
|
|
75
|
+
var OPTIONS_SCHEMA = [
|
|
76
|
+
{
|
|
77
|
+
type: "object",
|
|
78
|
+
properties: {
|
|
79
|
+
configFile: { type: "string" },
|
|
80
|
+
trust: { type: "array", items: { type: "string" } }
|
|
81
|
+
},
|
|
82
|
+
additionalProperties: false
|
|
83
|
+
}
|
|
84
|
+
];
|
|
85
|
+
function rangeLocator(ts, context) {
|
|
86
|
+
let parsed;
|
|
87
|
+
const sourceFile = () => parsed ??= ts.createSourceFile(context.filename, context.sourceCode.text, ts.ScriptTarget.Latest, true);
|
|
88
|
+
return { tsNode: locate, sourceFile };
|
|
89
|
+
function locate(node, is) {
|
|
90
|
+
const file = sourceFile();
|
|
91
|
+
const [start, end] = node.range;
|
|
92
|
+
let found;
|
|
93
|
+
const visit = (candidate) => {
|
|
94
|
+
if (found || candidate.pos > start || candidate.end < end) return;
|
|
95
|
+
if (candidate.end === end && candidate.getStart(file) === start && is(candidate)) found = candidate;
|
|
96
|
+
else ts.forEachChild(candidate, visit);
|
|
97
|
+
};
|
|
98
|
+
visit(file);
|
|
99
|
+
if (!found) throw new Error(`@noego/trust: no TypeScript node at ${context.filename}:${start}-${end}`);
|
|
100
|
+
return found;
|
|
101
|
+
}
|
|
32
102
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
103
|
+
function mapLocator(ts, context, map) {
|
|
104
|
+
const tsNode = function mapped(node, is) {
|
|
105
|
+
const target = map.get(node);
|
|
106
|
+
if (!target || !is(target)) throw new Error(`@noego/trust: unexpected TypeScript node in ${context.filename}`);
|
|
107
|
+
return target;
|
|
108
|
+
};
|
|
109
|
+
return { tsNode, sourceFile: () => tsNode(context.sourceCode.ast, ts.isSourceFile) };
|
|
110
|
+
}
|
|
111
|
+
function setupRule(context) {
|
|
112
|
+
const options = context.options[0] ?? {};
|
|
113
|
+
const ts = loadTypeScript(context.cwd);
|
|
114
|
+
const config = options.configFile ? loadTrustConfigCached(resolve(context.cwd, options.configFile)) : emptyTrustConfig(context.cwd);
|
|
115
|
+
const services = context.sourceCode.parserServices;
|
|
116
|
+
const program = services?.program ?? null;
|
|
117
|
+
const map = services?.esTreeNodeToTSNodeMap;
|
|
118
|
+
const { tsNode, sourceFile } = map ? mapLocator(ts, context, map) : rangeLocator(ts, context);
|
|
119
|
+
if (!program || !map) {
|
|
120
|
+
const zones = new Zones(config.rootDir, config.passthrough, config.ignore);
|
|
121
|
+
return { ts, zone: zones.zoneOf(context.filename), policy: null, guardContext: nameBasedGuardContext(ts), tsNode, checker: null, rules: config.rules, sourceFile };
|
|
122
|
+
}
|
|
123
|
+
const checker = program.getTypeChecker();
|
|
124
|
+
const policy = policyFor(ts, checker, config, (options.trust ?? []).map(normalizeOrigin));
|
|
125
|
+
return {
|
|
126
|
+
ts,
|
|
127
|
+
zone: policy.zones.zoneOf(context.filename),
|
|
128
|
+
policy,
|
|
129
|
+
guardContext: typedGuardContext(ts, checker, policy),
|
|
130
|
+
tsNode,
|
|
131
|
+
checker,
|
|
132
|
+
rules: config.rules,
|
|
133
|
+
sourceFile
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// src/eslint/rules/dropped-result.ts
|
|
40
138
|
var rule = {
|
|
139
|
+
meta: {
|
|
140
|
+
type: "problem",
|
|
141
|
+
docs: { description: "Report every place a Result that can still fail is dropped instead of returned or handled." },
|
|
142
|
+
schema: OPTIONS_SCHEMA,
|
|
143
|
+
messages: DROPPED_RESULT_MESSAGES
|
|
144
|
+
},
|
|
145
|
+
create(context) {
|
|
146
|
+
const setup = setupRule(context);
|
|
147
|
+
if (!isRuleEnabled(setup, DROPPED_RESULT_RULE)) return {};
|
|
148
|
+
if (!setup.policy || !setup.checker) {
|
|
149
|
+
throw new Error("dropped-result requires typed linting (parserOptions.projectService or project).");
|
|
150
|
+
}
|
|
151
|
+
if (setup.zone !== "checked") return {};
|
|
152
|
+
const { ts, tsNode, checker, policy } = setup;
|
|
153
|
+
const { sourceCode } = context;
|
|
154
|
+
return {
|
|
155
|
+
Program(node) {
|
|
156
|
+
const sourceFile = tsNode(node, ts.isSourceFile);
|
|
157
|
+
for (const dropped of droppedResultsIn(sourceFile, droppedResultContext(ts, checker, policy))) {
|
|
158
|
+
context.report({ loc: sourceCode.getLocFromIndex(dropped.start), messageId: dropped.origin, data: droppedResultData(dropped) });
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
var dropped_result_default = rule;
|
|
165
|
+
|
|
166
|
+
// src/eslint/rules/redundant-guard.ts
|
|
167
|
+
var rule2 = {
|
|
168
|
+
meta: {
|
|
169
|
+
type: "problem",
|
|
170
|
+
docs: { description: "Report every guard (Trust.try / Trust.tryAsync / try-catch) around code that cannot fail." },
|
|
171
|
+
schema: OPTIONS_SCHEMA,
|
|
172
|
+
messages: REDUNDANT_GUARD_MESSAGES
|
|
173
|
+
},
|
|
174
|
+
create(context) {
|
|
175
|
+
const setup = setupRule(context);
|
|
176
|
+
if (!isRuleEnabled(setup, REDUNDANT_GUARD_RULE)) return {};
|
|
177
|
+
if (!setup.policy || !setup.checker) {
|
|
178
|
+
throw new Error("redundant-guard requires typed linting (parserOptions.projectService or project).");
|
|
179
|
+
}
|
|
180
|
+
if (setup.zone !== "checked") return {};
|
|
181
|
+
const { ts, tsNode, checker, policy } = setup;
|
|
182
|
+
const { sourceCode } = context;
|
|
183
|
+
return {
|
|
184
|
+
Program(node) {
|
|
185
|
+
const sourceFile = tsNode(node, ts.isSourceFile);
|
|
186
|
+
const guardContext = typedGuardContext(ts, checker, policy);
|
|
187
|
+
for (const guard of redundantGuardsIn(sourceFile, { ts, checker, policy, guardContext })) {
|
|
188
|
+
context.report({ loc: sourceCode.getLocFromIndex(guard.start), messageId: "redundant", data: redundantGuardData(guard) });
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
var redundant_guard_default = rule2;
|
|
195
|
+
|
|
196
|
+
// src/eslint/rules/throw-must-return-result.ts
|
|
197
|
+
var rule3 = {
|
|
41
198
|
meta: {
|
|
42
199
|
type: "problem",
|
|
43
200
|
docs: { description: "Require every throw to be caught locally and returned as Result.err." },
|
|
44
201
|
schema: OPTIONS_SCHEMA,
|
|
45
|
-
messages: THROW_MESSAGES
|
|
202
|
+
messages: { ...THROW_MESSAGES, ...ACCEPT_DIRECTIVE_MESSAGES }
|
|
46
203
|
},
|
|
47
204
|
create(context) {
|
|
48
205
|
const setup = setupRule(context);
|
|
49
206
|
if (setup.zone !== "checked") return {};
|
|
207
|
+
const { ts, tsNode, guardContext, policy, checker } = setup;
|
|
208
|
+
const { sourceCode } = context;
|
|
50
209
|
return {
|
|
210
|
+
Program() {
|
|
211
|
+
const failureContext = policy && checker ? { ts, checker, policy, guardContext } : null;
|
|
212
|
+
const sourceFile = setup.sourceFile();
|
|
213
|
+
for (const found of acceptDirectiveFindings(ts, sourceFile, failureContext)) {
|
|
214
|
+
const loc = { start: sourceCode.getLocFromIndex(found.directive.pos), end: sourceCode.getLocFromIndex(found.directive.end) };
|
|
215
|
+
context.report({ loc, messageId: found.messageId, data: found.data });
|
|
216
|
+
}
|
|
217
|
+
},
|
|
51
218
|
ThrowStatement(node) {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
219
|
+
const statement = tsNode(node, ts.isThrowStatement);
|
|
220
|
+
const messageId = throwProblem(statement, guardContext);
|
|
221
|
+
if (messageId && !acceptanceOf(ts, statement)) context.report({ node, messageId });
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
var throw_must_return_result_default = rule3;
|
|
227
|
+
|
|
228
|
+
// src/eslint/rules/type-claim.ts
|
|
229
|
+
var rule4 = {
|
|
230
|
+
meta: {
|
|
231
|
+
type: "problem",
|
|
232
|
+
docs: { description: "Report every place a type is claimed instead of proven." },
|
|
233
|
+
schema: OPTIONS_SCHEMA,
|
|
234
|
+
messages: TYPE_CLAIM_MESSAGES
|
|
235
|
+
},
|
|
236
|
+
create(context) {
|
|
237
|
+
const setup = setupRule(context);
|
|
238
|
+
if (!isRuleEnabled(setup, TYPE_CLAIM_RULE)) return {};
|
|
239
|
+
if (!setup.policy || !setup.checker) {
|
|
240
|
+
throw new Error("type-claim requires typed linting (parserOptions.projectService or project).");
|
|
241
|
+
}
|
|
242
|
+
if (setup.zone !== "checked") return {};
|
|
243
|
+
const { ts, tsNode, checker, policy } = setup;
|
|
244
|
+
const { sourceCode } = context;
|
|
245
|
+
return {
|
|
246
|
+
Program(node) {
|
|
247
|
+
const sourceFile = tsNode(node, ts.isSourceFile);
|
|
248
|
+
for (const claim of typeClaimsIn(sourceFile, typeClaimContext(ts, checker, void 0, policy))) {
|
|
249
|
+
const span = claimSpan(claim, sourceFile);
|
|
250
|
+
const loc = { start: sourceCode.getLocFromIndex(span.start), end: sourceCode.getLocFromIndex(span.end) };
|
|
251
|
+
context.report({ loc, messageId: claim.origin, data: claim.data });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
var type_claim_default = rule4;
|
|
258
|
+
|
|
259
|
+
// src/eslint/rules/untrusted-call-must-return-result.ts
|
|
260
|
+
var rule5 = {
|
|
261
|
+
meta: {
|
|
262
|
+
type: "problem",
|
|
263
|
+
docs: { description: "Require calls into untrusted code to be handled locally and returned as Result.err." },
|
|
264
|
+
schema: OPTIONS_SCHEMA,
|
|
265
|
+
messages: UNTRUSTED_CALL_MESSAGES
|
|
266
|
+
},
|
|
267
|
+
create(context) {
|
|
268
|
+
const setup = setupRule(context);
|
|
269
|
+
if (!setup.policy || !setup.checker) {
|
|
270
|
+
throw new Error("untrusted-call-must-return-result requires typed linting (parserOptions.projectService or project).");
|
|
271
|
+
}
|
|
272
|
+
if (setup.zone !== "checked") return {};
|
|
273
|
+
const { ts, policy, tsNode, checker, guardContext } = setup;
|
|
274
|
+
const isCallOrNew = (node) => ts.isCallExpression(node) || ts.isNewExpression(node);
|
|
275
|
+
function check(node) {
|
|
276
|
+
const call = tsNode(node, isCallOrNew);
|
|
277
|
+
const problem = untrustedCallProblem(call, policy, checker, guardContext);
|
|
278
|
+
if (problem && !acceptanceOf(ts, call)) context.report({ node, messageId: problem.messageId, data: { origin: problem.origin } });
|
|
279
|
+
}
|
|
280
|
+
return { CallExpression: check, NewExpression: check };
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
var untrusted_call_must_return_result_default = rule5;
|
|
284
|
+
|
|
285
|
+
// src/eslint/rules/untrusted-value.ts
|
|
286
|
+
var rule6 = {
|
|
287
|
+
meta: {
|
|
288
|
+
type: "problem",
|
|
289
|
+
docs: { description: "Report every use of a value whose type was declared by an origin that is not type-trusted." },
|
|
290
|
+
schema: OPTIONS_SCHEMA,
|
|
291
|
+
messages: UNTRUSTED_VALUE_MESSAGES
|
|
292
|
+
},
|
|
293
|
+
create(context) {
|
|
294
|
+
const setup = setupRule(context);
|
|
295
|
+
if (!isRuleEnabled(setup, UNTRUSTED_VALUE_RULE)) return {};
|
|
296
|
+
if (!setup.policy || !setup.checker) {
|
|
297
|
+
throw new Error("untrusted-value requires typed linting (parserOptions.projectService or project).");
|
|
298
|
+
}
|
|
299
|
+
if (setup.zone !== "checked") return {};
|
|
300
|
+
const { ts, tsNode, checker, policy } = setup;
|
|
301
|
+
const { sourceCode } = context;
|
|
302
|
+
return {
|
|
303
|
+
Program(node) {
|
|
304
|
+
const sourceFile = tsNode(node, ts.isSourceFile);
|
|
305
|
+
const valueContext = untrustedValueContext(ts, checker, policy);
|
|
306
|
+
const locOf = (at) => ({ start: sourceCode.getLocFromIndex(at.getStart(sourceFile)), end: sourceCode.getLocFromIndex(at.getEnd()) });
|
|
307
|
+
for (const value of untrustedValuesIn(sourceFile, valueContext)) {
|
|
308
|
+
if (value.outcome !== "finding") continue;
|
|
309
|
+
context.report({ loc: locOf(value.node), messageId: untrustedValueMessageId(value), data: untrustedValueData(value) });
|
|
310
|
+
}
|
|
311
|
+
for (const handoff of untrustedHandoffsIn(sourceFile, valueContext)) {
|
|
312
|
+
context.report({ loc: locOf(handoff.node), messageId: "handoff", data: untrustedHandoffData(handoff) });
|
|
313
|
+
}
|
|
55
314
|
}
|
|
56
315
|
};
|
|
57
316
|
}
|
|
58
317
|
};
|
|
59
|
-
var
|
|
318
|
+
var untrusted_value_default = rule6;
|
|
60
319
|
|
|
61
320
|
// src/eslint/index.ts
|
|
62
321
|
var rules = {
|
|
63
322
|
"untrusted-call-must-return-result": untrusted_call_must_return_result_default,
|
|
64
|
-
"throw-must-return-result": throw_must_return_result_default
|
|
323
|
+
"throw-must-return-result": throw_must_return_result_default,
|
|
324
|
+
"type-claim": type_claim_default,
|
|
325
|
+
"untrusted-value": untrusted_value_default,
|
|
326
|
+
"dropped-result": dropped_result_default,
|
|
327
|
+
"redundant-guard": redundant_guard_default
|
|
65
328
|
};
|
|
66
329
|
var plugin = {
|
|
67
330
|
meta: { name: "@noego/trust" },
|
|
@@ -79,20 +342,42 @@ function typedConfig(options) {
|
|
|
79
342
|
plugins: { trust: plugin },
|
|
80
343
|
rules: {
|
|
81
344
|
"trust/untrusted-call-must-return-result": [severity, ruleOptions],
|
|
82
|
-
"trust/throw-must-return-result": [severity, ruleOptions]
|
|
345
|
+
"trust/throw-must-return-result": [severity, ruleOptions],
|
|
346
|
+
"trust/type-claim": [severity, ruleOptions],
|
|
347
|
+
"trust/untrusted-value": [severity, ruleOptions],
|
|
348
|
+
"trust/dropped-result": [severity, ruleOptions],
|
|
349
|
+
"trust/redundant-guard": [severity, ruleOptions]
|
|
83
350
|
}
|
|
84
351
|
}
|
|
85
352
|
];
|
|
86
353
|
}
|
|
87
354
|
export {
|
|
355
|
+
ACCEPT_DIRECTIVE,
|
|
356
|
+
ACCEPT_DIRECTIVE_MESSAGES,
|
|
357
|
+
CATCH_ORIGIN,
|
|
358
|
+
DEFAULT_RULE_SETTINGS,
|
|
359
|
+
DIRECTIVE_ORIGIN,
|
|
360
|
+
DROPPED_RESULT_MESSAGES,
|
|
361
|
+
DROPPED_RESULT_RULE,
|
|
88
362
|
OriginResolver,
|
|
89
363
|
PRESETS,
|
|
364
|
+
REDUNDANT_GUARD_MESSAGES,
|
|
365
|
+
REDUNDANT_GUARD_ORIGIN,
|
|
366
|
+
REDUNDANT_GUARD_RULE,
|
|
90
367
|
THROW_MESSAGES,
|
|
91
368
|
THROW_RULE,
|
|
369
|
+
TYPE_CLAIM_KINDS,
|
|
370
|
+
TYPE_CLAIM_MESSAGES,
|
|
371
|
+
TYPE_CLAIM_RULE,
|
|
92
372
|
TrustConfigError,
|
|
93
373
|
TrustPolicy,
|
|
374
|
+
UNANALYZABLE_ORIGIN,
|
|
94
375
|
UNTRUSTED_CALL_MESSAGES,
|
|
95
376
|
UNTRUSTED_CALL_RULE,
|
|
377
|
+
UNTRUSTED_VALUE_MESSAGES,
|
|
378
|
+
UNTRUSTED_VALUE_RULE,
|
|
379
|
+
VALIDATOR_DIRECTIVE,
|
|
380
|
+
WHOLE_BASELINE,
|
|
96
381
|
Zones,
|
|
97
382
|
alwaysExits,
|
|
98
383
|
catchProblem,
|
|
@@ -100,15 +385,18 @@ export {
|
|
|
100
385
|
countFindings,
|
|
101
386
|
eslint_default as default,
|
|
102
387
|
effectiveTrustList,
|
|
388
|
+
effectiveTypeTrustList,
|
|
103
389
|
entryMatches,
|
|
104
|
-
findingsFromResults,
|
|
105
390
|
guardOf,
|
|
391
|
+
isInsideValidator,
|
|
392
|
+
isMarkedValidator,
|
|
393
|
+
isRuleEnabled,
|
|
106
394
|
loadTrustConfig,
|
|
107
395
|
normalizeOrigin,
|
|
108
|
-
originFromMessage,
|
|
109
396
|
parseBaseline,
|
|
110
397
|
rules,
|
|
111
398
|
serializeBaseline,
|
|
112
|
-
typedConfig
|
|
399
|
+
typedConfig,
|
|
400
|
+
updateBaseline
|
|
113
401
|
};
|
|
114
402
|
//# sourceMappingURL=index.js.map
|
package/dist/eslint/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/eslint/rules/throw-must-return-result.ts","../../src/eslint/index.ts"],"sourcesContent":["// Every `throw` in checked code must be guarded: inside a `try` (same function) whose `catch`\n// returns Result.err(...) on every path, or inside a Trust.try / Trust.tryAsync callback.\n// Works with or without type information; with it, Result.err is recognised by declaration.\nimport type { Rule } from 'eslint';\nimport { CATCH_MESSAGES, guardOf, type AstNode, type CatchProblem } from '../guard.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nfunction forThrow(template: string): string {\n return template.replace('{{target}}', 'this `throw`');\n}\n\nexport const THROW_MESSAGES = {\n escapes: '`throw` must be inside a `try` (same function) whose `catch` returns Result.err(...), or inside Trust.try/tryAsync.',\n rethrow: forThrow(CATCH_MESSAGES.rethrow),\n notResultErr: forThrow(CATCH_MESSAGES.notResultErr),\n rawCatchValue: forThrow(CATCH_MESSAGES.rawCatchValue),\n notAllPaths: forThrow(CATCH_MESSAGES.notAllPaths),\n} as const satisfies Record<string, string> & Record<CatchProblem, string>;\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Require every throw to be caught locally and returned as Result.err.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: THROW_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (setup.zone !== 'checked') return {};\n return {\n ThrowStatement(node) {\n const guard = guardOf(node as unknown as AstNode, setup.guardContext);\n if (guard.status === 'unguarded') context.report({ node, messageId: 'escapes' });\n else if (guard.status === 'badCatch') context.report({ node, messageId: guard.problem });\n },\n };\n },\n};\n\nexport default rule;\n","// @noego/trust/eslint — ESLint plugin, trust config loader, and policy.\n//\n// import { typedConfig } from '@noego/trust/eslint';\n// export default [\n// ...typedConfig({ files: ['server/**/*.ts'], configFile: 'trust.config.json' }),\n// ];\nimport type { ESLint, Linter } from 'eslint';\nimport throwMustReturnResult from './rules/throw-must-return-result.js';\nimport untrustedCallMustReturnResult from './rules/untrusted-call-must-return-result.js';\n\nexport const rules = {\n 'untrusted-call-must-return-result': untrustedCallMustReturnResult,\n 'throw-must-return-result': throwMustReturnResult,\n};\n\nexport interface TypedConfigOptions {\n /** Files to check (flat-config globs). They must be in a tsconfig the project service can find. */\n readonly files: readonly string[];\n readonly ignores?: readonly string[];\n /** trust.config.json path relative to the ESLint cwd (default \"trust.config.json\"). */\n readonly configFile?: string;\n readonly severity?: Linter.RuleSeverity;\n}\n\nconst plugin: ESLint.Plugin = {\n meta: { name: '@noego/trust' },\n rules,\n};\n\nexport default plugin;\n\n/** Flat config that registers the plugin as `trust` and enables both rules for `files`. Needs typed linting. */\nexport function typedConfig(options: TypedConfigOptions): Linter.Config[] {\n const severity = options.severity ?? 'warn';\n const ruleOptions = { configFile: options.configFile ?? 'trust.config.json' };\n return [\n {\n name: '@noego/trust/typed',\n files: [...options.files],\n ignores: [...(options.ignores ?? [])],\n plugins: { trust: plugin },\n rules: {\n 'trust/untrusted-call-must-return-result': [severity, ruleOptions],\n 'trust/throw-must-return-result': [severity, ruleOptions],\n },\n },\n ];\n}\n\nexport {\n effectiveTrustList,\n loadTrustConfig,\n normalizeOrigin,\n TrustConfigError,\n type LoadTrustConfigOptions,\n type TrustConfig,\n type TrustEntry,\n type TrustLevel,\n} from './config.js';\nexport { PRESETS, type PresetDefinition } from './presets.js';\nexport { entryMatches, TrustPolicy, type MatchedEntry, type Verdict } from './policy.js';\nexport { OriginResolver, type OriginInfo } from './origin.js';\nexport { Zones, type Zone, type ZoneGroup } from './zones.js';\nexport { alwaysExits, catchProblem, guardOf, type CatchProblem, type Guard, type GuardContext } from './guard.js';\nexport {\n compareToBaseline,\n countFindings,\n findingsFromResults,\n originFromMessage,\n parseBaseline,\n serializeBaseline,\n THROW_RULE,\n UNTRUSTED_CALL_RULE,\n type BaselineCounts,\n type BaselineDelta,\n type Finding,\n} from './baseline.js';\nexport { THROW_MESSAGES } from './rules/throw-must-return-result.js';\nexport { UNTRUSTED_CALL_MESSAGES } from './rules/untrusted-call-must-return-result.js';\nexport type { TrustRuleOptions } from './rule-setup.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,SAAS,SAAS,UAA0B;AAC1C,SAAO,SAAS,QAAQ,cAAc,cAAc;AACtD;AAEO,IAAM,iBAAiB;AAAA,EAC5B,SAAS;AAAA,EACT,SAAS,SAAS,eAAe,OAAO;AAAA,EACxC,cAAc,SAAS,eAAe,YAAY;AAAA,EAClD,eAAe,SAAS,eAAe,aAAa;AAAA,EACpD,aAAa,SAAS,eAAe,WAAW;AAClD;AAEA,IAAM,OAAwB;AAAA,EAC5B,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,MAAM,EAAE,aAAa,uEAAuE;AAAA,IAC5F,QAAQ;AAAA,IACR,UAAU;AAAA,EACZ;AAAA,EACA,OAAO,SAAS;AACd,UAAM,QAAQ,UAAU,OAAO;AAC/B,QAAI,MAAM,SAAS,UAAW,QAAO,CAAC;AACtC,WAAO;AAAA,MACL,eAAe,MAAM;AACnB,cAAM,QAAQ,QAAQ,MAA4B,MAAM,YAAY;AACpE,YAAI,MAAM,WAAW,YAAa,SAAQ,OAAO,EAAE,MAAM,WAAW,UAAU,CAAC;AAAA,iBACtE,MAAM,WAAW,WAAY,SAAQ,OAAO,EAAE,MAAM,WAAW,MAAM,QAAQ,CAAC;AAAA,MACzF;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,mCAAQ;;;AC7BR,IAAM,QAAQ;AAAA,EACnB,qCAAqC;AAAA,EACrC,4BAA4B;AAC9B;AAWA,IAAM,SAAwB;AAAA,EAC5B,MAAM,EAAE,MAAM,eAAe;AAAA,EAC7B;AACF;AAEA,IAAO,iBAAQ;AAGR,SAAS,YAAY,SAA8C;AACxE,QAAM,WAAW,QAAQ,YAAY;AACrC,QAAM,cAAc,EAAE,YAAY,QAAQ,cAAc,oBAAoB;AAC5E,SAAO;AAAA,IACL;AAAA,MACE,MAAM;AAAA,MACN,OAAO,CAAC,GAAG,QAAQ,KAAK;AAAA,MACxB,SAAS,CAAC,GAAI,QAAQ,WAAW,CAAC,CAAE;AAAA,MACpC,SAAS,EAAE,OAAO,OAAO;AAAA,MACzB,OAAO;AAAA,QACL,2CAA2C,CAAC,UAAU,WAAW;AAAA,QACjE,kCAAkC,CAAC,UAAU,WAAW;AAAA,MAC1D;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/eslint/rule-setup.ts","../../src/eslint/rules/dropped-result.ts","../../src/eslint/rules/redundant-guard.ts","../../src/eslint/rules/throw-must-return-result.ts","../../src/eslint/rules/type-claim.ts","../../src/eslint/rules/untrusted-call-must-return-result.ts","../../src/eslint/rules/untrusted-value.ts","../../src/eslint/index.ts"],"sourcesContent":["// Shared per-file setup for both rules: trust config, file zone, guard context, and the mapping from\n// ESLint's ESTree nodes to the TypeScript nodes the shared rule logic (../core/rules.ts) works on.\nimport { resolve } from 'node:path';\nimport type { Rule } from 'eslint';\nimport type * as TS from 'typescript';\nimport { emptyTrustConfig, policyFor } from '../core/check-file.js';\nimport type { GuardContext } from '../core/guard.js';\nimport { nameBasedGuardContext, typedGuardContext } from '../core/rules.js';\nimport { loadTrustConfigCached, normalizeOrigin, type TrustRuleSettings } from './config.js';\nimport type { TrustPolicy } from './policy.js';\nimport { loadTypeScript, type TypeScript } from './typescript.js';\nimport { Zones, type Zone } from './zones.js';\n\nexport interface TrustRuleOptions {\n /** trust.config.json path, relative to the ESLint cwd. */\n readonly configFile?: string;\n /** Extra trusted origins (applied before the config chain). */\n readonly trust?: readonly string[];\n}\n\nexport const OPTIONS_SCHEMA = [\n {\n type: 'object',\n properties: {\n configFile: { type: 'string' },\n trust: { type: 'array', items: { type: 'string' } },\n },\n additionalProperties: false,\n },\n] as const;\n\ninterface ParserServices {\n readonly program?: TS.Program | null;\n readonly esTreeNodeToTSNodeMap?: { get(node: unknown): TS.Node };\n}\n\n/** ESTree node as ESLint hands it to a rule (ranges are always present). */\ntype EsNode = Rule.Node | { readonly range?: [number, number] };\n\nexport interface RuleSetup {\n readonly ts: TypeScript;\n readonly zone: Zone;\n readonly policy: TrustPolicy | null;\n readonly guardContext: GuardContext;\n /** Maps an ESTree node to its TypeScript node of the given kind. */\n readonly tsNode: <T extends TS.Node>(node: EsNode, is: (node: TS.Node) => node is T) => T;\n readonly checker: TS.TypeChecker | null;\n /** The trust config's per-rule settings: an opt-in rule that is not on reports nothing. */\n readonly rules: TrustRuleSettings;\n /** The TypeScript source file of the linted file (its comments are read from it). */\n readonly sourceFile: () => TS.SourceFile;\n}\n\n/**\n * Without parser services (e.g. ESLint's default parser) the file is parsed once with TypeScript and\n * nodes are found by their source range, which ESTree and TypeScript agree on.\n */\nfunction rangeLocator(ts: TypeScript, context: Rule.RuleContext): Pick<RuleSetup, 'tsNode' | 'sourceFile'> {\n let parsed: TS.SourceFile | undefined;\n const sourceFile = (): TS.SourceFile => (parsed ??= ts.createSourceFile(context.filename, context.sourceCode.text, ts.ScriptTarget.Latest, true));\n return { tsNode: locate, sourceFile };\n function locate<T extends TS.Node>(node: EsNode, is: (node: TS.Node) => node is T): T {\n const file = sourceFile();\n const [start, end] = (node as { range: [number, number] }).range;\n let found: T | undefined;\n const visit = (candidate: TS.Node): void => {\n if (found || candidate.pos > start || candidate.end < end) return;\n if (candidate.end === end && candidate.getStart(file) === start && is(candidate)) found = candidate;\n else ts.forEachChild(candidate, visit);\n };\n visit(file);\n if (!found) throw new Error(`@noego/trust: no TypeScript node at ${context.filename}:${start}-${end}`);\n return found;\n }\n}\n\nfunction mapLocator(ts: TypeScript, context: Rule.RuleContext, map: NonNullable<ParserServices['esTreeNodeToTSNodeMap']>): Pick<RuleSetup, 'tsNode' | 'sourceFile'> {\n const tsNode = function mapped<T extends TS.Node>(node: EsNode, is: (node: TS.Node) => node is T): T {\n const target = map.get(node);\n if (!target || !is(target)) throw new Error(`@noego/trust: unexpected TypeScript node in ${context.filename}`);\n return target;\n };\n return { tsNode, sourceFile: () => tsNode(context.sourceCode.ast, ts.isSourceFile) };\n}\n\nexport function setupRule(context: Rule.RuleContext): RuleSetup {\n const options = (context.options[0] ?? {}) as TrustRuleOptions;\n const ts = loadTypeScript(context.cwd);\n const config = options.configFile ? loadTrustConfigCached(resolve(context.cwd, options.configFile)) : emptyTrustConfig(context.cwd);\n const services = context.sourceCode.parserServices as ParserServices | undefined;\n const program = services?.program ?? null;\n const map = services?.esTreeNodeToTSNodeMap;\n const { tsNode, sourceFile } = map ? mapLocator(ts, context, map) : rangeLocator(ts, context);\n if (!program || !map) {\n const zones = new Zones(config.rootDir, config.passthrough, config.ignore);\n return { ts, zone: zones.zoneOf(context.filename), policy: null, guardContext: nameBasedGuardContext(ts), tsNode, checker: null, rules: config.rules, sourceFile };\n }\n const checker = program.getTypeChecker();\n const policy = policyFor(ts, checker, config, (options.trust ?? []).map(normalizeOrigin));\n return {\n ts,\n zone: policy.zones.zoneOf(context.filename),\n policy,\n guardContext: typedGuardContext(ts, checker, policy),\n tsNode,\n checker,\n rules: config.rules,\n sourceFile,\n };\n}\n","// ESLint adapter for dropped-result: a Result that can still fail must be passed up (returned) or handled\n// (Trust.decide / Trust.translate, a branch naming its kind); every place a failure is dropped instead is\n// reported, with the origin as messageId (`discarded`, `argument`, `stored`, `callback`, `return`, `end`,\n// `overwritten`).\n// The decisions are the shared core rule (../../core/dropped-results.ts), run once over the file's\n// TypeScript source; this file only reports them at their source positions.\n// Opt-in: it reports nothing unless the trust config turns it on (`\"rules\": { \"dropped-result\": \"on\" }`), the\n// same setting `trust check` honours. When on, it requires typed linting (parserOptions.projectService or project).\nimport type { Rule } from 'eslint';\nimport { droppedResultContext, droppedResultData, droppedResultsIn } from '../../core/dropped-results.js';\nimport { DROPPED_RESULT_MESSAGES, DROPPED_RESULT_RULE } from '../../core/messages.js';\nimport { isRuleEnabled } from '../config.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { DROPPED_RESULT_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Report every place a Result that can still fail is dropped instead of returned or handled.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: DROPPED_RESULT_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (!isRuleEnabled(setup, DROPPED_RESULT_RULE)) return {};\n if (!setup.policy || !setup.checker) {\n throw new Error('dropped-result requires typed linting (parserOptions.projectService or project).');\n }\n if (setup.zone !== 'checked') return {};\n const { ts, tsNode, checker, policy } = setup;\n const { sourceCode } = context;\n\n return {\n Program(node) {\n const sourceFile = tsNode(node, ts.isSourceFile);\n for (const dropped of droppedResultsIn(sourceFile, droppedResultContext(ts, checker, policy))) {\n context.report({ loc: sourceCode.getLocFromIndex(dropped.start), messageId: dropped.origin, data: droppedResultData(dropped) });\n }\n },\n };\n },\n};\n\nexport default rule;\n","// ESLint adapter for redundant-guard: a Trust.try / Trust.tryAsync (or a `try` whose `catch` returns\n// Result.err) around code that cannot fail — every call inside is trusted, first-party, or declared to return\n// a Result — invents a failure path; it is reported at the guard (messageId `redundant`).\n// The decisions are the shared core rule (../../core/redundant-guards.ts), run once over the file's TypeScript\n// source; this file only reports them at their source positions.\n// Opt-in: it reports nothing unless the trust config turns it on (`\"rules\": { \"redundant-guard\": \"on\" }`), the\n// same setting `trust check` honours. When on, it requires typed linting (parserOptions.projectService or project).\nimport type { Rule } from 'eslint';\nimport { REDUNDANT_GUARD_MESSAGES, REDUNDANT_GUARD_RULE } from '../../core/messages.js';\nimport { redundantGuardData, redundantGuardsIn } from '../../core/redundant-guards.js';\nimport { typedGuardContext } from '../../core/rules.js';\nimport { isRuleEnabled } from '../config.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { REDUNDANT_GUARD_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Report every guard (Trust.try / Trust.tryAsync / try-catch) around code that cannot fail.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: REDUNDANT_GUARD_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (!isRuleEnabled(setup, REDUNDANT_GUARD_RULE)) return {};\n if (!setup.policy || !setup.checker) {\n throw new Error('redundant-guard requires typed linting (parserOptions.projectService or project).');\n }\n if (setup.zone !== 'checked') return {};\n const { ts, tsNode, checker, policy } = setup;\n const { sourceCode } = context;\n\n return {\n Program(node) {\n const sourceFile = tsNode(node, ts.isSourceFile);\n const guardContext = typedGuardContext(ts, checker, policy);\n for (const guard of redundantGuardsIn(sourceFile, { ts, checker, policy, guardContext })) {\n context.report({ loc: sourceCode.getLocFromIndex(guard.start), messageId: 'redundant', data: redundantGuardData(guard) });\n }\n },\n };\n },\n};\n\nexport default rule;\n","// ESLint adapter for throw-must-return-result: every `throw` in checked code must be guarded —\n// inside a `try` (same function) whose `catch` returns Result.err(...) on every path, or inside a\n// Trust.try / Trust.tryAsync callback. The decision is the shared core rule (../../core/rules.ts);\n// this file only maps ESTree nodes to TypeScript nodes and reports.\n// Works with or without type information; with it, Result.err is recognised by declaration.\n// A `throw` in a statement marked `//trust:accept <reason>` is accepted, and every `//trust:accept` that\n// accepts nothing is reported here, at the comment (`directive`, ../../core/accept.ts). Without type\n// information an accept above a statement with nothing to accept (stale) cannot be told, so it is not reported.\nimport type { Rule } from 'eslint';\nimport { acceptanceOf, acceptDirectiveFindings } from '../../core/accept.js';\nimport { ACCEPT_DIRECTIVE_MESSAGES, THROW_MESSAGES } from '../../core/messages.js';\nimport { throwProblem } from '../../core/rules.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { THROW_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Require every throw to be caught locally and returned as Result.err.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: { ...THROW_MESSAGES, ...ACCEPT_DIRECTIVE_MESSAGES },\n },\n create(context) {\n const setup = setupRule(context);\n if (setup.zone !== 'checked') return {};\n const { ts, tsNode, guardContext, policy, checker } = setup;\n const { sourceCode } = context;\n return {\n Program() {\n const failureContext = policy && checker ? { ts, checker, policy, guardContext } : null;\n const sourceFile = setup.sourceFile();\n for (const found of acceptDirectiveFindings(ts, sourceFile, failureContext)) {\n const loc = { start: sourceCode.getLocFromIndex(found.directive.pos), end: sourceCode.getLocFromIndex(found.directive.end) };\n context.report({ loc, messageId: found.messageId, data: found.data });\n }\n },\n ThrowStatement(node) {\n const statement = tsNode(node, ts.isThrowStatement);\n const messageId = throwProblem(statement, guardContext);\n if (messageId && !acceptanceOf(ts, statement)) context.report({ node, messageId });\n },\n };\n },\n};\n\nexport default rule;\n","// ESLint adapter for type-claim: every place a type is claimed instead of proven — a narrowing\n// `as`, `x!`, `any` in a typed position, a written type predicate, a caller-chosen generic return —\n// is reported, with the claim kind as messageId (`claim:as`, `claim:non-null`, `claim:any`,\n// `claim:predicate`, `claim:generic-return`; `unanalyzable` for a node whose type does not resolve;\n// `directive` for a `//trust:` comment that marks nothing). Claims inside a validator (a function marked\n// `//trust:validator_function`) are not reported.\n// The decisions are the shared core rule (../../core/type-claims.ts), run once over the file's\n// TypeScript source; this file only reports them at their source positions.\n// Opt-in: it reports nothing unless the trust config turns it on (`\"rules\": { \"type-claim\": \"on\" }`), the\n// same setting `trust check` honours. When on, it requires typed linting (parserOptions.projectService or project).\nimport type { Rule } from 'eslint';\nimport { TYPE_CLAIM_MESSAGES, TYPE_CLAIM_RULE } from '../../core/messages.js';\nimport { claimSpan, typeClaimContext, typeClaimsIn } from '../../core/type-claims.js';\nimport { isRuleEnabled } from '../config.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { TYPE_CLAIM_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Report every place a type is claimed instead of proven.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: TYPE_CLAIM_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (!isRuleEnabled(setup, TYPE_CLAIM_RULE)) return {};\n if (!setup.policy || !setup.checker) {\n throw new Error('type-claim requires typed linting (parserOptions.projectService or project).');\n }\n if (setup.zone !== 'checked') return {};\n const { ts, tsNode, checker, policy } = setup;\n const { sourceCode } = context;\n\n return {\n Program(node) {\n const sourceFile = tsNode(node, ts.isSourceFile);\n for (const claim of typeClaimsIn(sourceFile, typeClaimContext(ts, checker, undefined, policy))) {\n const span = claimSpan(claim, sourceFile);\n const loc = { start: sourceCode.getLocFromIndex(span.start), end: sourceCode.getLocFromIndex(span.end) };\n context.report({ loc, messageId: claim.origin, data: claim.data });\n }\n },\n };\n },\n};\n\nexport default rule;\n","// ESLint adapter for untrusted-call-must-return-result: every call or `new` whose callee is\n// untrusted must be guarded — inside a `try` (same function) whose `catch` returns Result.err(...)\n// on every path, or inside a Trust.try / Trust.tryAsync callback. Trust comes from\n// trust.config.json (see ../config.ts), from first-party checked code, or from a declared return\n// type of Result / Promise<Result> from @noego/trust. The decision is the shared core rule\n// (../../core/rules.ts); this file only maps ESTree nodes to TypeScript nodes and reports.\n// Requires typed linting (parserOptions.projectService or project). A call in a statement marked\n// `//trust:accept <reason>` is accepted (../../core/accept.ts).\nimport type { Rule } from 'eslint';\nimport type * as TS from 'typescript';\nimport { acceptanceOf } from '../../core/accept.js';\nimport { UNTRUSTED_CALL_MESSAGES } from '../../core/messages.js';\nimport { untrustedCallProblem } from '../../core/rules.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { UNTRUSTED_CALL_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Require calls into untrusted code to be handled locally and returned as Result.err.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: UNTRUSTED_CALL_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (!setup.policy || !setup.checker) {\n throw new Error('untrusted-call-must-return-result requires typed linting (parserOptions.projectService or project).');\n }\n if (setup.zone !== 'checked') return {};\n const { ts, policy, tsNode, checker, guardContext } = setup;\n const isCallOrNew = (node: TS.Node): node is TS.CallExpression | TS.NewExpression => ts.isCallExpression(node) || ts.isNewExpression(node);\n\n function check(node: Rule.Node): void {\n const call = tsNode(node, isCallOrNew);\n const problem = untrustedCallProblem(call, policy, checker, guardContext);\n if (problem && !acceptanceOf(ts, call)) context.report({ node, messageId: problem.messageId, data: { origin: problem.origin } });\n }\n\n return { CallExpression: check, NewExpression: check };\n },\n};\n\nexport default rule;\n","// ESLint adapter for untrusted-value: type trust is opt-in. A value whose type was declared by an origin\n// that is not on the type-trust list (`trust_type` in trust.config.json) — a call's return, a parameter of\n// a callback the outside calls, a property or global it declares — may only be passed to a validator, kept\n// as `unknown`, or tested by a built-in check; any other use is reported with the origin named.\n// The decisions are the shared core rule (../../core/untrusted-values.ts), run once over the file's\n// TypeScript source; this file only reports them at their source positions.\n// Opt-in: it reports nothing unless the trust config turns it on (`\"rules\": { \"untrusted-value\": \"on\" }`), the\n// same setting `trust check` honours. When on, it requires typed linting (parserOptions.projectService or project).\nimport type { Rule } from 'eslint';\nimport type * as TS from 'typescript';\nimport { UNTRUSTED_VALUE_MESSAGES, UNTRUSTED_VALUE_RULE } from '../../core/messages.js';\nimport {\n untrustedHandoffData,\n untrustedHandoffsIn,\n untrustedValueContext,\n untrustedValueData,\n untrustedValueMessageId,\n untrustedValuesIn,\n} from '../../core/untrusted-values.js';\nimport { isRuleEnabled } from '../config.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { UNTRUSTED_VALUE_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Report every use of a value whose type was declared by an origin that is not type-trusted.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: UNTRUSTED_VALUE_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (!isRuleEnabled(setup, UNTRUSTED_VALUE_RULE)) return {};\n if (!setup.policy || !setup.checker) {\n throw new Error('untrusted-value requires typed linting (parserOptions.projectService or project).');\n }\n if (setup.zone !== 'checked') return {};\n const { ts, tsNode, checker, policy } = setup;\n const { sourceCode } = context;\n\n return {\n Program(node) {\n const sourceFile = tsNode(node, ts.isSourceFile);\n const valueContext = untrustedValueContext(ts, checker, policy);\n const locOf = (at: TS.Node) => ({ start: sourceCode.getLocFromIndex(at.getStart(sourceFile)), end: sourceCode.getLocFromIndex(at.getEnd()) });\n for (const value of untrustedValuesIn(sourceFile, valueContext)) {\n if (value.outcome !== 'finding') continue;\n context.report({ loc: locOf(value.node), messageId: untrustedValueMessageId(value), data: untrustedValueData(value) });\n }\n // `untrustedCallbacks: \"all\"`: functions handed to an origin that is not type-trusted, at the hand-off.\n for (const handoff of untrustedHandoffsIn(sourceFile, valueContext)) {\n context.report({ loc: locOf(handoff.node), messageId: 'handoff', data: untrustedHandoffData(handoff) });\n }\n },\n };\n },\n};\n\nexport default rule;\n","// @noego/trust/eslint — ESLint plugin, trust config loader, and policy.\n//\n// import { typedConfig } from '@noego/trust/eslint';\n// export default [\n// ...typedConfig({ files: ['server/**/*.ts'], configFile: 'trust.config.json' }),\n// ];\nimport type { ESLint, Linter } from 'eslint';\nimport droppedResult from './rules/dropped-result.js';\nimport redundantGuard from './rules/redundant-guard.js';\nimport throwMustReturnResult from './rules/throw-must-return-result.js';\nimport typeClaim from './rules/type-claim.js';\nimport untrustedCallMustReturnResult from './rules/untrusted-call-must-return-result.js';\nimport untrustedValue from './rules/untrusted-value.js';\n\nexport const rules = {\n 'untrusted-call-must-return-result': untrustedCallMustReturnResult,\n 'throw-must-return-result': throwMustReturnResult,\n 'type-claim': typeClaim,\n 'untrusted-value': untrustedValue,\n 'dropped-result': droppedResult,\n 'redundant-guard': redundantGuard,\n};\n\nexport interface TypedConfigOptions {\n /** Files to check (flat-config globs). They must be in a tsconfig the project service can find. */\n readonly files: readonly string[];\n readonly ignores?: readonly string[];\n /** trust.config.json path relative to the ESLint cwd (default \"trust.config.json\"). */\n readonly configFile?: string;\n readonly severity?: Linter.RuleSeverity;\n}\n\nconst plugin: ESLint.Plugin = {\n meta: { name: '@noego/trust' },\n rules,\n};\n\nexport default plugin;\n\n/**\n * Flat config that registers the plugin as `trust` and enables its rules (the two trust rules, `type-claim`,\n * `untrusted-value` and `dropped-result`) for `files`. Needs typed linting. `type-claim`, `untrusted-value` and\n * `dropped-result` are opt-in: they report only when the trust config turns them on\n * (`\"rules\": { \"type-claim\": \"on\", \"untrusted-value\": \"on\", \"dropped-result\": \"on\" }`), the same settings\n * `trust check` / `trust baseline` honour, so ESLint and the CLI always agree.\n */\nexport function typedConfig(options: TypedConfigOptions): Linter.Config[] {\n const severity = options.severity ?? 'warn';\n const ruleOptions = { configFile: options.configFile ?? 'trust.config.json' };\n return [\n {\n name: '@noego/trust/typed',\n files: [...options.files],\n ignores: [...(options.ignores ?? [])],\n plugins: { trust: plugin },\n rules: {\n 'trust/untrusted-call-must-return-result': [severity, ruleOptions],\n 'trust/throw-must-return-result': [severity, ruleOptions],\n 'trust/type-claim': [severity, ruleOptions],\n 'trust/untrusted-value': [severity, ruleOptions],\n 'trust/dropped-result': [severity, ruleOptions],\n 'trust/redundant-guard': [severity, ruleOptions],\n },\n },\n ];\n}\n\nexport {\n DEFAULT_RULE_SETTINGS,\n effectiveTrustList,\n effectiveTypeTrustList,\n isRuleEnabled,\n loadTrustConfig,\n normalizeOrigin,\n TrustConfigError,\n type LoadTrustConfigOptions,\n type OptInRule,\n type RuleSwitch,\n type TrustConfig,\n type TrustEntry,\n type TrustLevel,\n type TrustRuleSettings,\n type TsconfigMapping,\n type UntrustedCallbacks,\n} from './config.js';\nexport { PRESETS, type PresetDefinition } from './presets.js';\nexport { entryMatches, TrustPolicy, type MatchedEntry, type TypeVerdict, type Verdict } from './policy.js';\nexport { OriginResolver, type OriginInfo } from './origin.js';\nexport { Zones, type Zone, type ZoneGroup } from './zones.js';\nexport { alwaysExits, catchProblem, guardOf, type Guard, type GuardContext } from '../core/guard.js';\nexport type { CatchProblem } from '../core/messages.js';\nexport {\n compareToBaseline,\n countFindings,\n parseBaseline,\n serializeBaseline,\n THROW_RULE,\n UNTRUSTED_CALL_RULE,\n updateBaseline,\n WHOLE_BASELINE,\n type BaselineCounts,\n type BaselineDelta,\n type BaselineScope,\n type Finding,\n} from '../core/baseline.js';\nexport { DIRECTIVE_ORIGIN, TYPE_CLAIM_KINDS, TYPE_CLAIM_RULE, UNANALYZABLE_ORIGIN, type TypeClaimOrigin } from '../core/messages.js';\nexport { CATCH_ORIGIN, UNTRUSTED_VALUE_RULE, type UntrustedEntry } from '../core/messages.js';\nexport { DROPPED_RESULT_RULE, type DroppedResultOrigin } from '../core/messages.js';\nexport { DROPPED_RESULT_MESSAGES } from './rules/dropped-result.js';\nexport { REDUNDANT_GUARD_ORIGIN, REDUNDANT_GUARD_RULE } from '../core/messages.js';\nexport { REDUNDANT_GUARD_MESSAGES } from './rules/redundant-guard.js';\nexport { ACCEPT_DIRECTIVE, isInsideValidator, isMarkedValidator, VALIDATOR_DIRECTIVE } from '../core/validator.js';\nexport { ACCEPT_DIRECTIVE_MESSAGES } from '../core/messages.js';\nexport { THROW_MESSAGES } from './rules/throw-must-return-result.js';\nexport { TYPE_CLAIM_MESSAGES } from './rules/type-claim.js';\nexport { UNTRUSTED_CALL_MESSAGES } from './rules/untrusted-call-must-return-result.js';\nexport { UNTRUSTED_VALUE_MESSAGES } from './rules/untrusted-value.js';\nexport type { TrustRuleOptions } from './rule-setup.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,eAAe;AAkBjB,IAAM,iBAAiB;AAAA,EAC5B;AAAA,IACE,MAAM;AAAA,IACN,YAAY;AAAA,MACV,YAAY,EAAE,MAAM,SAAS;AAAA,MAC7B,OAAO,EAAE,MAAM,SAAS,OAAO,EAAE,MAAM,SAAS,EAAE;AAAA,IACpD;AAAA,IACA,sBAAsB;AAAA,EACxB;AACF;AA4BA,SAAS,aAAa,IAAgB,SAAqE;AACzG,MAAI;AACJ,QAAM,aAAa,MAAsB,WAAW,GAAG,iBAAiB,QAAQ,UAAU,QAAQ,WAAW,MAAM,GAAG,aAAa,QAAQ,IAAI;AAC/I,SAAO,EAAE,QAAQ,QAAQ,WAAW;AACpC,WAAS,OAA0B,MAAc,IAAqC;AACpF,UAAM,OAAO,WAAW;AACxB,UAAM,CAAC,OAAO,GAAG,IAAK,KAAqC;AAC3D,QAAI;AACJ,UAAM,QAAQ,CAAC,cAA6B;AAC1C,UAAI,SAAS,UAAU,MAAM,SAAS,UAAU,MAAM,IAAK;AAC3D,UAAI,UAAU,QAAQ,OAAO,UAAU,SAAS,IAAI,MAAM,SAAS,GAAG,SAAS,EAAG,SAAQ;AAAA,UACrF,IAAG,aAAa,WAAW,KAAK;AAAA,IACvC;AACA,UAAM,IAAI;AACV,QAAI,CAAC,MAAO,OAAM,IAAI,MAAM,uCAAuC,QAAQ,QAAQ,IAAI,KAAK,IAAI,GAAG,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A,MACpC,SAAS,EAAE,OAAO,OAAO;AAAA,MACzB,OAAO;AAAA,QACL,2CAA2C,CAAC,UAAU,WAAW;AAAA,QACjE,kCAAkC,CAAC,UAAU,WAAW;AAAA,QACxD,oBAAoB,CAAC,UAAU,WAAW;AAAA,QAC1C,yBAAyB,CAAC,UAAU,WAAW;AAAA,QAC/C,wBAAwB,CAAC,UAAU,WAAW;AAAA,QAC9C,yBAAyB,CAAC,UAAU,WAAW;AAAA,MACjD;AAAA,IACF;AAAA,EACF;AACF;","names":["rule","rule","rule","rule","rule"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noego/trust",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-dev.0",
|
|
4
4
|
"description": "Result type plus type-aware ESLint rules that make failure handling explicit: untrusted calls and throws must be caught locally and returned as Result.err.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -28,6 +28,11 @@
|
|
|
28
28
|
"import": "./dist/eslint/index.js",
|
|
29
29
|
"default": "./dist/eslint/index.js"
|
|
30
30
|
},
|
|
31
|
+
"./core": {
|
|
32
|
+
"types": "./dist/core/index.d.ts",
|
|
33
|
+
"import": "./dist/core/index.js",
|
|
34
|
+
"default": "./dist/core/index.js"
|
|
35
|
+
},
|
|
31
36
|
"./package.json": "./package.json"
|
|
32
37
|
},
|
|
33
38
|
"files": [
|
|
@@ -41,9 +46,6 @@
|
|
|
41
46
|
"engines": {
|
|
42
47
|
"node": ">=20"
|
|
43
48
|
},
|
|
44
|
-
"dependencies": {
|
|
45
|
-
"minimatch": "^10.0.3"
|
|
46
|
-
},
|
|
47
49
|
"peerDependencies": {
|
|
48
50
|
"eslint": ">=9",
|
|
49
51
|
"typescript": ">=5",
|
|
@@ -63,6 +65,7 @@
|
|
|
63
65
|
"devDependencies": {
|
|
64
66
|
"@types/node": "^22.10.0",
|
|
65
67
|
"eslint": "^10.1.0",
|
|
68
|
+
"minimatch": "^10.0.3",
|
|
66
69
|
"tsup": "^8.5.0",
|
|
67
70
|
"typescript": "~5.9.3",
|
|
68
71
|
"typescript-eslint": "^8.57.1",
|