gdp-wired 0.45.0 → 0.47.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 +61 -8
- package/dist/core/bitsets.d.ts +2 -0
- package/dist/core/bitsets.js +23 -0
- package/dist/core/bmc.js +6 -2
- package/dist/core/c/reader.d.ts +9 -1
- package/dist/core/c/reader.js +423 -31
- package/dist/core/calendar.d.ts +29 -0
- package/dist/core/calendar.js +82 -0
- package/dist/core/cli.d.ts +4 -0
- package/dist/core/cli.js +206 -40
- package/dist/core/compose.js +3 -1
- package/dist/core/counts.d.ts +4 -1
- package/dist/core/counts.js +314 -85
- package/dist/core/cycles.js +8 -1
- package/dist/core/cyclic.d.ts +1 -0
- package/dist/core/cyclic.js +13 -7
- package/dist/core/data-synth.d.ts +3 -0
- package/dist/core/data-synth.js +252 -0
- package/dist/core/data.d.ts +2 -1
- package/dist/core/data.js +223 -24
- package/dist/core/discover.js +3 -1
- package/dist/core/draft.d.ts +19 -0
- package/dist/core/draft.js +53 -0
- package/dist/core/dsl.d.ts +37 -3
- package/dist/core/dsl.js +167 -26
- package/dist/core/effect-schema.d.ts +90 -0
- package/dist/core/effect-schema.js +500 -0
- package/dist/core/effect.d.ts +4 -11
- package/dist/core/effect.js +3 -79
- package/dist/core/exists.d.ts +1 -0
- package/dist/core/exists.js +191 -16
- package/dist/core/extract-c.d.ts +2 -0
- package/dist/core/extract-c.js +169 -22
- package/dist/core/extract-check.d.ts +1 -0
- package/dist/core/extract-check.js +97 -6
- package/dist/core/extract-go-check.d.ts +1 -1
- package/dist/core/extract-go-check.js +26 -5
- package/dist/core/extract-go.d.ts +8 -0
- package/dist/core/extract-go.js +67 -6
- package/dist/core/extract-ir.d.ts +1 -0
- package/dist/core/extract-ir.js +15 -0
- package/dist/core/extract-jvm.d.ts +1 -1
- package/dist/core/extract-jvm.js +2 -0
- package/dist/core/extract-orm.d.ts +12 -0
- package/dist/core/extract-orm.js +244 -0
- package/dist/core/extract-print.js +20 -1
- package/dist/core/extract-py.d.ts +1 -0
- package/dist/core/extract-py.js +1 -1
- package/dist/core/extract-read.d.ts +26 -1
- package/dist/core/extract-read.js +14 -7
- package/dist/core/extract-rs.js +63 -15
- package/dist/core/extract-shapes.d.ts +1 -0
- package/dist/core/extract-shapes.js +84 -0
- package/dist/core/extract-sol.d.ts +10 -1
- package/dist/core/extract-sol.js +70 -22
- package/dist/core/extract-standalone.d.ts +3 -0
- package/dist/core/extract-standalone.js +221 -0
- package/dist/core/extract-step.d.ts +151 -1
- package/dist/core/extract-step.js +1232 -60
- package/dist/core/extract-swift.js +6 -2
- package/dist/core/extract.d.ts +9 -0
- package/dist/core/extract.js +77 -7
- package/dist/core/fiber-run.d.ts +5 -0
- package/dist/core/fiber-run.js +18 -0
- package/dist/core/infer.d.ts +4 -1
- package/dist/core/infer.js +918 -217
- package/dist/core/jvm/JavaReader.java +23 -6
- package/dist/core/jvm/Jvm.java +3 -0
- package/dist/core/jvm/KtReader.java +6 -5
- package/dist/core/laws.d.ts +10 -3
- package/dist/core/laws.js +226 -23
- package/dist/core/machine.d.ts +15 -1
- package/dist/core/machine.js +187 -15
- package/dist/core/nonterm.js +14 -1
- package/dist/core/orm/harness.js +61 -0
- package/dist/core/orm-fixtures/schema.prisma +5 -0
- package/dist/core/py/harness.py +183 -10
- package/dist/core/py/reader.py +234 -40
- package/dist/core/reader-fixtures/README.md +28 -0
- package/dist/core/reader-fixtures/c-693042.cpp +8 -0
- package/dist/core/reader-fixtures/go-685506.go +14 -0
- package/dist/core/reader-fixtures/jvm-724362.kt +8 -0
- package/dist/core/reader-fixtures/jvm-737430.kt +7 -0
- package/dist/core/reader-fixtures/jvm-765282.kt +3 -0
- package/dist/core/reader-fixtures/swift-735726.swift +15 -0
- package/dist/core/reader-fixtures/swift-735990.swift +15 -0
- package/dist/core/reader-fixtures/swift-739158.swift +4 -0
- package/dist/core/reader-fixtures/swift-744834.swift +15 -0
- package/dist/core/reader-fixtures/swift-746946.swift +31 -0
- package/dist/core/reader-fixtures/typescript-673062.ts.txt +2 -0
- package/dist/core/relation.d.ts +1 -1
- package/dist/core/relation.js +29 -2
- package/dist/core/relational.js +4 -2
- package/dist/core/rs/Cargo.toml +1 -1
- package/dist/core/rs/src/main.rs +466 -11
- package/dist/core/sample-cache.d.ts +8 -0
- package/dist/core/sample-cache.js +46 -0
- package/dist/core/security.d.ts +38 -0
- package/dist/core/security.js +88 -0
- package/dist/core/sol/harness.py +57 -4
- package/dist/core/sol-concrete.d.ts +23 -0
- package/dist/core/sol-concrete.js +195 -0
- package/dist/core/solver.js +3 -1
- package/dist/core/swift/Sources/gdp-swiftreader/main.swift +50 -7
- package/dist/core/system.js +1 -1
- package/dist/core/transfer.js +22 -9
- package/dist/core/translate.js +39 -10
- package/dist/core/watch.js +50 -5
- package/dist/interchange/format.js +11 -1
- package/dist/kernel/cdcl.d.ts +5 -0
- package/dist/kernel/cdcl.js +56 -9
- package/dist/kernel/epr.js +108 -26
- package/dist/kernel/kernel.d.ts +29 -1
- package/dist/kernel/kernel.js +325 -62
- package/dist/kernel/model-sequence.d.ts +3 -0
- package/dist/kernel/model-sequence.js +34 -0
- package/dist/kernel/prove.d.ts +10 -3
- package/dist/kernel/prove.js +332 -71
- package/dist/kernel/reader.d.ts +3 -0
- package/dist/kernel/reader.js +101 -14
- package/dist/kernel/share.d.ts +1 -0
- package/dist/kernel/share.js +27 -0
- package/dist/lean-kernel/emit.js +30 -37
- package/dist/lean-kernel/lean-terms.js +5 -0
- package/dist/lean-kernel/library.js +10 -10
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -42,6 +42,51 @@ protocols, commerce, supply chains, games, education, healthcare, energy, networ
|
|
|
42
42
|
governance, insurance, bookings, safety and IoT, mobility, media), each checked three ways: the kernel proves every law
|
|
43
43
|
and refutes every broken variant, random runs of both runtimes agree, and Lean checks the trees.
|
|
44
44
|
|
|
45
|
+
## Security policy candidates
|
|
46
|
+
|
|
47
|
+
`gdp-wired check src/handler.ts --security --no-propose` proposes authorization, tenant
|
|
48
|
+
write/read isolation, workflow-order, quota and ledger laws over the extracted names.
|
|
49
|
+
Candidates are **not accepted policy**: review the requirement and authentication boundary,
|
|
50
|
+
then state the intended law with the printed `gdp: law` comment. Broken candidates are shown,
|
|
51
|
+
not silently discarded. Requests remain arbitrary; concurrent laws use the existing `gdp: env`
|
|
52
|
+
isolation model. [`research/security/README.md`](research/security/README.md) documents the
|
|
53
|
+
public `gdp-wired/security` templates, their limits, and the pinned public-advisory recall protocol.
|
|
54
|
+
The initial real-code seed set is currently refused by the readers; this is not a claim of
|
|
55
|
+
security-vulnerability recall or universal handler support.
|
|
56
|
+
|
|
57
|
+
## Security checks in GitHub Actions
|
|
58
|
+
|
|
59
|
+
The existing Action can opt into the same review-required security candidates as the
|
|
60
|
+
CLI. Install the source language's toolchain and project dependencies first, as for
|
|
61
|
+
ordinary stated-law checks:
|
|
62
|
+
|
|
63
|
+
```yaml
|
|
64
|
+
- uses: actions/checkout@v5
|
|
65
|
+
- uses: monotykamary/gdp-wired@main
|
|
66
|
+
with:
|
|
67
|
+
paths: src/handlers.ts
|
|
68
|
+
security: true
|
|
69
|
+
args: --no-propose
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`security` defaults to `false`; omitted, the Action's command and behavior are unchanged.
|
|
73
|
+
When `true`, it adds `--security`. The CLI labels candidates **NOT accepted policy** and
|
|
74
|
+
prints broken candidates for review. Candidates never change the exit code or fail the
|
|
75
|
+
build. To enforce a reviewed requirement, state it as a `gdp: law` comment in the source:
|
|
76
|
+
a broken stated law exits 1, while unreadable stated laws or unsupported security
|
|
77
|
+
extraction exit 2. This input does not authenticate caller-supplied identities or certify
|
|
78
|
+
a handler secure. `args` and the optional npm `version` input continue to work as before.
|
|
79
|
+
|
|
80
|
+
Dependency-layout limitation (also present without `security`): npm-exec can omit
|
|
81
|
+
TypeScript from its temporary package tree when it finds TypeScript in the caller's
|
|
82
|
+
project, leaving the temporary `gdp-wired` unable to import it. Install `gdp-wired` and
|
|
83
|
+
TypeScript together in one package tree, or use the standalone `gdp-wired-cli` when that
|
|
84
|
+
layout occurs. The clean-workspace Action fixture does not fix or waive this limitation.
|
|
85
|
+
|
|
86
|
+
[The Action fixture workflow](.github/workflows/security-action.yml) tests the candidate
|
|
87
|
+
package against a temporary Git repository: default mode, review-only candidates and an
|
|
88
|
+
expected failing stated law. Its sources are synthetic, not upstream findings.
|
|
89
|
+
|
|
45
90
|
## First proof in your language
|
|
46
91
|
|
|
47
92
|
The rules already in your code (Python, Ruby, Elixir, Java, Kotlin, Go, Rust, Swift, C, C++, TypeScript, Effect,
|
|
@@ -118,9 +163,14 @@ Laws about two runs read the same way: `diagnosis never reaches status, result`
|
|
|
118
163
|
secret keep what is named the same, and fail alike), `isolated by user_id` (what the caller whose `user_id` is B sees
|
|
119
164
|
is the same whatever the others do), `agrees with LimiterV1` (a migration: another class of the target, the same state
|
|
120
165
|
after every history). A duration is linear over the request's time: `now - received < 30 days` (seconds, minutes,
|
|
121
|
-
hours, days, weeks; a month
|
|
122
|
-
|
|
123
|
-
|
|
166
|
+
hours, days, weeks; a month or a year is refused). Business days are counted over a calendar stated once (`[calendar]`
|
|
167
|
+
in gdp.toml: weekend days, holidays, a UTC offset): `now - received <= 10 business days`, decided in the same linear
|
|
168
|
+
arithmetic, nothing trusted added. `gdp: cite <law name>: <clause>` ties a law to the clause it answers: printed with
|
|
169
|
+
the law, and with `--cert <dir>` kept in the meta of each proven law's certificate, never in what is checked.
|
|
170
|
+
`gdp-wired draft <file> --clause-file <f> --cite <ref> --llm <command>` asks a drafter (a model, by any command) for
|
|
171
|
+
laws from the clause's text, reads each over the code's names and prints the comments to paste, each citation marked
|
|
172
|
+
`[unreviewed: drafted by ...]` until a person signs it (`[reviewed-by: <name>, <date>]`); `check --require-review`
|
|
173
|
+
refuses a law cited unreviewed (`research/regulated/DESIGN.md`, `research/regulated/DRAFTING.md`).
|
|
124
174
|
|
|
125
175
|
## Where it fits
|
|
126
176
|
|
|
@@ -181,7 +231,9 @@ All of these are proven automatically, and each proof is also a Lean theorem:
|
|
|
181
231
|
`Semaphore` the service makes is modelled once, its own laws proven (bounded, nothing lost, FIFO, the permits) and
|
|
182
232
|
run beside Effect's own on random operations and fibers, so a law states only the service's own
|
|
183
233
|
(`examples/effect-queue.ts`: a worker pool, a release without its acquire refuted by a run). `conforms(rule, service)` runs a rule written by hand
|
|
184
|
-
beside a running service (Effect's own Semaphore, a store)
|
|
234
|
+
beside a running service (Effect's own Semaphore, a store). `fromSchema(schema)` provides typed symbolic
|
|
235
|
+
[Schema kinds](docs/effect-schema.md): exact on declared closed decoded values by default, with checked integer
|
|
236
|
+
bounds and inspectable, opt-in approximation losses
|
|
185
237
|
(`examples/effect.ts`; what is read and refused, with what Effect projects write, in `research/effect/README.md`).
|
|
186
238
|
- **What nobody stated, looked for when the prover alone stops**: where `proveRule` or `proveSteps` doesn't prove the laws
|
|
187
239
|
and no run breaks them, it looks for lemmas about the rule's recurrences and lists (`discover`), lemmas about the
|
|
@@ -449,10 +501,11 @@ const soon = retry.law('the next try is at most 64 after the last request', ({ne
|
|
|
449
501
|
- **Integers and decimals**: `int` and `decimal(places)` inputs, `.ints({...})` and `.decimals(places, {...})` state;
|
|
450
502
|
`plus`, `minus`, `negate`, `times(k)` (k may be negative), `min`, `max`, `abs`, `isNegative`, comparisons with numbers
|
|
451
503
|
(a decimal's literals are scaled: `price.atMost(19.99)`), and `modBy(k)`, `divBy(k)` by Euclid's rule (−7 div 2 is
|
|
452
|
-
−4, −7 mod 2 is 1, as SMT-LIB and Lean's `Int` read them)
|
|
453
|
-
|
|
454
|
-
the
|
|
455
|
-
|
|
504
|
+
−4, −7 mod 2 is 1, as SMT-LIB and Lean's `Int` read them); on a tick, `floorTo(k)`, `ceilTo(k)`, `roundTo(k, mode)`
|
|
505
|
+
(a half to the even one, up, down or away from 0) and `onTick(k)`, from those two. Each is two naturals underneath,
|
|
506
|
+
so the kernel twin sees nothing new; the Lean export states each law about integers again over `Int` (`law0_int`,
|
|
507
|
+
proven from the law over the naturals by `omega`), and `rule.decode(state)` reads them back as numbers. A natural's
|
|
508
|
+
`minus` stays truncated: an integer is a kind of its own, chosen where a value may go below 0 (`examples/arith.ts`).
|
|
456
509
|
- **Strings**: `str({like: ['*.internal'], maxLength: 64})`. A string is its interned name, its length and a bit per
|
|
457
510
|
declared pattern (Cedar's glob), all computed from the string itself when the input is encoded. `s.like(pattern)`,
|
|
458
511
|
`s.eq('admin')` (which carries the literal's length and pattern bits, so laws reason from either), `s.isEmpty`,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Finite sample rows used by the untrusted invariant search. Bits outside the
|
|
2
|
+
// sample's domain are zero in every operand. Inputs have the same word count.
|
|
3
|
+
export function bitIntersection(a, b) {
|
|
4
|
+
const out = new Uint32Array(a.length);
|
|
5
|
+
for (let i = 0; i < a.length; i++)
|
|
6
|
+
out[i] = a[i] & b[i];
|
|
7
|
+
return out;
|
|
8
|
+
}
|
|
9
|
+
// Existence, rather than a materialized intersection: most candidate cubes have
|
|
10
|
+
// a witness near the start. No intermediate arrays or scans of later words.
|
|
11
|
+
export function bitIntersects(sets) {
|
|
12
|
+
const first = sets[0];
|
|
13
|
+
if (!first)
|
|
14
|
+
return false;
|
|
15
|
+
for (let i = 0; i < first.length; i++) {
|
|
16
|
+
let word = first[i];
|
|
17
|
+
for (let j = 1; word !== 0 && j < sets.length; j++)
|
|
18
|
+
word &= sets[j][i];
|
|
19
|
+
if (word !== 0)
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
}
|
package/dist/core/bmc.js
CHANGED
|
@@ -100,6 +100,7 @@ const occurrences = (xs, out = new Map()) => {
|
|
|
100
100
|
case 'min':
|
|
101
101
|
case 'max':
|
|
102
102
|
case 'prod':
|
|
103
|
+
case 'tup':
|
|
103
104
|
case '<':
|
|
104
105
|
case '<=':
|
|
105
106
|
case '=':
|
|
@@ -107,6 +108,7 @@ const occurrences = (xs, out = new Map()) => {
|
|
|
107
108
|
go(x.b);
|
|
108
109
|
return;
|
|
109
110
|
case 'mul':
|
|
111
|
+
case 'proj':
|
|
110
112
|
go(x.a);
|
|
111
113
|
return;
|
|
112
114
|
case 'if':
|
|
@@ -156,13 +158,15 @@ export function tidier(bools) {
|
|
|
156
158
|
case 'sub':
|
|
157
159
|
case 'min':
|
|
158
160
|
case 'max':
|
|
159
|
-
case 'prod':
|
|
161
|
+
case 'prod':
|
|
162
|
+
case 'tup': {
|
|
160
163
|
const a = e1(e.a), b = e1(e.b);
|
|
161
164
|
if (a !== e.a || b !== e.b)
|
|
162
165
|
out = { ...e, a, b };
|
|
163
166
|
break;
|
|
164
167
|
}
|
|
165
|
-
case 'mul':
|
|
168
|
+
case 'mul':
|
|
169
|
+
case 'proj': {
|
|
166
170
|
const a = e1(e.a);
|
|
167
171
|
if (a !== e.a)
|
|
168
172
|
out = { ...e, a };
|
package/dist/core/c/reader.d.ts
CHANGED
|
@@ -75,12 +75,20 @@ export type CRead = {
|
|
|
75
75
|
methods: string[];
|
|
76
76
|
entry: string;
|
|
77
77
|
cname: string;
|
|
78
|
+
consts: Record<string, number>;
|
|
79
|
+
globals?: {
|
|
80
|
+
state: string[];
|
|
81
|
+
inputs: string[];
|
|
82
|
+
types: Record<string, string>;
|
|
83
|
+
externs: string[];
|
|
84
|
+
};
|
|
78
85
|
};
|
|
79
86
|
export declare const node: <T>(id: string) => T;
|
|
80
87
|
export declare function clangDump(file: string, flags: string[], clang?: string, cpp?: boolean, filter?: string): {
|
|
81
88
|
tu: CN;
|
|
82
89
|
target: CTarget;
|
|
83
90
|
};
|
|
91
|
+
export declare function constantsOf(file: string, flags: string[], clang: string, cpp: boolean, names: string[]): Record<string, number>;
|
|
84
92
|
export declare function flagsFor(file: string, compileCommands?: string): string[];
|
|
85
|
-
export declare function readC(file: string, entry: string, tu: CN, target: CTarget, cpp?: boolean, root?: string, picks?: Record<string, number
|
|
93
|
+
export declare function readC(file: string, entry: string, tu: CN, target: CTarget, cpp?: boolean, root?: string, picks?: Record<string, number>, pickNames?: string[], leave?: string[], cut?: string[]): CRead;
|
|
86
94
|
export {};
|