@ligeti/step-attest 0.0.0-stage → 3.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 +201 -0
- package/README.md +66 -2
- package/dist/client.d.ts +17 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +99 -0
- package/dist/client.js.map +1 -0
- package/dist/gate.d.ts +4 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/gate.js +39 -0
- package/dist/gate.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/settings.d.ts +13 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +35 -0
- package/dist/settings.js.map +1 -0
- package/dist/types.d.ts +83 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +46 -0
- package/dist/types.js.map +1 -0
- package/package.json +29 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Viktor "Bika" Nagy
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,67 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ligeti/step-attest
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Asks the shell to run and sign the verification gate for one commit of a repository, as the
|
|
4
|
+
`attest.gate` step.
|
|
5
|
+
|
|
6
|
+
The shell runs and signs the gate — never the worker running this step, and never the agent it
|
|
7
|
+
supervises — so a verdict is never assembled from anything a step reported. See
|
|
8
|
+
[`docs/attestation.md`](../../docs/attestation.md) for what the gate proves (and does not prove)
|
|
9
|
+
and [`docs/trust-model.md`](../../docs/trust-model.md) for the boundary this draws around the
|
|
10
|
+
agent.
|
|
11
|
+
|
|
12
|
+
## Vocabulary
|
|
13
|
+
|
|
14
|
+
The project-wide vocabulary is [`docs/glossary.md`](../../docs/glossary.md), including its
|
|
15
|
+
**DSSE envelope** and **Attestation** entries. `src/types.ts`'s `Envelope` schema deliberately
|
|
16
|
+
re-declares the envelope shape rather than importing `@ligeti/attest`'s own `Envelope` type,
|
|
17
|
+
because a step package may not depend on it (`steps-only-depend-on-sdk`, per
|
|
18
|
+
[ADR-0001](../../adr/0001-package-boundaries-and-dependency-rules.md)). The two declarations must
|
|
19
|
+
therefore be kept in step by convention, not by shared code — the glossary entry says so as well.
|
|
20
|
+
|
|
21
|
+
## Steps
|
|
22
|
+
|
|
23
|
+
| Step | Purpose | Key inputs |
|
|
24
|
+
| ------------- | --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
25
|
+
| `attest.gate` | Asks the shell to run and sign the gate for one commit, in a fresh gate checkout. | `repository` (required), `commit` (required), `base` (optional), `configPath` (optional) |
|
|
26
|
+
|
|
27
|
+
`repository` is the local repository the commit is cloned from, and `commit` a sha or a
|
|
28
|
+
commit-ish (e.g. `HEAD`) the shell resolves there exactly once. The gate never runs in
|
|
29
|
+
`repository` itself: the shell creates a gate checkout of the resolved sha, and nothing
|
|
30
|
+
uncommitted or gitignored in `repository` reaches the checks.
|
|
31
|
+
|
|
32
|
+
`base` is an optional commit-ish naming the tip of the push's target, resolved in `repository` like
|
|
33
|
+
`commit`. A check that declares `paths` runs only when a file changed between `merge-base(base,
|
|
34
|
+
commit)` and `commit` matches one of them; with no `base`, or one the shell cannot resolve, every
|
|
35
|
+
check runs.
|
|
36
|
+
|
|
37
|
+
Output is `{ envelope, commitSha, predicate, checkOutputs, maxAgeHours }`: `envelope` is the signed
|
|
38
|
+
DSSE envelope, `commitSha` the resolved sha, `predicate` carries the gate's `result` (`"passed"` or
|
|
39
|
+
`"failed"`) and its per-check `checks`, `checkOutputs` carries each check's captured
|
|
40
|
+
`stdout`/`stderr`, and `maxAgeHours` is the gate config's freshness window, for a publisher to
|
|
41
|
+
judge an attestation already published for the same sha.
|
|
42
|
+
|
|
43
|
+
A failed gate (`predicate.result === "failed"`) is a normal, successful outcome of this step — the
|
|
44
|
+
gate ran to completion and was truthfully signed as having failed — so it is returned, not thrown.
|
|
45
|
+
Only a transport or configuration failure (the shell rejecting the request, or an unreachable
|
|
46
|
+
shell) throws.
|
|
47
|
+
|
|
48
|
+
## Environment variables
|
|
49
|
+
|
|
50
|
+
| Variable | Required | Default | Purpose |
|
|
51
|
+
| ------------------------ | -------- | ------- | ------------------------------------------------------------------------------------------------------------ |
|
|
52
|
+
| `LIGETI_ATTEST_KEY` | yes | -- | Secret. The per-app bearer key the shell derived for this worker, sent as `Authorization: Bearer`. |
|
|
53
|
+
| `LIGETI_APP_NAME` | yes | -- | The app name the shell derived `LIGETI_ATTEST_KEY` for. Identity, not a secret. |
|
|
54
|
+
| `LIGETI_PUBLIC_BASE_URL` | yes | -- | The shell's own public base URL that the `POST /attest` request is sent to. Must be `http://` or `https://`. |
|
|
55
|
+
|
|
56
|
+
All three are set by the shell itself (`buildRunEnv`/`AppDeps`), not by a workflow's own `.env`.
|
|
57
|
+
If any is missing, `loadAttestSettings` (`src/settings.ts`) throws saying attestation is not
|
|
58
|
+
configured on this shell, rather than naming the variables as if they were an ordinary missing
|
|
59
|
+
credential.
|
|
60
|
+
|
|
61
|
+
## Retry behaviour
|
|
62
|
+
|
|
63
|
+
The step sets `retry: { maxAttempts: 1 }` deliberately. Running a full gate is expensive (a whole
|
|
64
|
+
lint/typecheck/test suite) and not idempotent in wall-clock terms: a retry after a transient
|
|
65
|
+
failure (a dropped connection, the shell restarting mid-run) would re-run the entire suite from
|
|
66
|
+
scratch rather than resuming it. A failed attempt surfaces as a step failure instead, for a
|
|
67
|
+
workflow to decide whether to re-run `attest.gate` itself.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AttestGateOutput } from "./types.js";
|
|
2
|
+
export interface AttestRequestOptions {
|
|
3
|
+
readonly publicBaseUrl: string;
|
|
4
|
+
readonly attestKey: string;
|
|
5
|
+
readonly app: string;
|
|
6
|
+
readonly repository: string;
|
|
7
|
+
readonly commit: string;
|
|
8
|
+
readonly base?: string;
|
|
9
|
+
readonly configPath?: string;
|
|
10
|
+
readonly signal?: AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
export declare class AttestResponseError extends Error {
|
|
13
|
+
readonly status: number;
|
|
14
|
+
constructor(message: string, status: number);
|
|
15
|
+
}
|
|
16
|
+
export declare function requestAttestation(options: AttestRequestOptions): Promise<AttestGateOutput>;
|
|
17
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAK9C,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAK5C;AAmCD,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA8DjG"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// ABOUTME: Sends the authenticated POST /attest request to the shell and parses its response
|
|
2
|
+
// ABOUTME: into the shapes attest.gate needs, without ever including the bearer key in a thrown error.
|
|
3
|
+
import { Agent, fetch as undiciFetch } from "undici";
|
|
4
|
+
import { AttestGateOutput } from "./types.js";
|
|
5
|
+
// QUIRK(node): undici's headersTimeout defaults to 300 s and global fetch cannot override it, so a long gate needs an explicit dispatcher https://github.com/nodejs/undici/blob/main/docs/docs/api/Client.md
|
|
6
|
+
const ATTEST_DISPATCHER = new Agent({ headersTimeout: 0, bodyTimeout: 0 });
|
|
7
|
+
export class AttestResponseError extends Error {
|
|
8
|
+
status;
|
|
9
|
+
constructor(message, status) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = "AttestResponseError";
|
|
12
|
+
this.status = status;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function isAbort(err, signal) {
|
|
16
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
return signal !== undefined && signal.aborted && err === signal.reason;
|
|
20
|
+
}
|
|
21
|
+
function jsonErrorField(text) {
|
|
22
|
+
let parsed;
|
|
23
|
+
try {
|
|
24
|
+
parsed = JSON.parse(text);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
if (typeof parsed === "object" && parsed !== null && "error" in parsed) {
|
|
30
|
+
const error = parsed.error;
|
|
31
|
+
if (typeof error === "string") {
|
|
32
|
+
return error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
async function readErrorDetail(response) {
|
|
38
|
+
const text = await response.text();
|
|
39
|
+
if (text.length === 0) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
return jsonErrorField(text) ?? text;
|
|
43
|
+
}
|
|
44
|
+
export async function requestAttestation(options) {
|
|
45
|
+
const url = new URL("/attest", options.publicBaseUrl);
|
|
46
|
+
const body = {
|
|
47
|
+
app: options.app,
|
|
48
|
+
repository: options.repository,
|
|
49
|
+
commit: options.commit,
|
|
50
|
+
...(options.base !== undefined ? { base: options.base } : {}),
|
|
51
|
+
...(options.configPath !== undefined ? { configPath: options.configPath } : {}),
|
|
52
|
+
};
|
|
53
|
+
const init = {
|
|
54
|
+
method: "POST",
|
|
55
|
+
headers: {
|
|
56
|
+
"Content-Type": "application/json",
|
|
57
|
+
Authorization: `Bearer ${options.attestKey}`,
|
|
58
|
+
},
|
|
59
|
+
body: JSON.stringify(body),
|
|
60
|
+
dispatcher: ATTEST_DISPATCHER,
|
|
61
|
+
};
|
|
62
|
+
if (options.signal !== undefined) {
|
|
63
|
+
init.signal = options.signal;
|
|
64
|
+
}
|
|
65
|
+
let response;
|
|
66
|
+
try {
|
|
67
|
+
response = await undiciFetch(url, init);
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
if (isAbort(err, options.signal)) {
|
|
71
|
+
throw err;
|
|
72
|
+
}
|
|
73
|
+
throw new Error("attest.gate: POST /attest failed", { cause: err });
|
|
74
|
+
}
|
|
75
|
+
if (!response.ok) {
|
|
76
|
+
const detail = await readErrorDetail(response);
|
|
77
|
+
const suffix = detail !== undefined ? `: ${detail}` : "";
|
|
78
|
+
throw new AttestResponseError(`attest.gate: POST /attest returned ${String(response.status)}${suffix}`, response.status);
|
|
79
|
+
}
|
|
80
|
+
const text = await response.text();
|
|
81
|
+
let json;
|
|
82
|
+
try {
|
|
83
|
+
json = JSON.parse(text);
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
throw new Error("attest.gate: /attest returned a 200 response with a non-JSON body", {
|
|
87
|
+
cause: err,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
const parsed = AttestGateOutput.safeParse(json);
|
|
91
|
+
if (!parsed.success) {
|
|
92
|
+
throw new Error(`attest.gate: /attest returned a 200 response that did not match the expected shape: ` +
|
|
93
|
+
parsed.error.issues
|
|
94
|
+
.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`)
|
|
95
|
+
.join("; "));
|
|
96
|
+
}
|
|
97
|
+
return parsed.data;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,uGAAuG;AACvG,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,6MAA6M;AAC7M,MAAM,iBAAiB,GAAG,IAAI,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC,CAAC;AAa3E,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACnC,MAAM,CAAS;IAExB,YAAY,OAAe,EAAE,MAAc;QACzC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,SAAS,OAAO,CAAC,GAAY,EAAE,MAA+B;IAC5D,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,IAAI,GAAG,KAAK,MAAM,CAAC,MAAM,CAAC;AACzE,CAAC;AAED,SAAS,cAAc,CAAC,IAAY;IAClC,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KA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AE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,mEAAmE,EAAE;YACnF,KAAK,EAAE,GAAG;SACX,CAAC,CAAC;IACL,CAAC;IAED,MAAM,MAAM,GAAG,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAChD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,sFAAsF;YACpF,MAAM,CAAC,KAAK,CAAC,MAAM;iBAChB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;iBACvE,IAAI,CAAC,IAAI,CAAC,CAChB,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
|
package/dist/gate.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAI9D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE/D,eAAO,MAAM,UAAU,EAAE,cAAc,CAAC,OAAO,eAAe,EAAE,OAAO,gBAAgB,CAoCnF,CAAC"}
|
package/dist/gate.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// ABOUTME: attest.gate, the step that asks the shell to run and sign a repository's gate and
|
|
2
|
+
// ABOUTME: returns the DSSE envelope for a publisher step to hand off, never signing anything itself.
|
|
3
|
+
import { defineStep } from "@ligeti/sdk";
|
|
4
|
+
import pkg from "../package.json" with { type: "json" };
|
|
5
|
+
import { requestAttestation } from "./client.js";
|
|
6
|
+
import { loadAttestSettings } from "./settings.js";
|
|
7
|
+
import { AttestGateInput, AttestGateOutput } from "./types.js";
|
|
8
|
+
export const attestGate = defineStep({
|
|
9
|
+
name: "attest.gate",
|
|
10
|
+
envVars: {},
|
|
11
|
+
description: "Asks the shell to run and sign the gate for one commit of the target repository, in a " +
|
|
12
|
+
"fresh gate checkout, returning the DSSE envelope, the gate verdict, and the captured " +
|
|
13
|
+
"check output.",
|
|
14
|
+
package: { name: pkg.name, version: pkg.version },
|
|
15
|
+
input: AttestGateInput,
|
|
16
|
+
output: AttestGateOutput,
|
|
17
|
+
retry: { maxAttempts: 1 },
|
|
18
|
+
async run(sctx, input) {
|
|
19
|
+
const settings = loadAttestSettings();
|
|
20
|
+
const result = await requestAttestation({
|
|
21
|
+
publicBaseUrl: settings.publicBaseUrl,
|
|
22
|
+
attestKey: settings.attestKey,
|
|
23
|
+
app: settings.appName,
|
|
24
|
+
repository: input.repository,
|
|
25
|
+
commit: input.commit,
|
|
26
|
+
...(input.base !== undefined ? { base: input.base } : {}),
|
|
27
|
+
...(input.configPath !== undefined ? { configPath: input.configPath } : {}),
|
|
28
|
+
signal: sctx.signal,
|
|
29
|
+
});
|
|
30
|
+
sctx.logger.info("attest.gate: gate finished", {
|
|
31
|
+
app: settings.appName,
|
|
32
|
+
repository: input.repository,
|
|
33
|
+
commitSha: result.commitSha,
|
|
34
|
+
result: result.predicate.result,
|
|
35
|
+
});
|
|
36
|
+
return result;
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=gate.js.map
|
package/dist/gate.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.js","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,sGAAsG;AACtG,OAAO,EAAE,UAAU,EAAuB,MAAM,aAAa,CAAC;AAC9D,OAAO,GAAG,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,kBAAkB,E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AAE,MAAM,CAAC,SAAS;YAC3B,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM;SAChC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,WAAW,EACX,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// ABOUTME: Public entry point of @ligeti/step-attest: the attest.gate step, its input/output
|
|
2
|
+
// ABOUTME: schemas and types, and the error thrown for a non-2xx /attest response.
|
|
3
|
+
export { attestGate } from "./gate.js";
|
|
4
|
+
export { AttestGateInput, AttestGateOutput, Envelope, GatePredicate, CheckResult, CheckOutput, } from "./types.js";
|
|
5
|
+
export { AttestResponseError } from "./client.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,mFAAmF;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,WAAW,EACX,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "@ligeti/sdk";
|
|
2
|
+
export declare const settingsSchema: z.ZodObject<{
|
|
3
|
+
LIGETI_ATTEST_KEY: z.ZodString;
|
|
4
|
+
LIGETI_APP_NAME: z.ZodString;
|
|
5
|
+
LIGETI_PUBLIC_BASE_URL: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export interface AttestSettings {
|
|
8
|
+
readonly attestKey: string;
|
|
9
|
+
readonly appName: string;
|
|
10
|
+
readonly publicBaseUrl: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function loadAttestSettings(env?: NodeJS.ProcessEnv): AttestSettings;
|
|
13
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,CAAC,EAAE,MAAM,aAAa,CAAC;AAWtD,eAAO,MAAM,cAAc;;;;iBAQzB,CAAC;AAEH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,cAAc,CAcvF"}
|
package/dist/settings.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// ABOUTME: @ligeti/step-attest settings loaded from the environment: the bearer key, the app name
|
|
2
|
+
// ABOUTME: it was derived for, and the shell's public base URL.
|
|
3
|
+
import { defineSettingsSchema, z } from "@ligeti/sdk";
|
|
4
|
+
function isHttpUrl(value) {
|
|
5
|
+
try {
|
|
6
|
+
const url = new URL(value);
|
|
7
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export const settingsSchema = defineSettingsSchema({
|
|
14
|
+
LIGETI_ATTEST_KEY: z.string().min(1).meta({ sensitivity: "secret" }),
|
|
15
|
+
LIGETI_APP_NAME: z.string().min(1).meta({ sensitivity: "public" }),
|
|
16
|
+
LIGETI_PUBLIC_BASE_URL: z
|
|
17
|
+
.string()
|
|
18
|
+
.min(1)
|
|
19
|
+
.refine(isHttpUrl, "must be an http:// or https:// URL")
|
|
20
|
+
.meta({ sensitivity: "public" }),
|
|
21
|
+
});
|
|
22
|
+
export function loadAttestSettings(env = process.env) {
|
|
23
|
+
const result = settingsSchema.safeParse(env);
|
|
24
|
+
if (!result.success) {
|
|
25
|
+
throw new Error("attest.gate: attestation is not configured on this shell -- LIGETI_ATTEST_KEY, " +
|
|
26
|
+
"LIGETI_APP_NAME, and LIGETI_PUBLIC_BASE_URL must all be set in the worker's environment " +
|
|
27
|
+
"(the shell sets these itself when it has a signing key configured; see README.md)");
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
attestKey: result.data.LIGETI_ATTEST_KEY,
|
|
31
|
+
appName: result.data.LIGETI_APP_NAME,
|
|
32
|
+
publicBaseUrl: result.data.LIGETI_PUBLIC_BASE_URL,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,gEAAgE;AAChE,OAAO,EAAE,oBAAoB,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEtD,SAAS,SAAS,CAAC,KAAa;IAC9B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,oBAAoB,CAAC;IACjD,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;IACpE,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;IAClE,sBAAsB,EAAE,CAAC;SACtB,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,MAAM,CAAC,SAAS,EAAE,oCAAoC,CAAC;SACvD,IAAI,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;CACnC,CAAC,CAAC;AAQH,MAAM,UAAU,kBAAkB,CAAC,MAAyB,OAAO,CAAC,GAAG;IACrE,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,iFAAiF;YAC/E,0FAA0F;YAC1F,mFAAmF,CACtF,CAAC;IACJ,CAAC;IACD,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,iBAAiB;QACxC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,eAAe;QACpC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,sBAAsB;KAClD,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { z } from "@ligeti/sdk";
|
|
2
|
+
export declare const AttestGateInput: z.ZodObject<{
|
|
3
|
+
repository: z.ZodString;
|
|
4
|
+
commit: z.ZodString;
|
|
5
|
+
base: z.ZodOptional<z.ZodString>;
|
|
6
|
+
configPath: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
export type AttestGateInput = z.infer<typeof AttestGateInput>;
|
|
9
|
+
export declare const Envelope: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
10
|
+
export type Envelope = z.infer<typeof Envelope>;
|
|
11
|
+
export declare const CheckResult: z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
status: z.ZodEnum<{
|
|
14
|
+
passed: "passed";
|
|
15
|
+
failed: "failed";
|
|
16
|
+
skipped_unmet_prerequisites: "skipped_unmet_prerequisites";
|
|
17
|
+
skipped_not_applicable: "skipped_not_applicable";
|
|
18
|
+
}>;
|
|
19
|
+
required: z.ZodBoolean;
|
|
20
|
+
exitCode: z.ZodNullable<z.ZodNumber>;
|
|
21
|
+
durationMs: z.ZodNumber;
|
|
22
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$loose>;
|
|
24
|
+
export type CheckResult = z.infer<typeof CheckResult>;
|
|
25
|
+
export declare const GatePredicate: z.ZodObject<{
|
|
26
|
+
result: z.ZodEnum<{
|
|
27
|
+
passed: "passed";
|
|
28
|
+
failed: "failed";
|
|
29
|
+
}>;
|
|
30
|
+
mergeBase: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
status: z.ZodEnum<{
|
|
34
|
+
passed: "passed";
|
|
35
|
+
failed: "failed";
|
|
36
|
+
skipped_unmet_prerequisites: "skipped_unmet_prerequisites";
|
|
37
|
+
skipped_not_applicable: "skipped_not_applicable";
|
|
38
|
+
}>;
|
|
39
|
+
required: z.ZodBoolean;
|
|
40
|
+
exitCode: z.ZodNullable<z.ZodNumber>;
|
|
41
|
+
durationMs: z.ZodNumber;
|
|
42
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$loose>>;
|
|
44
|
+
}, z.core.$loose>;
|
|
45
|
+
export type GatePredicate = z.infer<typeof GatePredicate>;
|
|
46
|
+
export declare const CheckOutput: z.ZodObject<{
|
|
47
|
+
id: z.ZodString;
|
|
48
|
+
stdout: z.ZodString;
|
|
49
|
+
stderr: z.ZodString;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
export type CheckOutput = z.infer<typeof CheckOutput>;
|
|
52
|
+
export declare const AttestGateOutput: z.ZodObject<{
|
|
53
|
+
envelope: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
54
|
+
commitSha: z.ZodString;
|
|
55
|
+
predicate: z.ZodObject<{
|
|
56
|
+
result: z.ZodEnum<{
|
|
57
|
+
passed: "passed";
|
|
58
|
+
failed: "failed";
|
|
59
|
+
}>;
|
|
60
|
+
mergeBase: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
62
|
+
id: z.ZodString;
|
|
63
|
+
status: z.ZodEnum<{
|
|
64
|
+
passed: "passed";
|
|
65
|
+
failed: "failed";
|
|
66
|
+
skipped_unmet_prerequisites: "skipped_unmet_prerequisites";
|
|
67
|
+
skipped_not_applicable: "skipped_not_applicable";
|
|
68
|
+
}>;
|
|
69
|
+
required: z.ZodBoolean;
|
|
70
|
+
exitCode: z.ZodNullable<z.ZodNumber>;
|
|
71
|
+
durationMs: z.ZodNumber;
|
|
72
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
73
|
+
}, z.core.$loose>>;
|
|
74
|
+
}, z.core.$loose>;
|
|
75
|
+
checkOutputs: z.ZodArray<z.ZodObject<{
|
|
76
|
+
id: z.ZodString;
|
|
77
|
+
stdout: z.ZodString;
|
|
78
|
+
stderr: z.ZodString;
|
|
79
|
+
}, z.core.$strict>>;
|
|
80
|
+
maxAgeHours: z.ZodNumber;
|
|
81
|
+
}, z.core.$strict>;
|
|
82
|
+
export type AttestGateOutput = z.infer<typeof AttestGateOutput>;
|
|
83
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,eAAO,MAAM,eAAe;;;;;kBAOjB,CAAC;AACZ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,eAAO,MAAM,QAAQ,wCAAoC,CAAC;AAC1D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,eAAO,MAAM,WAAW;;;;;;;;;;;;iBASd,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;iBAMhB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,eAAO,MAAM,WAAW;;;;kBAMb,CAAC;AACZ,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAQlB,CAAC;AACZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// ABOUTME: Shared zod schemas for attest.gate: its input and its output, including the DSSE envelope
|
|
2
|
+
// ABOUTME: and gate-predicate shapes of the shell's /attest response, declared locally.
|
|
3
|
+
import { z } from "@ligeti/sdk";
|
|
4
|
+
export const AttestGateInput = z
|
|
5
|
+
.object({
|
|
6
|
+
repository: z.string().min(1),
|
|
7
|
+
commit: z.string().min(1),
|
|
8
|
+
base: z.string().min(1).optional(),
|
|
9
|
+
configPath: z.string().min(1).optional(),
|
|
10
|
+
})
|
|
11
|
+
.strict();
|
|
12
|
+
export const Envelope = z.record(z.string(), z.unknown());
|
|
13
|
+
export const CheckResult = z
|
|
14
|
+
.object({
|
|
15
|
+
id: z.string(),
|
|
16
|
+
status: z.enum(["passed", "failed", "skipped_unmet_prerequisites", "skipped_not_applicable"]),
|
|
17
|
+
required: z.boolean(),
|
|
18
|
+
exitCode: z.number().int().nullable(),
|
|
19
|
+
durationMs: z.number().int().nonnegative(),
|
|
20
|
+
detail: z.string().optional(),
|
|
21
|
+
})
|
|
22
|
+
.loose();
|
|
23
|
+
export const GatePredicate = z
|
|
24
|
+
.object({
|
|
25
|
+
result: z.enum(["passed", "failed"]),
|
|
26
|
+
mergeBase: z.string().nullable().optional(),
|
|
27
|
+
checks: z.array(CheckResult).min(1),
|
|
28
|
+
})
|
|
29
|
+
.loose();
|
|
30
|
+
export const CheckOutput = z
|
|
31
|
+
.object({
|
|
32
|
+
id: z.string(),
|
|
33
|
+
stdout: z.string(),
|
|
34
|
+
stderr: z.string(),
|
|
35
|
+
})
|
|
36
|
+
.strict();
|
|
37
|
+
export const AttestGateOutput = z
|
|
38
|
+
.object({
|
|
39
|
+
envelope: Envelope,
|
|
40
|
+
commitSha: z.string(),
|
|
41
|
+
predicate: GatePredicate,
|
|
42
|
+
checkOutputs: z.array(CheckOutput),
|
|
43
|
+
maxAgeHours: z.number().positive(),
|
|
44
|
+
})
|
|
45
|
+
.strict();
|
|
46
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,wFAAwF;AACxF,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,CAAC;IACN,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,MAAM,EAAE,CAAC,CAAC,MAAM,EA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C;AAGX,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC;KACzB,MAAM,CAAC;IACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,CAAC;IACN,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,aAAa;IACxB,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;IAClC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC;KACD,MAAM,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ligeti/step-attest",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"description": "Ligeti step package: asks the shell to run and sign a repository's gate, returning the DSSE envelope.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://gitlab.com/nagyv-projects/ligeti.git",
|
|
10
|
+
"directory": "steps/attest"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"undici": "^8.10.2"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@ligeti/sdk": "^2.2.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@ligeti/sdk": "2.2.0",
|
|
29
|
+
"@ligeti/testing": "2.0.4"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {}
|
|
6
32
|
}
|