Skip to content

Auth correctness: SHA-512-256 digest, CORS expose WWW-Authenticate, basic-auth POST #15

Closed

Description

@s3anw3

Issue Background

Three auth correctness items:

  • postmanlabs/httpbin#697 — Digest authentication algorithm parameter: add SHA-512-256 (RFC 7616) alongside MD5/SHA-256/SHA-512.
  • postmanlabs/httpbin#641 — Expose WWW-Authenticate to CORS: browsers can't read the WWW-Authenticate response header from a 401 because the CORS config doesn't expose it.
  • postmanlabs/httpbin#365 / postmanlabs/httpbin#607 — POST not allowed in basic auth: /basic-auth and /hidden-basic-auth are GET-only; clients that POST credentials get 405.

Expected Solution

  1. (#697) Accept SHA-512-256 as the digest algorithm (route + validation). Refactor calculate_digest_response to use a single digest_hash_hex helper (removing the 5× duplicated algorithm match arms) that supports MD5, SHA-256, SHA-512, and SHA-512-256 (sha2::Sha512_256).
  2. (#641) Add expose_header("WWW-Authenticate") to the CORS middleware so browser clients can read the challenge.
  3. (#365/#607) Register POST routes for /basic-auth/{user}/{passwd}, /basic-auth/{user}, /hidden-basic-auth/{user}/{passwd}, /hidden-basic-auth/{user} (handlers are method-agnostic).

Benefits

  • Full RFC 7616 algorithm coverage for digest-auth testing.
  • Browser-side digest-auth flows work (WWW-Authenticate visible to JS).
  • Basic/hidden-basic auth testable over POST.

(#592 qop-omission deferred — it touches ~10 challenge-generation sites across 3 handlers and is niche RFC-2069-legacy testing; tracked separately.)

Activity

  1. added a commit that references this issue on Aug 11, 2026
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions