@vantageos/backend-doctor 0.1.14 → 0.3.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 +66 -5
- package/dist/args.d.ts +16 -0
- package/dist/args.js +72 -0
- package/dist/build-stamp.d.ts +13 -0
- package/dist/build-stamp.js +76 -0
- package/dist/build-stamp.json +4 -0
- package/dist/caller-resolution.d.ts +222 -0
- package/dist/caller-resolution.js +1198 -0
- package/dist/cli.js +249 -17
- package/dist/contract.d.ts +25 -7
- package/dist/contract.js +52 -7
- package/dist/coverage-cli.js +8 -0
- package/dist/coverage.d.ts +1 -1
- package/dist/coverage.js +2 -2
- package/dist/detectors/oracle-axis1.d.ts +5 -3
- package/dist/detectors/oracle-axis1.js +28 -18
- package/dist/detectors/oracle-axis2.d.ts +6 -0
- package/dist/detectors/oracle-axis2.js +37 -22
- package/dist/detectors/predicates.d.ts +3 -0
- package/dist/detectors/predicates.js +93 -19
- package/dist/detectors/shared.js +8 -7
- package/dist/detectors/source/_ast.d.ts +92 -0
- package/dist/detectors/source/_ast.js +353 -0
- package/dist/detectors/source/_scan.js +4 -3
- package/dist/detectors/source/backfill.js +71 -18
- package/dist/detectors/source/contract.js +21 -13
- package/dist/detectors/source/cross-tenant-write.d.ts +46 -0
- package/dist/detectors/source/cross-tenant-write.js +1408 -0
- package/dist/detectors/source/guard-helper-flow.d.ts +134 -0
- package/dist/detectors/source/guard-helper-flow.js +1216 -0
- package/dist/detectors/source/identity-by-id.d.ts +80 -0
- package/dist/detectors/source/identity-by-id.js +1783 -0
- package/dist/detectors/source/identity.d.ts +58 -2
- package/dist/detectors/source/identity.js +1158 -28
- package/dist/detectors/source/isolation.d.ts +11 -1
- package/dist/detectors/source/isolation.js +106 -25
- package/dist/detectors/source/jobs.js +178 -4
- package/dist/detectors/source/lifecycle.js +14 -2
- package/dist/detectors/source/local-identity.d.ts +26 -0
- package/dist/detectors/source/local-identity.js +661 -0
- package/dist/detectors/source/package-principal.d.ts +9 -0
- package/dist/detectors/source/package-principal.js +177 -0
- package/dist/detectors/source/r6-shapes.d.ts +20 -0
- package/dist/detectors/source/r6-shapes.js +285 -0
- package/dist/detectors/source/readbudget.d.ts +1 -0
- package/dist/detectors/source/readbudget.js +358 -4
- package/dist/detectors/source/recipient-by-id.d.ts +40 -0
- package/dist/detectors/source/recipient-by-id.js +1108 -0
- package/dist/detectors/source/refusal.d.ts +14 -0
- package/dist/detectors/source/refusal.js +75 -2
- package/dist/detectors/source/security.d.ts +16 -0
- package/dist/detectors/source/security.js +680 -33
- package/dist/detectors/source/write-isolation.d.ts +8 -1
- package/dist/detectors/source/write-isolation.js +64 -30
- package/dist/detectors/source/writesafety.js +27 -14
- package/dist/detectors/standard/_doc.d.ts +1 -1
- package/dist/detectors/standard/_doc.js +5 -4
- package/dist/detectors/standard/r41-frontier.js +3 -2
- package/dist/detectors/standard/r46-returns-validator.d.ts +8 -0
- package/dist/detectors/standard/r46-returns-validator.js +48 -16
- package/dist/detectors/structural.d.ts +6 -7
- package/dist/detectors/structural.js +84 -48
- package/dist/not-checkable.d.ts +1 -1
- package/dist/not-checkable.js +11 -0
- package/dist/oracle.d.ts +92 -3
- package/dist/oracle.js +229 -12
- package/dist/registry.d.ts +8 -1
- package/dist/registry.js +74 -8
- package/dist/report.d.ts +11 -1
- package/dist/report.js +15 -2
- package/dist/rule-class.d.ts +85 -0
- package/dist/rule-class.js +218 -0
- package/dist/state-rank.d.ts +5 -0
- package/dist/state-rank.js +9 -0
- package/dist/tally.d.ts +13 -5
- package/dist/tally.js +15 -13
- package/dist/target.d.ts +32 -0
- package/dist/target.js +173 -0
- package/dist/violation-count.d.ts +48 -0
- package/dist/violation-count.js +94 -0
- package/fixtures/backend-standard-2825122.md +722 -0
- package/fixtures/backend-standard-4dcd3e0.md +722 -0
- package/fixtures/cr1-classes/_generated/api.d.ts +24 -0
- package/fixtures/cr1-classes/surface.ts +206 -0
- package/fixtures/cr1-empty/nothing.ts +1 -0
- package/fixtures/cr1-refusal-on-resolved/_generated/api.d.ts +24 -0
- package/fixtures/cr1-refusal-on-resolved/doors.ts +180 -0
- package/fixtures/cr1-refusal-on-resolved/lib/auth.ts +104 -0
- package/fixtures/r34-vp-auth-30e821b/auth-805-812.ts.txt +8 -0
- package/fixtures/r34-vp-auth-30e821b/auth-878-890.ts.txt +13 -0
- package/fixtures/rule-classes-2825122.json +228 -0
- package/fixtures/vp-writer-tier-1e4ab36.csv +55 -0
- package/package.json +2 -2
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { LiveDetector } from "@vantageos/mcp-doctor";
|
|
2
2
|
import type { Detector, DetectorResult, Tree } from "../../engine-types.js";
|
|
3
|
+
import { type GuardHelperKind, type HelperVerdict } from "./guard-helper-flow.js";
|
|
3
4
|
/** The standard both are pinned against (short hash a9d7877b), §15/§18. */
|
|
4
5
|
export declare const IDENTITY_STANDARD_PIN = "analysis/vantagepeers/backend-standard/backend-standard.md @ a9d7877b4947ed8ae61d234433debb2182a2ba44 (elpiarthera/ElPi-Corp) \u00A715/\u00A718";
|
|
5
6
|
type SrcFile = Tree["files"][number];
|
|
7
|
+
type SrcLine = SrcFile["lines"][number];
|
|
6
8
|
/** A registrable entry — structurally the RegistryEntry the orchestrator spreads
|
|
7
9
|
* into REGISTRY. We do NOT import registry.ts; we mirror its shape so the
|
|
8
10
|
* orchestrator owns the integration (same discipline as security.ts). */
|
|
@@ -21,8 +23,62 @@ interface Scan {
|
|
|
21
23
|
violate: Site[];
|
|
22
24
|
cnj: Site[];
|
|
23
25
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
interface Handler {
|
|
27
|
+
name: string;
|
|
28
|
+
startN: number;
|
|
29
|
+
lines: SrcLine[];
|
|
30
|
+
/** true for an `internalMutation` registration — no client can call it, so
|
|
31
|
+
* its arguments are supplied by server code, never by a caller (R-6 scope). */
|
|
32
|
+
internal: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** Split a convex file into its top-level mutation/internalMutation handler
|
|
35
|
+
* blocks. A block runs from `export const <name> = mutation(` to the next
|
|
36
|
+
* top-level `export ` (or EOF). Queries/actions are not R-6 write handlers.
|
|
37
|
+
* Each block records whether it is an `internalMutation` registration. */
|
|
38
|
+
export declare function splitMutationHandlers(f: SrcFile): Handler[];
|
|
39
|
+
export declare function normalizeArgsAccess(raw: string): string;
|
|
40
|
+
/** The taint result of following a boundary local. `matched` is the count of
|
|
41
|
+
* assignments/declarations of the local actually FOUND in the handler — a
|
|
42
|
+
* `matched === 0` local is a THIRD state (could-not-judge), never silently
|
|
43
|
+
* tainted (Eta REVISE #3 defect 2). `cnj` counts RHSes whose own provenance
|
|
44
|
+
* could not be resolved (a bare-identifier hop that dead-ends or exhausts the
|
|
45
|
+
* bound) — again could-not-judge, never a guess. */
|
|
46
|
+
export interface LocalTaint {
|
|
47
|
+
fromArgs: number;
|
|
48
|
+
fromScope: number;
|
|
49
|
+
matched: number;
|
|
50
|
+
cnj: number;
|
|
51
|
+
/** Present (and > 0) only when a scope-derived assignment is the return of
|
|
52
|
+
* a function judged in the tree as an identity resolver. */
|
|
53
|
+
fromResolver?: number;
|
|
54
|
+
}
|
|
55
|
+
/** Follow ONE hop (plus one bounded bare-identifier hop): classify every
|
|
56
|
+
* assignment/declaration of `local` in the handler as scope-derived, arg-derived,
|
|
57
|
+
* or could-not-judge. Reads a PLAIN assignment RHS and a DESTRUCTURING RHS with
|
|
58
|
+
* the same scope test (defect 1). Exposes `matched` so a local with NO resolvable
|
|
59
|
+
* assignment is a third state, not silently tainted (defect 2). A bare-identifier
|
|
60
|
+
* RHS (`const t = orgSlug`) is NOT scope evidence on its own — the identifier's
|
|
61
|
+
* own provenance is resolved one further, bounded, cycle-guarded hop (defect 3);
|
|
62
|
+
* exhaustion is `cnj`, never a guess. */
|
|
63
|
+
export declare function analyzeLocalTaint(h: Handler, local: string, isResolver?: ResolverTest, principalOf?: PrincipalTest): LocalTaint;
|
|
64
|
+
/** Is `expr` the principal @vantageos/cloud-identity resolved and the door
|
|
65
|
+
* refused unless ok (package-principal.ts)? Returns the reason, else undefined. */
|
|
66
|
+
export type PrincipalTest = (expr: string) => string | undefined;
|
|
67
|
+
/** Is `name` an identity resolver? `call` is the whole `await name(…)` text,
|
|
68
|
+
* joined across the lines it spans, so a resolver anchored on one of its call
|
|
69
|
+
* arguments can read that argument. */
|
|
70
|
+
export type ResolverTest = (name: string, call: string) => boolean;
|
|
71
|
+
export declare const R6_GUARD_HELPERS: Readonly<Record<string, GuardHelperKind>>;
|
|
72
|
+
interface HelperDef {
|
|
73
|
+
rel: string;
|
|
74
|
+
n: number;
|
|
75
|
+
exported: boolean;
|
|
76
|
+
judgement: HelperVerdict;
|
|
77
|
+
}
|
|
78
|
+
/** Index every definition of an allowlisted helper in the tree. */
|
|
79
|
+
export declare function indexGuardHelpers(files: SrcFile[]): Map<string, HelperDef[]>;
|
|
80
|
+
export declare function scanR6(files: SrcFile[], rootIsConvex?: boolean): Scan;
|
|
81
|
+
export declare function scanR16(files: SrcFile[], rootIsConvex?: boolean): Scan;
|
|
26
82
|
/** A live-probe outcome for R-6: what a boundary-less write call returned. */
|
|
27
83
|
export type LiveWriteOutcome = {
|
|
28
84
|
kind: "refused";
|