scep: require transactionID and senderNonce before dispatch - #22
Open
yosuke-wolfssl wants to merge 1 commit into
Open
scep: require transactionID and senderNonce before dispatch#22yosuke-wolfssl wants to merge 1 commit into
yosuke-wolfssl wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enforces mandatory SCEP transactionID and senderNonce attributes before dispatch and adds regression coverage.
Changes:
- Rejects missing or empty required attributes.
- Adds raw POST handling and malformed-request tests.
- Covers valid and invalid SCEP message cases.
Review findings:
src/scep/scep_server.c:798— wrap protocol errors to update thread-local diagnostics (moderate, 2 votes).tests/integration/test_scep_roundtrip.c:125— handle short socket writes (moderate, 2 votes).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Summary |
|---|---|
src/scep/scep_server.c |
Validates required SCEP attributes before processing. |
tests/integration/test_scep_roundtrip.c |
Adds raw HTTP handling and required-attribute tests. |
Suppressed comments (2)
src/scep/scep_server.c:802
- The new
snonce_len == 0path is not exercised: the added malformed round atcheck_required_attrs()omitssender_nonceentirely, while onlytransactionIDgets a dedicated zero-length case. Please add an analogous non-NULLsender_noncewith length 0 and assert the same signed FAILURE response, otherwise the empty-senderNonce regression remains untested.
if (snonce == NULL || snonce_len == 0) {
tests/integration/test_scep_roundtrip.c:780
- The new check also rejects a non-NULL senderNonce with
snonce_len == 0, but this round only exercises an absent senderNonce (a.sender_nonce == NULL). A regression that drops the length check would still pass the suite; add a hand-built empty OCTET STRING senderNonce round and assert the same failure CertRep/no-recipientNonce behavior.
else if (i == 2) { /* no senderNonce */
a.transaction_id = tid; a.transaction_id_len = sizeof(tid);
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- handle_pki_op() answers a pkiMessage whose transactionID is absent or empty with HTTP 400, and one whose senderNonce is absent or empty with a CertRep carrying pkiStatus 2 and failInfo 2. Both run ahead of wolfcert_scep_deenvelop(). - raw_http_req() in the SCEP roundtrip test takes a method, content type and binary body and returns the response body; raw_http_status() wraps it for GET. - check_required_attrs() POSTs four pkiMessages -- no transactionID, zero-length transactionID, no senderNonce, and both present -- asserting HTTP 400 on the first two and the CertRep status, failInfo, envelope and nonces on the rest. Issue: F-8042
yosuke-wolfssl
force-pushed
the
fix/f_8042
branch
from
August 21, 2026 06:02
c5e89da to
0496c44
Compare
wolfSSL-Fenrir-bot
approved these changes
Aug 21, 2026
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #22
Scan targets checked: wolfcert-bugs, wolfcert-src
No new issues found in the changed files. ✅
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.
Problem
The SCEP server validated only
messageTypebefore dispatch.wolfcert_scep_parse_pki_message()leavestransactionID/senderNonceNULL when the attribute is absent rather than failing, andbuild_signed_attribs()silently omits any NULL field. A CMS-valid PKCSReq/RenewalReq omitting either therefore reached issuance, and the server signed and returned a CertRep missingtransactionIDand/orrecipientNonceinstead of refusing.RFC 8894 §3.2.1 makes both mandatory in every pkiMessage; §3.2.1.1 and §3.2.1.5 require the response to echo them. Closes f-8042. Also removes a zero-length-
transactionIDcollision in the pending queue and a NULL-to-memcmp()inpending_find().Fix (
src/scep/scep_server.c)handle_pki_op()requires both attributes before decrypting or dispatching:transactionIDsenderNoncepkiStatus2,failInfo2 (badRequest)transactionIDthere is nothing to echo, so no conforming CertRep exists — answering with one would reproduce the defect. This matches the file's existing convention: plain 400 for failures found beforemtis known, signed FAILURE CertRep oncetid/snonceare in hand.len == 0matters. An empty attribute on the wire yields a non-NULL zero-length buffer, which a NULL-only check would miss.wolfcert_scep_deenvelop(), so a rejected request costs no RSA private-key operation.Tests (
tests/integration/test_scep_roundtrip.c)raw_http_status()is generalized toraw_http_req()(method, content type, binary body, returns the response body); a GET wrapper leaves the existing call sites unchanged.check_required_attrs()POSTs four hand-built pkiMessages:transactionIDtransactionIDsenderNoncepkiStatus2,failInfo2, empty envelope, norecipientNoncepkiStatus0, envelope present,recipientNonceechoesVerification