Skip to content

Add convenience helper for associated-request derived components #21

Description

@yaronf

Summary

Response signatures often need to cover request-derived components using the ;req parameter (RFC 9421 §2.2.2), e.g. @method;req, @path;req, @query;req.

Today this requires AddHeaderExt with four booleans:

fields.AddHeaderExt("@method", false, false, true, false).
    AddHeaderExt("@path", false, false, true, false).
    AddHeaderExt("@query", false, false, true, false)

The signature is (optional, binarySequence, associatedRequest, trailer). For the WIMSE HTTP-Sig response case, associatedRequest=true and optional=false — these components are required, not optional.

Proposal

Add a convenience method:

// AddRequestComponent adds a required derived component from the associated request (sets ;req).
func (fs *Fields) AddRequestComponent(name string) *Fields

Usage:

fields.AddHeaders("@status", "workload-identity-token").
    AddHeaderOptional("Content-Type").
    AddHeaderOptional("Content-Digest").
    AddRequestComponent("@method").
    AddRequestComponent("@path").
    AddRequestComponent("@query")

Equivalent to:

AddHeaderExt(name, false, false, true, false)

No optional variant is proposed: WIMSE (and typical response-binding profiles) require these components whenever the response is signed. Optional coverage applies to headers like Content-Type / Content-Digest (AddHeaderOptional), not to @method;req / @path;req / @query;req.

Motivation

  • Reduces caller mistakes (easy to get the four booleans wrong).
  • Makes the required-vs-optional distinction explicit at the call site.
  • WIMSE HTTP-Sig response signing uses this pattern for every signed response.

Related consumer: https://github.com/yaronf/wimse-s2s-doc

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions