gdp-wired 0.44.0 → 0.46.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 +58 -7
- 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 +445 -38
- package/dist/core/calendar.d.ts +29 -0
- package/dist/core/calendar.js +82 -0
- package/dist/core/check.js +3 -2
- package/dist/core/cli.d.ts +4 -0
- package/dist/core/cli.js +335 -39
- package/dist/core/compose.js +3 -1
- package/dist/core/counts.d.ts +5 -2
- package/dist/core/counts.js +335 -88
- 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 +8 -2
- package/dist/core/data.js +1113 -172
- 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 +39 -3
- package/dist/core/dsl.js +250 -31
- package/dist/core/effect-prims.js +2 -2
- package/dist/core/effect.d.ts +1 -4
- package/dist/core/effect.js +1 -15
- package/dist/core/ex/reader.exs +17 -1
- package/dist/core/exists.d.ts +16 -1
- package/dist/core/exists.js +447 -50
- package/dist/core/extract-c.d.ts +2 -0
- package/dist/core/extract-c.js +185 -31
- package/dist/core/extract-check.d.ts +7 -0
- package/dist/core/extract-check.js +115 -3
- package/dist/core/extract-ex.js +3 -3
- package/dist/core/extract-go-check.d.ts +1 -1
- package/dist/core/extract-go-check.js +21 -13
- package/dist/core/extract-go.d.ts +1 -0
- package/dist/core/extract-go.js +58 -9
- 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 +65 -14
- package/dist/core/extract-orm.d.ts +12 -0
- package/dist/core/extract-orm.js +244 -0
- package/dist/core/extract-print.js +23 -1
- package/dist/core/extract-py.d.ts +1 -0
- package/dist/core/extract-py.js +4 -4
- package/dist/core/extract-rb.js +3 -3
- package/dist/core/extract-read.d.ts +25 -0
- package/dist/core/extract-read.js +60 -5
- package/dist/core/extract-rs.js +22 -20
- package/dist/core/extract-shapes.js +22 -0
- package/dist/core/extract-sol.d.ts +10 -1
- package/dist/core/extract-sol.js +89 -30
- package/dist/core/extract-step.d.ts +201 -4
- package/dist/core/extract-step.js +1514 -111
- package/dist/core/extract-swift.js +24 -13
- package/dist/core/extract.d.ts +9 -0
- package/dist/core/extract.js +88 -7
- package/dist/core/fiber-run.d.ts +5 -0
- package/dist/core/fiber-run.js +18 -0
- package/dist/core/fresh.d.ts +2 -2
- package/dist/core/fresh.js +7 -3
- package/dist/core/go/reader.go +7 -1
- package/dist/core/infer.d.ts +4 -1
- package/dist/core/infer.js +1020 -246
- package/dist/core/jvm/JavaReader.java +33 -8
- package/dist/core/jvm/Jvm.java +20 -1
- package/dist/core/jvm/KtReader.java +59 -6
- package/dist/core/laws.d.ts +10 -3
- package/dist/core/laws.js +193 -14
- package/dist/core/machine.d.ts +16 -3
- package/dist/core/machine.js +212 -28
- 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 +260 -21
- package/dist/core/py/reader.py +278 -39
- package/dist/core/rb/reader.rb +52 -5
- 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/src/main.rs +18 -2
- 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 +63 -7
- package/dist/core/sol-concrete.d.ts +23 -0
- package/dist/core/sol-concrete.js +195 -0
- package/dist/core/solver.js +8 -5
- package/dist/core/swift/Sources/gdp-swiftreader/main.swift +50 -7
- package/dist/core/system.d.ts +62 -1
- package/dist/core/system.js +263 -4
- package/dist/core/transfer.js +39 -9
- package/dist/core/translate.js +39 -10
- package/dist/core/watch.js +51 -6
- package/dist/interchange/check.js +10 -10
- package/dist/interchange/format.d.ts +4 -0
- package/dist/interchange/format.js +24 -6
- package/dist/kernel/cdcl.d.ts +5 -0
- package/dist/kernel/cdcl.js +88 -10
- package/dist/kernel/epr.js +141 -29
- package/dist/kernel/kernel.d.ts +31 -1
- package/dist/kernel/kernel.js +391 -101
- package/dist/kernel/model-sequence.d.ts +3 -0
- package/dist/kernel/model-sequence.js +34 -0
- package/dist/kernel/prove.d.ts +30 -1
- package/dist/kernel/prove.js +481 -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.d.ts +9 -3
- package/dist/lean-kernel/emit.js +200 -66
- package/dist/lean-kernel/lean-terms.js +5 -0
- package/dist/lean-kernel/library.js +10 -10
- package/package.json +7 -2
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
|
|
|
@@ -449,10 +499,11 @@ const soon = retry.law('the next try is at most 64 after the last request', ({ne
|
|
|
449
499
|
- **Integers and decimals**: `int` and `decimal(places)` inputs, `.ints({...})` and `.decimals(places, {...})` state;
|
|
450
500
|
`plus`, `minus`, `negate`, `times(k)` (k may be negative), `min`, `max`, `abs`, `isNegative`, comparisons with numbers
|
|
451
501
|
(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
|
-
|
|
502
|
+
−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)`
|
|
503
|
+
(a half to the even one, up, down or away from 0) and `onTick(k)`, from those two. Each is two naturals underneath,
|
|
504
|
+
so the kernel twin sees nothing new; the Lean export states each law about integers again over `Int` (`law0_int`,
|
|
505
|
+
proven from the law over the naturals by `omega`), and `rule.decode(state)` reads them back as numbers. A natural's
|
|
506
|
+
`minus` stays truncated: an integer is a kind of its own, chosen where a value may go below 0 (`examples/arith.ts`).
|
|
456
507
|
- **Strings**: `str({like: ['*.internal'], maxLength: 64})`. A string is its interned name, its length and a bit per
|
|
457
508
|
declared pattern (Cedar's glob), all computed from the string itself when the input is encoded. `s.like(pattern)`,
|
|
458
509
|
`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 {};
|