@cosmicdrift/kumiko-guards 0.286.0 → 0.287.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-guards",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.287.0",
|
|
4
4
|
"description": "AST-based security guards for Kumiko repos: direct-fs/fetch, tenant escalation, admin-API, escape hatches and related checks, run over a shared ts-morph project.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"kumiko-guards": "./src/cli.ts"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@cosmicdrift/kumiko-repo-manifest": "0.
|
|
30
|
+
"@cosmicdrift/kumiko-repo-manifest": "0.287.0",
|
|
31
31
|
"ts-morph": "^28.0.0"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
@@ -64,7 +64,7 @@ export function collectBrokerSubscribeViolations(
|
|
|
64
64
|
for (const call of sf.getDescendantsOfKind(SyntaxKind.CallExpression)) {
|
|
65
65
|
const callee = call.getExpression();
|
|
66
66
|
const pae = callee.asKind(SyntaxKind.PropertyAccessExpression);
|
|
67
|
-
if (
|
|
67
|
+
if (pae?.getName() !== "subscribe") continue;
|
|
68
68
|
const recv = receiverName(pae.getExpression());
|
|
69
69
|
if (!recv || !BROKER_RECEIVER.test(recv)) continue;
|
|
70
70
|
hits.push({
|
|
@@ -92,7 +92,7 @@ function isSameOriginLiteralArg(expr: CallExpression): boolean {
|
|
|
92
92
|
|
|
93
93
|
function isGlobalFetchAccess(callee: Node): boolean {
|
|
94
94
|
const pae = callee.asKind(SyntaxKind.PropertyAccessExpression);
|
|
95
|
-
if (
|
|
95
|
+
if (pae?.getName() !== "fetch") return false;
|
|
96
96
|
const receiver = pae.getExpression();
|
|
97
97
|
return (
|
|
98
98
|
receiver.getKind() === SyntaxKind.Identifier && GLOBAL_FETCH_RECEIVERS.has(receiver.getText())
|
|
@@ -82,7 +82,7 @@ function hasSpreadProperty(obj: ObjectLiteralExpression): boolean {
|
|
|
82
82
|
// for it) — except `undefined`/`null`, which never answered the question.
|
|
83
83
|
function hasPersonalStance(obj: ObjectLiteralExpression): boolean {
|
|
84
84
|
const prop = obj.getProperty("personal");
|
|
85
|
-
if (!prop
|
|
85
|
+
if (!prop?.isKind(SyntaxKind.PropertyAssignment)) return false;
|
|
86
86
|
const init: Node | undefined = prop.getInitializer();
|
|
87
87
|
return (
|
|
88
88
|
init !== undefined &&
|
|
@@ -235,9 +235,9 @@ function getSingleDirectCallee(node: FnNode): string | null {
|
|
|
235
235
|
: node.getBody();
|
|
236
236
|
|
|
237
237
|
// Concise arrow: `x => someCall(x)` — body IS the expression
|
|
238
|
-
if (!rawBody
|
|
238
|
+
if (!rawBody?.isKind(SyntaxKind.Block)) {
|
|
239
239
|
const body = node.getBody();
|
|
240
|
-
if (!body
|
|
240
|
+
if (!body?.isKind(SyntaxKind.CallExpression)) return null;
|
|
241
241
|
// Method chains (A.from(x).toMethod(y)) have 2 call expressions — not a thin wrapper
|
|
242
242
|
const conciseCallees = new Set<string>();
|
|
243
243
|
node.forEachDescendant((n) => {
|