Repository navigation
Conversation
notroj
marked this pull request as draft
November 2, 2026 17:48
(initialize_module): Correct the description of the client table's lifetime. (note_digest_auth_failure): An unknown client is not necessarily one whose entry was garbage collected. No functional change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> GitHub: PR apache#730 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1937709 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit 6f5f7ea)
mod_auth_digest: Don't reuse client ids across a restart: * modules/aaa/mod_auth_digest.c (initialize_tables): Seed the client ids randomly for each shared memory segment. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> GitHub: PR apache#730 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1937711 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit f4c4160)
* modules/aaa/mod_auth_digest.c: Raise the default AuthDigestShmemSize to 8192 bytes, holding around 140 clients. * docs/manual/mod/mod_auth_digest.xml: Document the new default. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> GitHub: PR apache#730 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1937712 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit 8e3c9de)
* modules/aaa/mod_auth_digest.c (gc): Discard the entries of clients which have never authenticated before the least recently used. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> GitHub: PR apache#730 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1937713 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit 57968c0)
assignment to client_key which is never read, and the qop variable which only ever holds one string. No functional change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> GitHub: PR apache#730 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1937715 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit 0f49205)
mod_auth_digest: Use siphash for the nonce hash where available: * modules/aaa/mod_auth_digest.c (gen_nonce_hash): Use apr_siphash24_auth() where APU 1.6 or later provides it, keeping the SHA-1 hash otherwise. Take a pool for the message buffer, and length-prefix the realm. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> GitHub: closes apache#730 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1937716 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit 8be3ef8)
mod_auth_digest: Keep Authentication-Info on error responses. * modules/aaa/mod_auth_digest.c (add_auth_info): Add the (Proxy-)Authentication-Info header to err_headers_out, so a one-time nonce client gets its nextnonce after an error response rather than a stale re-challenge. (note_digest_auth_failure): Drop any (Proxy-)Authentication-Info when issuing a challenge, so a post-authentication 401 carries only the fresh nonce. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> GitHub: closes PR apache#739 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1937888 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit 6aa1bce)
Followup for 6aa1bce on windows this close apache#745 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938032 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit 3ffb2be)
client_list struct; no functional change intended. * modules/aaa/mod_auth_digest.c (struct hash_table): Add next_id field; note that all access must be inside client_lock. (client_id_counter): Remove global. (initialize_tables): Seed client_list->next_id rather than allocating and seeding client_id_counter. (add_client): Remove, merging into... (client_generate): ...here; issue the id from client_list->next_id inside client_lock rather than via atomics, and log allocation failure. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> GitHub: PR apache#787 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939030 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit 95a7548)
mod_auth_digest: Widen client ids to 64 bits: * modules/aaa/mod_auth_digest.c (client_id_t): Widen to apr_uint64_t. (CLIENT_ID_MAX): New. (initialize_tables): Cap the seed at CLIENT_ID_MAX. (client_generate): Issue ids in 1..CLIENT_ID_MAX. (client_exists, client_update_nonce, client_generate): Log ids with APR_UINT64_T_FMT. (parse_digest_header): Parse the opaque with apr_strtoi64(), returning INVALID if it is not in 1..CLIENT_ID_MAX. (authenticate_digest_user): Remove the now-unreachable invalid opaque check (AH01787); mention an invalid opaque in AH01782. (ltox): Rename to... (client_id_to_opaque): ...this; format with APR_UINT64_T_HEX_FMT. (note_digest_auth_failure): Update callers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> GitHub: PR apache#787 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939031 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit 6838b98)
mod_auth_digest: Fix handling of a request with no per-request record: The per-request record is created in a post_read_request hook, which does not run for a request rejected earlier (e.g. no Host on HTTP/1.1). An ErrorDocument directing such a request into a Digest-protected location then reached the auth hooks, which walked ->prev to the original request and used its record without checking it had been created. * modules/aaa/mod_auth_digest.c (make_digest_rec): New, split from init_digest_request, storing the record on a given request. (get_digest_rec): New; walk to the shared record and create it if the originating request never ran init_digest_request. (authenticate_digest_user, hook_note_digest_auth_failure): Use it in place of the open-coded walk, which did not check for a missing record. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> GitHub: PR apache#787 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939032 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit 18309c6)
mod_auth_digest: Validate the nonce-count when parsing the header: * modules/aaa/mod_auth_digest.c (digest_header_rec): Add nc, the parsed nonce-count. (parse_digest_header): Require nc to be 8 hex digits (RFC 7616 3.4) and store its value, so it is well-formed everywhere it is used or echoed. (check_and_record_nonce): Use the parsed value; drop the local strtol and the now-unreachable AH01773. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> GitHub: PR apache#787 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939033 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit 4843e52)
…esolved in modules/aaa/mod_auth_digest.c): mod_auth_digest: Reject an Authorization uri which fails to unescape: * modules/aaa/mod_auth_digest.c (copy_uri_components): Return the ap_unescape_url status rather than discarding it. (authenticate_digest_user): Fail the request when the request-target or the Authorization uri does not unescape. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> GitHub: PR apache#787 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939034 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit ecdf990)
mod_auth_digest: Send Digest domain= for a reverse-proxied request: The domain was suppressed for any proxy request, but a reverse-proxied request authenticates to this server with an origin-style WWW-Authenticate, so AuthDigestDomain applies to it as it does to a non-proxied request; only a forward-proxy (PROXYREQ_PROXY) request, whose challenge is Proxy-Authenticate, should omit it. * modules/aaa/mod_auth_digest.c (note_digest_auth_failure): Suppress domain= only for PROXYREQ_PROXY, matching the rest of the file. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> GitHub: PR apache#787 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939035 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit 288f737)
mod_auth_digest: Validate AuthDigestShmemSize properly: * modules/aaa/mod_auth_digest.c (set_shmem_size): Parse with apr_strtoff, reject overflow and trailing junk, and require room for the table, the counter, and at least one entry including rmm overhead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> GitHub: PR apache#787 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939036 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit df14898)
change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> GitHub: PR apache#787 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939037 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit c2959da)
mod_auth_digest: Widen the one-time-nonce counter to 64 bits and move inside the client hash table: * modules/aaa/mod_auth_digest.c (struct hash_table): Hold the counter here as a 64-bit otn_counter, issued under client_lock like next_id rather than with 32-bit atomics (apr_atomic_inc64 is not available on the minimum APR). (initialize_tables): Seed it; drop its separate shared-memory allocation. (gen_nonce): Issue the ordinal under client_lock. (set_shmem_size): Account for two allocations rather than three. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> GitHub: close apache#787 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939038 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit 8992946)
* modules/aaa/mod_auth_digest.c (gen_nonce_hash): Hash in whether the nonce time is a timestamp or a one-time ordinal, so that a nonce minted under one lifetime does not verify under the other. * test/modules/aaa/test_014_mixed_lifetime.py: New test suite. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit 6df4bd2)
* modules/aaa/mod_auth_digest.c (client_entry): Add owner field. (DEF_SHMEM_SIZE): Update the entry count for it. (nonce_state): Add NONCE_NOT_OWNER. (owner_hash): New, a keyed hash of the server name, realm and username. (client_update_nonce): Record the owner on first use; return NONCE_NOT_OWNER for a request from another user, leaving the entry alone. Drop const from r. (check_and_record_nonce): Challenge NONCE_NOT_OWNER as stale, with a new opaque, clearing the quoted one from the record. * test/modules/aaa/test_015_cross_client.py: New test suite. * test/modules/aaa/conftest.py: Add a second vhost sharing the realm with its own password file, and a tracked section with a domain. * test/modules/aaa/env.py (AAATestEnv): Write that file. * test/modules/aaa/htdocs/digest/nccheck-domain/secret.txt: New file. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com> (cherry picked from commit c81df4a)
* modules/aaa/mod_auth_digest.c (check_and_record_nonce): Answer NONCE_BAD_COUNT with stale=true like NONCE_STALE. (client_update_nonce): Log it at INFO rather than ERR, and without the "possible replay attack" wording: an out-of-order nonce-count is what a client's concurrent requests look like, and a replay cannot answer the new nonce. Alerting on AH01774 at ERR will no longer see it. (authenticate_digest_user): Expand the comment on the check order. * test/modules/aaa/test_003_nccheck.py (test_digest_032), test/modules/aaa/test_007_replay.py (test_digest_074): Expect stale. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit caf5c01)
* modules/aaa/mod_auth_digest.c (note_digest_auth_failure): Leave the caller's stale flag alone when issuing a new opaque. * test/modules/aaa/test_001_challenge_response.py (test_digest_016): New. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit a4fb307)
unused server argument. (note_digest_auth_failure, check_nonce, add_auth_info): Adjust. (authenticate_digest_user): Remove the unreachable missing-realm checks and the NULL check on new_digest(). (init_digest_request): Fix the function name in the comment. No functional change. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit 716ccdd)
hostnames with ap_cstr_casecmp(). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit 97d4b76)
* modules/aaa/mod_auth_digest.c (client_note_renewed): Removed. (client_generate): Take a renewed flag and count it under the lock already held; log the gc summary and any rmm_free failure after releasing the lock, so the summary now counts the entry just added. (gc): Return the first rmm_free failure as the result, and the count through a new argument, instead of logging. (note_digest_auth_failure): Adjust. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit b7b4518)
* modules/aaa/mod_auth_digest.c (check_nonce): The base64 decoder stops at the first byte which is not base64, so a nonce of the right length could leave part of the decoded time unset. Check the decoded length and challenge as stale if it is short, before using the time. * test/modules/aaa/test_012_truncated_nonce.py (test_digest_012_02_time_not_base64): New test. Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com> (cherry picked from commit c186543)
…l change: * modules/aaa/mod_auth_digest.c (check_nonce): Fold check_and_record_nonce() in as the tail, so the nonce is checked in one place: that this server issued it, then its age, then its use by the client. Log per nonce_state in a switch, with one shared stale challenge for every failure. Merge the two lifetime > 0 tests into one block. (check_and_record_nonce): Remove. (client_update_nonce): Drop the logging and the nonce argument; return the tracked nonce-count through a new out parameter. (enum nonce_state): Add NONCE_UNKNOWN for a client with no entry; NONCE_STALE is now only a used one-time nonce. (tracks_clients): New predicate for whether state is kept per client. (note_digest_auth_failure, check_nonce): Use it. (authenticate_digest_user): Call check_nonce() alone; move the ordering rationale to its header comment. Drop the unused res. (init_digest_request): Adjust comment. Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com> (cherry picked from commit 8ca7542)
…ot being backported here): mod_auth_digest: Allocate log message tags: * modules/aaa/mod_auth_digest.c (check_nonce): Number the AH10678 and AH10679 tags. * test/modules/aaa/test_012_truncated_nonce.py (test_digest_012_02_time_not_base64): Match and ignore the log line by its tag. Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com> (cherry picked from commit 6354a28)
r1939032-r1939036 as backported in 2.4.72. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
notroj
force-pushed
the
2.4.x-digest-p3
branch
from
November 22, 2026 15:49
2faffd4 to
3eb827b
Compare
notroj
marked this pull request as ready for review
November 22, 2026 16:25
and AH10636 tags to AH10676 and AH10677, as allocated on trunk. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge r1937709, r1937711, r1937712, r1937713, r1937715, r1937716, r1937888, r1938032, r1939030, r1939031, r1939032, r1939033, r1939034, r1939035, r1939036, r1939037, r1939038, 6df4bd2, c81df4a, caf5c01, a4fb307, 716ccdd, 97d4b76, b7b4518, c186543, 8ca7542, 6354a28 from trunk:
Notes:
initialize_childmessagesAH10635andAH10636, which trunk uses elsewhere (AH10635is the r1939034 message in this PR); a commit here renumbers them toAH10676andAH10677as allocated on trunk in 6354a28.AuthDigestShmemSizeparsing toap_size_parameter_parse(), which 2.4.x does not have.authenticate_digest_user, resolved to keep theAuthDigestEnableQueryStringHackhandling which only 2.4.x has.test/changes of the revisions up to r1939038 were already on 2.4.x and are not repeated. The last commit addsbackported_in="2.4.72"to theirnot_backportedmarks; the same change is needed on trunk.🤖 Generated with Claude Code