@gate-forge/pack-auth 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/LICENSE +202 -0
- package/README.md +113 -0
- package/dist/adapter-schema.d.ts +82 -0
- package/dist/adapter-schema.d.ts.map +1 -0
- package/dist/adapter-schema.js +70 -0
- package/dist/adapter-schema.js.map +1 -0
- package/dist/detector.d.ts +26 -0
- package/dist/detector.d.ts.map +1 -0
- package/dist/detector.js +623 -0
- package/dist/detector.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/obligations.d.ts +61 -0
- package/dist/obligations.d.ts.map +1 -0
- package/dist/obligations.js +67 -0
- package/dist/obligations.js.map +1 -0
- package/dist/version.d.ts +9 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +9 -0
- package/dist/version.js.map +1 -0
- package/examples/example.billing.refund.adapter.d.mts +7 -0
- package/examples/example.billing.refund.adapter.mjs +104 -0
- package/package.json +43 -0
package/dist/detector.js
ADDED
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth pack detector — discovers role-guard + tenant-isolation patterns
|
|
3
|
+
* in TypeScript / JavaScript HTTP route definitions and emits one
|
|
4
|
+
* `auth.resource` per guarded endpoint.
|
|
5
|
+
*
|
|
6
|
+
* Recognised constructs (TS/JS only; FastAPI/Python deferred — see the
|
|
7
|
+
* pack README "Limitations"):
|
|
8
|
+
*
|
|
9
|
+
* - NestJS: `@UseGuards(RolesGuard)`, `@Roles('admin', 'manager')`,
|
|
10
|
+
* plus the controller / method declaration that hosts them
|
|
11
|
+
* (`@Controller('billing')`, `@Post('refund')`).
|
|
12
|
+
* - Express middleware chains: `app.post('/billing/refund',
|
|
13
|
+
* requireRole('admin'), requireTenant(), handler)`.
|
|
14
|
+
* - Fastify preHandler hooks: `fastify.post('/billing/refund',
|
|
15
|
+
* { preHandler: [requireRole('admin'), requireTenant()] }, handler)`.
|
|
16
|
+
* - Hono middleware: `app.post('/billing/refund',
|
|
17
|
+
* requireRole('admin'), requireTenant(), (c) => c.json(...))`.
|
|
18
|
+
*
|
|
19
|
+
* Discovery outcome:
|
|
20
|
+
*
|
|
21
|
+
* - One `auth.resource` per guarded endpoint, id = `auth.<METHOD>.<path>`
|
|
22
|
+
* (lower-cased, slashes -> dots, segments stripped). Deterministic.
|
|
23
|
+
* - `attributes.roleRequirement`: `string[]` of role names the guard
|
|
24
|
+
* accepts; `[]` when no role guard (tenancy may still be present).
|
|
25
|
+
* - `attributes.tenancy`: `'tenant-bound' | 'none'`. `'tenant-bound'`
|
|
26
|
+
* when a tenant check is detected (e.g. `requireTenant()` middleware,
|
|
27
|
+
* `req.user.tenantId === target.tenantId`, `tenantId` in route).
|
|
28
|
+
* - `attributes.framework`: `'nestjs' | 'express' | 'fastify' | 'hono'`.
|
|
29
|
+
* - `attributes.method`: HTTP method upper-cased.
|
|
30
|
+
* - `attributes.path`: Normalised route path.
|
|
31
|
+
* - `findings[]`: ALWAYS empty in this pack — the detector fails
|
|
32
|
+
* CLOSED by omitting findings for unparseable constructs; the
|
|
33
|
+
* graph emits the typed `unresolved` entry for partial patterns.
|
|
34
|
+
*
|
|
35
|
+
* Determinism: regex/parse-tree scan is pure over (paths, file bytes);
|
|
36
|
+
* no `Date.now()`, no `Math.random()`. Output is sorted by id.
|
|
37
|
+
*/
|
|
38
|
+
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
|
39
|
+
import { resolve, relative, sep } from 'node:path';
|
|
40
|
+
import { LocationSchema } from '@gate-forge/core';
|
|
41
|
+
import { PACK_PLUGIN_ID, PACK_VERSION } from './version.js';
|
|
42
|
+
/**
|
|
43
|
+
* Directories the detector skips by name (purely the noisy parts of any
|
|
44
|
+
* repo): never feed them to `readFileSync` even if the caller forgot to
|
|
45
|
+
* exclude them.
|
|
46
|
+
*/
|
|
47
|
+
const SKIP_DIR_NAMES = {
|
|
48
|
+
node_modules: true,
|
|
49
|
+
dist: true,
|
|
50
|
+
build: true,
|
|
51
|
+
coverage: true,
|
|
52
|
+
'.git': true,
|
|
53
|
+
'.next': true,
|
|
54
|
+
'.turbo': true,
|
|
55
|
+
'.cache': true,
|
|
56
|
+
out: true,
|
|
57
|
+
__pycache__: true,
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Looks for `requireRole('admin', 'manager')` / `requireRole(['admin'])`
|
|
61
|
+
* calls inside a middleware argument list. Returns `null` when no
|
|
62
|
+
* role middleware is detectable (caller treats as "no role requirement"
|
|
63
|
+
* unless tenancy is also present).
|
|
64
|
+
*/
|
|
65
|
+
function extractRolesFromMiddlewareArgs(args) {
|
|
66
|
+
const roles = new Set();
|
|
67
|
+
let sawAny = false;
|
|
68
|
+
const direct = /\brequire(?:Role|Roles)\(\s*(['"])([^'"]+)\1/g;
|
|
69
|
+
let match;
|
|
70
|
+
while ((match = direct.exec(args)) !== null) {
|
|
71
|
+
sawAny = true;
|
|
72
|
+
roles.add(match[2] ?? '');
|
|
73
|
+
}
|
|
74
|
+
const array = /\brequire(?:Role|Roles)\(\s*\[([^\]]+)\]/g;
|
|
75
|
+
while ((match = array.exec(args)) !== null) {
|
|
76
|
+
sawAny = true;
|
|
77
|
+
const inner = match[1] ?? '';
|
|
78
|
+
const literal = /(['"])([^'"]+)\1/g;
|
|
79
|
+
let m2;
|
|
80
|
+
while ((m2 = literal.exec(inner)) !== null) {
|
|
81
|
+
roles.add(m2[2] ?? '');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (!sawAny)
|
|
85
|
+
return null;
|
|
86
|
+
return [...roles].sort();
|
|
87
|
+
}
|
|
88
|
+
/** Tenant check by middleware name (Express/Fastify/Hono shared). */
|
|
89
|
+
const TENANT_MW = /\b(requireTenant|requireTenantScope|tenantGuard|ensureTenant|withTenant)\b/;
|
|
90
|
+
/** `req.user.tenantId` / `tenantId === ...` / `:tenantId` path param. */
|
|
91
|
+
const TENANT_LITERAL = /\btenantId\b/;
|
|
92
|
+
/**
|
|
93
|
+
* Reads the balanced argument list starting at `start`. Returns the
|
|
94
|
+
* text between `(` and its matching `)` at depth 0, or `null` if the
|
|
95
|
+
* parens are unbalanced (defensive: caller treats as "unscannable").
|
|
96
|
+
*/
|
|
97
|
+
function readBalancedArgs(text, start) {
|
|
98
|
+
let i = start;
|
|
99
|
+
while (i < text.length && /\s/.test(text[i] ?? ''))
|
|
100
|
+
i += 1;
|
|
101
|
+
if (text[i] !== '(')
|
|
102
|
+
return null;
|
|
103
|
+
i += 1;
|
|
104
|
+
let depth = 1;
|
|
105
|
+
let inStr = null;
|
|
106
|
+
const startIdx = i;
|
|
107
|
+
while (i < text.length && depth > 0) {
|
|
108
|
+
const ch = text[i] ?? '';
|
|
109
|
+
if (inStr !== null) {
|
|
110
|
+
if (ch === '\\') {
|
|
111
|
+
i += 2;
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (ch === inStr)
|
|
115
|
+
inStr = null;
|
|
116
|
+
i += 1;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (ch === '"' || ch === "'" || ch === '`') {
|
|
120
|
+
inStr = ch;
|
|
121
|
+
i += 1;
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (ch === '(')
|
|
125
|
+
depth += 1;
|
|
126
|
+
else if (ch === ')')
|
|
127
|
+
depth -= 1;
|
|
128
|
+
if (depth === 0) {
|
|
129
|
+
return text.slice(startIdx, i);
|
|
130
|
+
}
|
|
131
|
+
i += 1;
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
/** Joins controller prefix + method sub-path; strips trailing slash. */
|
|
136
|
+
function joinPath(prefix, suffix) {
|
|
137
|
+
if (prefix === '' && suffix === '')
|
|
138
|
+
return '/';
|
|
139
|
+
if (prefix === '')
|
|
140
|
+
return normalisePath(suffix);
|
|
141
|
+
if (suffix === '')
|
|
142
|
+
return normalisePath(prefix);
|
|
143
|
+
return normalisePath(`${prefix}/${suffix}`);
|
|
144
|
+
}
|
|
145
|
+
/** Normalises a route path: ensures leading '/', collapses '//'. */
|
|
146
|
+
function normalisePath(p) {
|
|
147
|
+
let s = p;
|
|
148
|
+
if (!s.startsWith('/'))
|
|
149
|
+
s = `/${s}`;
|
|
150
|
+
while (s.includes('//'))
|
|
151
|
+
s = s.replace(/\/\//g, '/');
|
|
152
|
+
return s;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Builds the stable resource id from a normalised path. Slashes become
|
|
156
|
+
* dots; `:` (path params) become the literal string `colon`; non-identifier
|
|
157
|
+
* characters are dropped. Example: `POST /billing/refund` -> `auth.post.billing.refund`.
|
|
158
|
+
*/
|
|
159
|
+
function buildResourceId(method, path) {
|
|
160
|
+
const normalised = path.replace(/^\//, '').replace(/\/$/, '');
|
|
161
|
+
if (normalised === '')
|
|
162
|
+
return `auth.${method.toLowerCase()}.root`;
|
|
163
|
+
const segments = normalised.split('/').map((s) => s.replace(/:/g, 'colon').replace(/[^A-Za-z0-9_.-]/g, ''));
|
|
164
|
+
return `auth.${method.toLowerCase()}.${segments.join('.')}`;
|
|
165
|
+
}
|
|
166
|
+
/** Returns the 1-based line number that contains `offset`. */
|
|
167
|
+
function lineNumberFor(text, offset) {
|
|
168
|
+
let line = 1;
|
|
169
|
+
for (let i = 0; i < offset && i < text.length; i += 1) {
|
|
170
|
+
if (text[i] === '\n')
|
|
171
|
+
line += 1;
|
|
172
|
+
}
|
|
173
|
+
return line;
|
|
174
|
+
}
|
|
175
|
+
/** Returns the 0-based column of `offset` (chars since the last '\n'). */
|
|
176
|
+
function columnFor(text, offset) {
|
|
177
|
+
let col = 0;
|
|
178
|
+
for (let i = offset - 1; i >= 0; i -= 1) {
|
|
179
|
+
if (text[i] === '\n')
|
|
180
|
+
break;
|
|
181
|
+
col += 1;
|
|
182
|
+
}
|
|
183
|
+
return col;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Walks a directory tree, returning all `.ts`/`.tsx`/`.js`/`.mjs` files
|
|
187
|
+
* (skipping excluded directories by name). Deterministic order (sorted).
|
|
188
|
+
*/
|
|
189
|
+
function walkFiles(dir) {
|
|
190
|
+
const out = [];
|
|
191
|
+
const stack = [dir];
|
|
192
|
+
while (stack.length > 0) {
|
|
193
|
+
const current = stack.pop();
|
|
194
|
+
if (current === undefined)
|
|
195
|
+
break;
|
|
196
|
+
let entries;
|
|
197
|
+
try {
|
|
198
|
+
entries = readdirSync(current, { withFileTypes: true }).map((d) => ({
|
|
199
|
+
name: d.name,
|
|
200
|
+
isFile: d.isFile(),
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
for (const entry of entries) {
|
|
207
|
+
const full = `${current}${sep}${entry.name}`;
|
|
208
|
+
if (!entry.isFile) {
|
|
209
|
+
if (SKIP_DIR_NAMES[entry.name] === true)
|
|
210
|
+
continue;
|
|
211
|
+
stack.push(full);
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if (/\.(ts|tsx|js|mjs)$/.test(entry.name))
|
|
215
|
+
out.push(full);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
out.sort();
|
|
219
|
+
return out;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Coerces a caller path into the absolute file the detector reads. If
|
|
223
|
+
* `path` is a directory, it is walked recursively. Otherwise the file is
|
|
224
|
+
* read directly (must end in a recognised extension).
|
|
225
|
+
*/
|
|
226
|
+
function resolveInputs(paths) {
|
|
227
|
+
const out = [];
|
|
228
|
+
for (const input of paths) {
|
|
229
|
+
const abs = resolve(input);
|
|
230
|
+
let stat;
|
|
231
|
+
try {
|
|
232
|
+
stat = statSync(abs);
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
if (stat.isDirectory()) {
|
|
238
|
+
for (const f of walkFiles(abs))
|
|
239
|
+
out.push(f);
|
|
240
|
+
}
|
|
241
|
+
else if (/\.(ts|tsx|js|mjs)$/.test(abs)) {
|
|
242
|
+
out.push(abs);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
out.sort();
|
|
246
|
+
return out;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Pulls a list of string literals out of an `@Roles(...)` argument list.
|
|
250
|
+
* Accepts `'admin', "manager"` (single + double). Returns null when the
|
|
251
|
+
* argument list cannot be parsed (caller treats as "no role
|
|
252
|
+
* requirement detected" rather than throwing).
|
|
253
|
+
*/
|
|
254
|
+
function extractRoleLiterals(args) {
|
|
255
|
+
const out = [];
|
|
256
|
+
const re = /(['"])([^'"]+)\1/g;
|
|
257
|
+
let match;
|
|
258
|
+
let sawAny = false;
|
|
259
|
+
while ((match = re.exec(args)) !== null) {
|
|
260
|
+
sawAny = true;
|
|
261
|
+
out.push(match[2] ?? '');
|
|
262
|
+
}
|
|
263
|
+
if (!sawAny)
|
|
264
|
+
return null;
|
|
265
|
+
return out;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Scans one file's text for NestJS class-level controller decorators
|
|
269
|
+
* followed by method-level decorators within the class body, building
|
|
270
|
+
* the `<METHOD> <PATH>` declaration pair. We look for `@UseGuards(RolesGuard)`
|
|
271
|
+
* or `@Roles(...)` anywhere inside the class body, then emit one
|
|
272
|
+
* resource per guarded method. Unguarded controllers produce nothing.
|
|
273
|
+
*/
|
|
274
|
+
function scanNest(text, file) {
|
|
275
|
+
const out = [];
|
|
276
|
+
const controllerRe = /@Controller\(\s*(['"])([^'"]+)\1\s*\)/g;
|
|
277
|
+
let controller;
|
|
278
|
+
while ((controller = controllerRe.exec(text)) !== null) {
|
|
279
|
+
const classPath = (controller[2] ?? '').trim();
|
|
280
|
+
const classStart = controller.index + controller[0].length;
|
|
281
|
+
// Find the next class body closing brace at depth 0 (best-effort).
|
|
282
|
+
let depth = 0;
|
|
283
|
+
let classEnd = text.length;
|
|
284
|
+
for (let i = classStart; i < text.length; i += 1) {
|
|
285
|
+
const ch = text[i];
|
|
286
|
+
if (ch === '{')
|
|
287
|
+
depth += 1;
|
|
288
|
+
else if (ch === '}') {
|
|
289
|
+
depth -= 1;
|
|
290
|
+
if (depth === 0) {
|
|
291
|
+
classEnd = i;
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
const classBody = text.slice(classStart, classEnd);
|
|
297
|
+
const hasGuard = /@(?:UseGuards)\(\s*RolesGuard\s*\)/.test(classBody);
|
|
298
|
+
const rolesMatch = /@(?:Roles)\(\s*([^)]+)\)/.exec(classBody);
|
|
299
|
+
const roles = rolesMatch ? extractRoleLiterals(rolesMatch[1] ?? '') : null;
|
|
300
|
+
if (!hasGuard && roles === null)
|
|
301
|
+
continue;
|
|
302
|
+
const declaredRoles = roles ?? [];
|
|
303
|
+
const nestMethod = /@(Get|Post|Put|Patch|Delete|All)\(\s*(['"])([^'"]*)\2\s*\)/g;
|
|
304
|
+
nestMethod.lastIndex = 0;
|
|
305
|
+
let method;
|
|
306
|
+
while ((method = nestMethod.exec(classBody)) !== null) {
|
|
307
|
+
const verb = (method[1] ?? '').toUpperCase();
|
|
308
|
+
const subPathRaw = method[3] ?? '';
|
|
309
|
+
const subPath = subPathRaw.trim();
|
|
310
|
+
const path = joinPath(classPath, subPath);
|
|
311
|
+
const offset = method.index + classStart;
|
|
312
|
+
out.push({
|
|
313
|
+
method: verb,
|
|
314
|
+
path,
|
|
315
|
+
framework: 'nestjs',
|
|
316
|
+
roles: declaredRoles,
|
|
317
|
+
tenancy: TENANT_LITERAL.test(classBody) ? 'tenant-bound' : 'none',
|
|
318
|
+
file,
|
|
319
|
+
line: lineNumberFor(text, offset),
|
|
320
|
+
col: columnFor(text, offset),
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return out;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Scans Express middleware chain routes. The roles + tenancy come from
|
|
328
|
+
* the middleware names AFTER the path string and BEFORE the handler
|
|
329
|
+
* (final function). We do NOT trust arbitrary strings; we only inspect
|
|
330
|
+
* middleware identifiers.
|
|
331
|
+
*/
|
|
332
|
+
function scanExpress(text, file) {
|
|
333
|
+
const out = [];
|
|
334
|
+
const route = /\b(app|router)\.(get|post|put|patch|delete|all)\(\s*(['"])([^'"]+)\3/g;
|
|
335
|
+
route.lastIndex = 0;
|
|
336
|
+
let m;
|
|
337
|
+
while ((m = route.exec(text)) !== null) {
|
|
338
|
+
const verb = (m[2] ?? '').toUpperCase();
|
|
339
|
+
const routePath = (m[4] ?? '').trim();
|
|
340
|
+
// Find the `(` ourselves (the regex consumed `path` already, so m[0]
|
|
341
|
+
// ends at the closing quote of the path string, not at the `(`).
|
|
342
|
+
const parenIdx = text.indexOf('(', m.index);
|
|
343
|
+
if (parenIdx < 0)
|
|
344
|
+
continue;
|
|
345
|
+
const callArgs = readBalancedArgs(text, parenIdx);
|
|
346
|
+
if (callArgs === null)
|
|
347
|
+
continue;
|
|
348
|
+
const roles = extractRolesFromMiddlewareArgs(callArgs);
|
|
349
|
+
const tenancy = TENANT_MW.test(callArgs) || TENANT_LITERAL.test(callArgs)
|
|
350
|
+
? 'tenant-bound'
|
|
351
|
+
: 'none';
|
|
352
|
+
if (roles === null && tenancy === 'none')
|
|
353
|
+
continue;
|
|
354
|
+
out.push({
|
|
355
|
+
method: verb,
|
|
356
|
+
path: routePath,
|
|
357
|
+
framework: 'express',
|
|
358
|
+
roles: roles ?? [],
|
|
359
|
+
tenancy,
|
|
360
|
+
file,
|
|
361
|
+
line: lineNumberFor(text, m.index),
|
|
362
|
+
col: columnFor(text, m.index),
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
return out;
|
|
366
|
+
}
|
|
367
|
+
/** Scans Fastify route declarations. */
|
|
368
|
+
function scanFastify(text, file) {
|
|
369
|
+
const out = [];
|
|
370
|
+
const route = /\bfastify\.(get|post|put|patch|delete|all)\(\s*(['"])([^'"]+)\2/g;
|
|
371
|
+
route.lastIndex = 0;
|
|
372
|
+
let m;
|
|
373
|
+
while ((m = route.exec(text)) !== null) {
|
|
374
|
+
const verb = (m[1] ?? '').toUpperCase();
|
|
375
|
+
const routePath = (m[3] ?? '').trim();
|
|
376
|
+
const parenIdx = text.indexOf('(', m.index);
|
|
377
|
+
if (parenIdx < 0)
|
|
378
|
+
continue;
|
|
379
|
+
const callArgs = readBalancedArgs(text, parenIdx);
|
|
380
|
+
if (callArgs === null)
|
|
381
|
+
continue;
|
|
382
|
+
const roles = extractRolesFromMiddlewareArgs(callArgs);
|
|
383
|
+
const tenancy = TENANT_MW.test(callArgs) || TENANT_LITERAL.test(callArgs)
|
|
384
|
+
? 'tenant-bound'
|
|
385
|
+
: 'none';
|
|
386
|
+
if (roles === null && tenancy === 'none')
|
|
387
|
+
continue;
|
|
388
|
+
out.push({
|
|
389
|
+
method: verb,
|
|
390
|
+
path: routePath,
|
|
391
|
+
framework: 'fastify',
|
|
392
|
+
roles: roles ?? [],
|
|
393
|
+
tenancy,
|
|
394
|
+
file,
|
|
395
|
+
line: lineNumberFor(text, m.index),
|
|
396
|
+
col: columnFor(text, m.index),
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
return out;
|
|
400
|
+
}
|
|
401
|
+
/** Scans Hono route declarations (Hono middleware chain). */
|
|
402
|
+
function scanHono(text, file) {
|
|
403
|
+
const out = [];
|
|
404
|
+
const route = /\bapp\.(get|post|put|patch|delete|all)\(\s*(['"])([^'"]+)\2/g;
|
|
405
|
+
route.lastIndex = 0;
|
|
406
|
+
let m;
|
|
407
|
+
while ((m = route.exec(text)) !== null) {
|
|
408
|
+
const verb = (m[1] ?? '').toUpperCase();
|
|
409
|
+
const routePath = (m[3] ?? '').trim();
|
|
410
|
+
const parenIdx = text.indexOf('(', m.index);
|
|
411
|
+
if (parenIdx < 0)
|
|
412
|
+
continue;
|
|
413
|
+
const callArgs = readBalancedArgs(text, parenIdx);
|
|
414
|
+
if (callArgs === null)
|
|
415
|
+
continue;
|
|
416
|
+
const roles = extractRolesFromMiddlewareArgs(callArgs);
|
|
417
|
+
const tenancy = TENANT_MW.test(callArgs) || TENANT_LITERAL.test(callArgs)
|
|
418
|
+
? 'tenant-bound'
|
|
419
|
+
: 'none';
|
|
420
|
+
if (roles === null && tenancy === 'none')
|
|
421
|
+
continue;
|
|
422
|
+
out.push({
|
|
423
|
+
method: verb,
|
|
424
|
+
path: routePath,
|
|
425
|
+
framework: 'hono',
|
|
426
|
+
roles: roles ?? [],
|
|
427
|
+
tenancy,
|
|
428
|
+
file,
|
|
429
|
+
line: lineNumberFor(text, m.index),
|
|
430
|
+
col: columnFor(text, m.index),
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
return out;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Scans one file's text and returns every endpoint discovered across all
|
|
437
|
+
* supported frameworks. The detector NEVER throws; an unreadable file
|
|
438
|
+
* produces an empty list (fail-closed).
|
|
439
|
+
*/
|
|
440
|
+
function scanFile(text, file) {
|
|
441
|
+
const out = [];
|
|
442
|
+
for (const ep of scanNest(text, file))
|
|
443
|
+
out.push(ep);
|
|
444
|
+
// For Express/Fastify/Hono, only run the scanner whose import the
|
|
445
|
+
// file uses. `app.post` is the same shape across all three; without
|
|
446
|
+
// import-based disambiguation the first scanner to run wins and
|
|
447
|
+
// wrong-attribution leaks across frameworks.
|
|
448
|
+
if (/\bfrom\s+['"]hono['"]/.test(text) || /\brequire\(\s*['"]hono['"]/.test(text)) {
|
|
449
|
+
for (const ep of scanHono(text, file))
|
|
450
|
+
out.push(ep);
|
|
451
|
+
}
|
|
452
|
+
else if (/\bfrom\s+['"]fastify['"]/.test(text) || /\brequire\(\s*['"]fastify['"]/.test(text)) {
|
|
453
|
+
for (const ep of scanFastify(text, file))
|
|
454
|
+
out.push(ep);
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
for (const ep of scanExpress(text, file))
|
|
458
|
+
out.push(ep);
|
|
459
|
+
}
|
|
460
|
+
return out;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Builds one `auth.resource` from one detected endpoint. The output
|
|
464
|
+
* shape is the frozen GPP/3 `Resource` schema (id, kind, source,
|
|
465
|
+
* location, detectorVersion, attributes).
|
|
466
|
+
*/
|
|
467
|
+
function endpointToResource(root, ep) {
|
|
468
|
+
const id = buildResourceId(ep.method, ep.path);
|
|
469
|
+
const sourceRel = relative(root, ep.file).split(sep).join('/');
|
|
470
|
+
const location = { file: sourceRel, line: ep.line, col: ep.col };
|
|
471
|
+
return {
|
|
472
|
+
schemaVersion: 1,
|
|
473
|
+
id,
|
|
474
|
+
kind: 'auth.resource',
|
|
475
|
+
source: sourceRel,
|
|
476
|
+
location,
|
|
477
|
+
detectorVersion: PACK_VERSION,
|
|
478
|
+
attributes: {
|
|
479
|
+
method: ep.method,
|
|
480
|
+
path: ep.path,
|
|
481
|
+
framework: ep.framework,
|
|
482
|
+
roleRequirement: ep.roles,
|
|
483
|
+
tenancy: ep.tenancy,
|
|
484
|
+
},
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Creates the discover-capable detector module. The default export of
|
|
489
|
+
* the pack is `createAuthDetector()` — the CLI in-process contract.
|
|
490
|
+
*
|
|
491
|
+
* Args:
|
|
492
|
+
* options: Optional root override for repo-relative `source` paths.
|
|
493
|
+
*
|
|
494
|
+
* Returns:
|
|
495
|
+
* AuthDetector: the pinned `{ discover(paths) }` module.
|
|
496
|
+
*/
|
|
497
|
+
export function createAuthDetector(options = {}) {
|
|
498
|
+
const root = options.root ?? process.cwd();
|
|
499
|
+
return {
|
|
500
|
+
discover(paths) {
|
|
501
|
+
if (paths.length === 0) {
|
|
502
|
+
return { resources: [], unresolved: [], findings: [], classificationSignals: [] };
|
|
503
|
+
}
|
|
504
|
+
const files = resolveInputs(paths);
|
|
505
|
+
const endpoints = [];
|
|
506
|
+
const scanned = [];
|
|
507
|
+
const findings = [];
|
|
508
|
+
for (const file of files) {
|
|
509
|
+
let text;
|
|
510
|
+
try {
|
|
511
|
+
text = readFileSync(file, 'utf8');
|
|
512
|
+
}
|
|
513
|
+
catch (error) {
|
|
514
|
+
// Fail-visible coverage (ADR 0003 D4): an unreadable file is a
|
|
515
|
+
// finding, never a silent hole in the scan.
|
|
516
|
+
findings.push({
|
|
517
|
+
code: 'SOURCE_READ_ERROR',
|
|
518
|
+
detail: `failed to read '${relative(root, file).split(sep).join('/')}': ${error instanceof Error ? error.message : String(error)}`,
|
|
519
|
+
locations: [{ file: relative(root, file).split(sep).join('/'), line: 1, col: 0 }],
|
|
520
|
+
});
|
|
521
|
+
continue;
|
|
522
|
+
}
|
|
523
|
+
scanned.push(relative(root, file).split(sep).join('/'));
|
|
524
|
+
for (const endpoint of scanFile(text, file))
|
|
525
|
+
endpoints.push(endpoint);
|
|
526
|
+
}
|
|
527
|
+
endpoints.sort((a, b) => {
|
|
528
|
+
const idA = buildResourceId(a.method, a.path);
|
|
529
|
+
const idB = buildResourceId(b.method, b.path);
|
|
530
|
+
return idA < idB ? -1 : idA > idB ? 1 : 0;
|
|
531
|
+
});
|
|
532
|
+
const resources = endpoints.map((ep) => endpointToResource(root, ep));
|
|
533
|
+
// Phase-4 linkage (plan phase 4, ADR 0003 D1/D2): each guarded
|
|
534
|
+
// endpoint is externally reachable — one code-positive `exposure`
|
|
535
|
+
// signal per endpoint plus `lifecycle.<op>` from the HTTP method
|
|
536
|
+
// (POST⇒create, GET/HEAD⇒read, PUT/PATCH⇒update, DELETE⇒delete),
|
|
537
|
+
// and a `plane` signal asserting `tenant` when a tenant guard is
|
|
538
|
+
// present. Targets are the PATH-DERIVED resource name (last
|
|
539
|
+
// non-parameter segment) so the core classifier converges routes
|
|
540
|
+
// with tables deterministically; an underivable name emits no
|
|
541
|
+
// signal (nothing is claimed). `app.all`-style methods assert no
|
|
542
|
+
// operation. No negative proofs exist in this pack.
|
|
543
|
+
const classificationSignals = endpoints.flatMap((ep) => {
|
|
544
|
+
const location = {
|
|
545
|
+
file: relative(root, ep.file).split(sep).join('/'),
|
|
546
|
+
line: ep.line,
|
|
547
|
+
col: ep.col,
|
|
548
|
+
};
|
|
549
|
+
const target = lastPathName(ep.path);
|
|
550
|
+
if (target === null)
|
|
551
|
+
return [];
|
|
552
|
+
const signals = [
|
|
553
|
+
{
|
|
554
|
+
schemaVersion: 1,
|
|
555
|
+
target: { resourceName: target },
|
|
556
|
+
dimension: 'exposure',
|
|
557
|
+
assertion: 'route',
|
|
558
|
+
basis: 'code-positive',
|
|
559
|
+
source: PACK_PLUGIN_ID,
|
|
560
|
+
location,
|
|
561
|
+
detector: { id: PACK_PLUGIN_ID, version: PACK_VERSION },
|
|
562
|
+
},
|
|
563
|
+
];
|
|
564
|
+
const operation = operationForMethod(ep.method);
|
|
565
|
+
if (operation !== null) {
|
|
566
|
+
signals.push({
|
|
567
|
+
schemaVersion: 1,
|
|
568
|
+
target: { resourceName: target },
|
|
569
|
+
dimension: `lifecycle.${operation}`,
|
|
570
|
+
assertion: true,
|
|
571
|
+
basis: 'code-positive',
|
|
572
|
+
source: PACK_PLUGIN_ID,
|
|
573
|
+
location,
|
|
574
|
+
detector: { id: PACK_PLUGIN_ID, version: PACK_VERSION },
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
if (ep.tenancy === 'tenant-bound') {
|
|
578
|
+
signals.push({
|
|
579
|
+
schemaVersion: 1,
|
|
580
|
+
target: { resourceName: target },
|
|
581
|
+
dimension: 'plane',
|
|
582
|
+
assertion: 'tenant',
|
|
583
|
+
basis: 'code-positive',
|
|
584
|
+
source: PACK_PLUGIN_ID,
|
|
585
|
+
location,
|
|
586
|
+
detector: { id: PACK_PLUGIN_ID, version: PACK_VERSION },
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
return signals;
|
|
590
|
+
});
|
|
591
|
+
findings.sort((a, b) => (a.detail < b.detail ? -1 : a.detail > b.detail ? 1 : 0));
|
|
592
|
+
return { resources, unresolved: [], findings, classificationSignals, scannedPaths: scanned.sort() };
|
|
593
|
+
},
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
/** The lifecycle operation an HTTP method evidences, if any. */
|
|
597
|
+
function operationForMethod(method) {
|
|
598
|
+
switch (method) {
|
|
599
|
+
case 'POST': return 'create';
|
|
600
|
+
case 'GET':
|
|
601
|
+
case 'HEAD': return 'read';
|
|
602
|
+
case 'PUT':
|
|
603
|
+
case 'PATCH': return 'update';
|
|
604
|
+
case 'DELETE': return 'delete';
|
|
605
|
+
default: return null;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
/** Last non-parameter path segment, lower-cased; null when underivable. */
|
|
609
|
+
function lastPathName(rawPath) {
|
|
610
|
+
const segments = rawPath.split('/').filter((segment) => segment.length > 0);
|
|
611
|
+
for (let i = segments.length - 1; i >= 0; i--) {
|
|
612
|
+
const segment = segments[i];
|
|
613
|
+
if (segment === undefined)
|
|
614
|
+
continue;
|
|
615
|
+
if (segment.startsWith(':') || segment.startsWith('{') || segment.startsWith('*'))
|
|
616
|
+
continue;
|
|
617
|
+
if (/^\d+$/.test(segment))
|
|
618
|
+
continue;
|
|
619
|
+
return segment.toLowerCase();
|
|
620
|
+
}
|
|
621
|
+
return null;
|
|
622
|
+
}
|
|
623
|
+
//# sourceMappingURL=detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detector.js","sourceRoot":"","sources":["../src/detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAGnD,OAAO,EAAE,cA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
2
|
+
export { createAuthDetector, type AuthDetector, type AuthDetectorOptions, type AuthFramework, type Tenancy, } from './detector.js';
|
|
3
|
+
export { AuthEntityAdapterSchema, validateAuthEntityAdapter, type AuthEntityAdapter, type AuthAdapterContext, type NormalizedAuthEntity, type AuthEntityAdapterValidation, } from './adapter-schema.js';
|
|
4
|
+
export { AUTH_OBLIGATION_CONTRACTS, obligationId, type AuthObligationContract, } from './obligations.js';
|
|
5
|
+
/** The default CLI in-process plugin module: `{ discover(paths) }`. */
|
|
6
|
+
declare const _default: import("./detector.js").AuthDetector;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EACL,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,OAAO,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,GACjC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,yBAAyB,EACzB,YAAY,EACZ,KAAK,sBAAsB,GAC5B,MAAM,kBAAkB,CAAC;AAE1B,uEAAuE;;AACvE,wBAAoC"}
|