Generic X.509 certificate helpers and secure file utilities - #276
Generic X.509 certificate helpers and secure file utilities#276stenslae wants to merge 4 commits into
Conversation
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #276
Scan targets checked: wolfclu-bugs, wolfclu-src
Findings: 2
2 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #276
Scan targets checked: wolfclu-bugs, wolfclu-src
Findings: 3
3 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #276
Scan targets checked: wolfclu-bugs, wolfclu-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #276
Error: GitHubAPIError
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #276
Error: GitHubAPIError
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #276
Error: GitHubAPIError
|
PR is failing CI. |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #276
Scan targets checked: wolfclu-bugs, wolfclu-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #276
Scan targets checked: wolfclu-bugs, wolfclu-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #276
Scan targets checked: wolfclu-src
Failed targets: wolfclu-bugs
a09fd6d to
0592d3a
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #276
Scan targets checked: wolfclu-bugs, wolfclu-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #276
Scan targets checked: wolfclu-bugs, wolfclu-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
…eneration/CA signing pipelines
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #276
Scan targets checked: wolfclu-bugs, wolfclu-src
Findings: 3
3 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
| if (in == NULL) { | ||
| wolfCLU_LogError("Error opening file %s", optarg); | ||
| ret = USER_INPUT_ERROR; | ||
| return USER_INPUT_ERROR; |
There was a problem hiding this comment.
🔵 [Low] Early return on -in failure leaks -name buffer · Resource leaks on error paths
The WOLFCLU_INFILE handler now does return USER_INPUT_ERROR; directly instead of setting ret and breaking. If -name was parsed earlier in the same invocation (allocating name via XMALLOC), this bypasses the if (name != NULL) XFREE(name, ...) cleanup at the end of the function.
Fix: Set ret = USER_INPUT_ERROR; break; instead of returning directly, so the loop exits normally and reaches the existing name/bioOut/key cleanup.
| @@ -344,6 +360,9 @@ int wolfCLU_CASetup(int argc, char** argv) | |||
| if ((selfSigned || altSign) && ca != NULL) { | |||
There was a problem hiding this comment.
🔵 [Low] x509 leaked when -selfsign used without -keyfile/-cert/-altkey/-altpub · Resource leaks on error paths
wolfCLU_CertSignSetCA (which transfers x509 ownership to signer when selfSigned) only runs inside the pkey != NULL || ca != NULL || altKey != NULL || altKeyPub != NULL guard. If none are set, ownership is never transferred, but cleanup unconditionally skips wolfSSL_X509_free(x509) whenever selfSigned is true, leaking x509.
Fix: Track whether wolfCLU_CertSignSetCA actually took ownership of x509 (e.g. a boolean) and only skip the free when it did.
| /* count every request a response was sent for (valid or a malformed- | ||
| * request error), so -nrequest still limits the loop even under a | ||
| * flood of malformed requests */ | ||
| requestsProcessed++; |
There was a problem hiding this comment.
🟠 [Medium] OCSP responder request-limit counts malformed requests, enabling forced early shutdown · Logic error
requestsProcessed now increments for every request that gets any response, including malformed ones, reversing the prior guard that only counted OCSP_SUCCESSFUL responses. An unauthenticated client can send nrequest malformed OCSP requests to force the responder to hit its limit and exit at line 874 before serving legitimate clients.
Fix: Only increment requestsProcessed when ocspStatus == OCSP_SUCCESSFUL, restoring the original protection.
Added helper functions to do secure file operations. Added simplified certificate parsing and mapping logic into helper functions. Existing modules were refactored to utilize new functions. Added CI tests for all new changes.
This allows for potential reduction in openssl compat layer reliance and new signature algos.