zuke.tools.signpath
@zuke/signpath 1.0.0: @zuke/signpath — Authenticode signing through [SignPath](https://about.signpath.io) from Zuke builds, and signtool verify to check the result.
zuke on PyPI ↗ 8 symbols
Symbols
class SignPathConnectionSettings(Settings) The connection half of every SignPath call's settings.
-
organization_id(id: str) -> SelfThe SignPath organization id — the GUID in the web app's URLs and under *Organization settings*. Defaults to the
SIGNPATH_ORGANIZATION_IDenvironment variable. -
api_token(token: str) -> SelfThe API token of a SignPath user with submitter permission on the project's signing policy, sent as
Authorization: Bearer <token>. Defaults to theSIGNPATH_API_TOKENenvironment variable. The token never reaches a progress line or an error message: every message this package builds is scrubbed of it. Declare it in the build as aparameter(...).secret()so Zuke masks it in its own output too. -
api_url(url: str) -> SelfThe REST API's base URL,
https://app.signpath.io/Apiby default; the version and organization (/v1/<org>/…) are appended. It carries the token, so it must behttps:unless it is loopback orZUKE_ALLOW_INSECURE_URLis set. The web app's links in errors and progress lines use the same origin (<origin>/Web/<org>/…). -
request_timeout(duration: str | float) -> SelfAbort one API call after this long (
"30s", or ms); default one minute. -
download_timeout(duration: str | float) -> SelfAbort a signed-artifact download that has not finished after this long (
"10m", or ms); default five minutes. -
max_download_bytes(bytes: float) -> SelfRefuse a signed artifact larger than this many bytes; default 2 GiB.
-
retries(count: float) -> SelfRetry a transient failure this many times (default 3), with a doubling delay from one second. A status poll or a download is retried after a network error, a timeout, or HTTP 429, 502, 503 or 504; a submission only after 429 or 503, the answers that say the request was not processed, so a retry cannot create a second signing request.
class SignPathDownloadSettings(SignPathStatusSettings) Settings for SignPathTasks.download: the connection, the signing request's id, and where to write the signed artifact.
-
output(path: str) -> SelfThe file to write the signed artifact to; its directory is created when missing, and an existing file is replaced. Required.
class SignPathGitHubOriginSettings(Settings) Where the artifact to sign lives in GitHub Actions. Only the artifact id is required: the run, repository and token default to the workflow's own environment (GITHUB_RUN_ID, GITHUB_REPOSITORY, GITHUB_TOKEN).
`ts await SignPathTasks.submit((s) => s.projectSlug("zuke").signingPolicySlug("release-signing") .gitHubOrigin((g) => g.artifactId(artifactId).token(githubToken)) .output("dist/signed/zuke.zip") ); `
-
artifact_id(id: str | float) -> SelfThe id of the artifact
actions/upload-artifact(v4 or later) uploaded — itsartifact-idstep output. Required. -
run_id(id: str | float) -> SelfThe workflow run the artifact belongs to; defaults to
GITHUB_RUN_ID. -
repository(name: str) -> SelfThe repository,
owner/name; defaults toGITHUB_REPOSITORY. -
token(value: str) -> SelfThe GitHub token the connector reads the run and downloads the artifact with — the workflow's
GITHUB_TOKEN(withactions: readandcontents: read) is enough. Defaults to theGITHUB_TOKENenvironment variable. It is masked out of every message, like the API token. The workflow's own token stops working when the workflow ends, so the task must wait for SignPath to fetch the artifact;submitalways waits. -
connector_url(url: str) -> SelfThe SignPath GitHub connector to submit through; SignPath's hosted GitHub.com one by default. Only a self-hosted GitHub Enterprise Server needs another. It carries the API token, so it must be
https:.
class SignPathStatusSettings(SignPathConnectionSettings) Settings for SignPathTasks.status: the connection and the request's id.
-
signing_request_id(id: str) -> SelfThe signing request to read — the GUID
submitreturned. Required.
class SignPathSubmitSettings(SignPathConnectionSettings) Settings for SignPathTasks.submit.
-
project_slug(slug: str) -> SelfThe SignPath project's slug. Required.
-
signing_policy_slug(slug: str) -> SelfThe signing policy's slug, such as
release-signing— it decides the certificate and whether an approver must sign off. Required. -
artifact_configuration_slug(slug: str) -> SelfThe artifact configuration's slug — which files inside the artifact are signed, and how. The project's default configuration when unset.
-
description(text: str) -> SelfA description shown on the request, such as the version being released.
-
parameter(name: str, value: str) -> SelfA user-defined parameter the artifact configuration reads (a version number to stamp, say). Names are letters, digits,
.,-and_. Repeatable. -
artifact(path: str) -> SelfUpload this local file as the artifact (
SubmitWithArtifact). Exactly one ofartifactand gitHubOrigin is required. SignPath's open-source programme accepts only builds whose origin it can verify, so for it use gitHubOrigin instead. -
git_hub_origin(configure: Callable[[SignPathGitHubOriginSettings], SignPathGitHubOriginSettings]) -> SelfHave SignPath fetch the artifact from a GitHub Actions workflow run and verify its origin. Exactly one of artifact and
gitHubOriginis required. -
output(path: str) -> SelfDownload the signed artifact to this file once the request completes; its directory is created when missing. Without it,
submitonly waits. -
timeout(duration: str | float) -> SelfFail with a
SignPathTimeoutErrorwhen the request is not final after this long ("30m", or ms); default ten minutes. A policy that needs a manual approval wants longer. -
poll_interval(duration: str | float) -> SelfPoll the request's status this often (
"5s", or ms; at least one second); default ten seconds.
class SignPathTasks Typed task functions for SignPath's code-signing service.
-
static async submit(ctx: ServiceContext, configure: Callable[[SignPathSubmitSettings], SignPathSubmitSettings]) -> objectSubmit a signing request, wait for it to complete, and — with
.output(path)— download the signed artifact. `ts const { signingRequestId } = await SignPathTasks.submit((s) => s.organizationId(orgId).apiToken(token) .projectSlug("zuke").signingPolicySlug("release-signing") .gitHubOrigin((g) => g.artifactId(artifactId)) .timeout("30m").output("dist/signed/zuke.zip") );` -
static async status(ctx: ServiceContext, configure: Callable[[SignPathStatusSettings], SignPathStatusSettings]) -> objectRead a signing request's status once — no waiting. `
ts const { status } = await SignPathTasks.status((s) => s.signingRequestId(id) );` -
static async download(ctx: ServiceContext, configure: Callable[[SignPathDownloadSettings], SignPathDownloadSettings]) -> objectDownload a completed signing request's signed artifact. `
ts await SignPathTasks.download((s) => s.signingRequestId(id).output("dist/signed/zuke.exe") );`
class SigntoolTasks Typed task functions for the Windows SDK's signtool.
-
static async verify(ctx: ServiceContext, configure: Callable[[SigntoolVerifySettings], SigntoolVerifySettings]) -> ExecResultCheck a file's Authenticode signature with
signtool verify; a file that is unsigned or fails the policy exits non-zero, which throws unless.noThrow()is set.
class SigntoolVerifySettings(ToolSettings) Settings for signtool verify.
-
authenticode_policy() -> SelfVerify against the default Authenticode policy (
/pa) — what a signed.exeor.msineeds. Without itsigntoolapplies the Windows driver policy and rejects ordinary code-signing certificates. -
kernel_policy() -> SelfVerify against the kernel-mode driver signing policy (
/kp). -
policy(guid: str) -> SelfVerify against the policy with this GUID (
/pg). -
all_signatures() -> SelfVerify every signature of a file that carries several (
/all). -
signature_index(index: float) -> SelfVerify only the signature at this index, from 0 (
/ds). -
hash(algorithm: Literal['SHA1', 'SHA256']) -> SelfLook the file up in a catalog only for this digest algorithm (
/hash). -
catalog(path: str) -> SelfVerify against this catalog file (
/c). -
root_subject_name(name: str) -> SelfRequire the signing certificate to chain to a root whose subject name contains this text (
/r). -
timestamp_warning() -> SelfWarn when the signature is not timestamped (
/tw). -
description() -> SelfPrint the signature's description and URL (
/d). -
verbose() -> SelfPrint the signer, the chain and the timestamp (
/v). -
debug() -> SelfPrint debugging information (
/debug). -
file(*paths: str) -> SelfThe files to verify (positional), at least one. A relative path that starts with
-is passed as./-…so it cannot be read as an option; one that starts with/is refused, sincesigntoolwould read it as an option and on Windows it means the current drive's root — give a drive-qualified or a relative path instead.