wpsign

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package wpsign verifies Woodpecker's RFC-9421 HTTP Message Signature on incoming secret-extension requests (SPEC §5, WP§8). This is the single most security-load-bearing unit in ironbark: nothing in a request is trusted — including the payload used to derive Vault policy — unless Verify returns nil.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Verify

func Verify(r *http.Request, body []byte, pub ed25519.PublicKey, window time.Duration, now func() time.Time) error

Verify checks r's RFC-9421 signature (named "woodpecker-ci-extensions", matching Woodpecker's own signer [WP§8]) against pub. It requires:

  • a Signature and Signature-Input header;
  • covered components including @request-target and content-digest;
  • a Content-Digest header whose RFC-9530 sha-256 digest matches body (the actual bytes the caller received — checked independently of the signing library, which does not itself validate the header against a body);
  • a valid Ed25519 signature under pub;
  • a "created" signature parameter within window of now().

Contract: body MUST be the exact bytes the caller treats as r's payload. The Content-Digest check is recomputed over body, not read from r.Body — r.Body is never touched by Verify — so the caller is responsible for passing the same bytes it will later hand to identity.Parse.

Returns nil on success, else a *VerifyError. now is injected so callers can test freshness deterministically; production passes time.Now.

Types

type Reason

type Reason string

Reason is the signature-verification failure taxonomy (SPEC §5): each value is its own metrics label and audit-log reason. Never derived from or carrying payload data.

const (
	ReasonMissingSignature   Reason = "missing_signature"
	ReasonUnparseable        Reason = "unparseable"
	ReasonWrongKey           Reason = "wrong_key"
	ReasonDigestMismatch     Reason = "digest_mismatch"
	ReasonUncoveredComponent Reason = "uncovered_component"
	ReasonMissingCreated     Reason = "missing_created"
	ReasonStaleCreated       Reason = "stale_created"
)

type VerifyError

type VerifyError struct {
	Reason Reason
	Err    error
}

VerifyError is returned by Verify on any rejection. Err, when non-nil, wraps the underlying library error for diagnostics; neither it nor Reason ever carries request/payload data (SPEC §5, §8.1).

func (*VerifyError) Error

func (e *VerifyError) Error() string

func (*VerifyError) Unwrap

func (e *VerifyError) Unwrap() error

Directories

Path Synopsis
Package wpsigntest is a test-only signer that mirrors Woodpecker's RFC-9421 extension-request signature [WP§8] so internal/wpsign.Verify can be exercised against a faithful, byte-compatible signature without a real Woodpecker server.
Package wpsigntest is a test-only signer that mirrors Woodpecker's RFC-9421 extension-request signature [WP§8] so internal/wpsign.Verify can be exercised against a faithful, byte-compatible signature without a real Woodpecker server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址