Skip to content

Create the persisted session cache file with owner-only permissions - #11291

Merged
philljj merged 1 commit into
wolfSSL:masterfrom
gasbytes:persistent-session-cache-fix
Sep 3, 2026
Merged

philljj merged 1 commit into
wolfSSL:masterfrom
gasbytes:persistent-session-cache-fix

Conversation

@gasbytes

Copy link
Copy Markdown
Contributor

Description

On POSIX builds wolfssl_save_session_cache now opens the file with open in 0600 mode + fdopen.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@gasbytes gasbytes self-assigned this Aug 26, 2026
Copilot AI lite review requested due to automatic review settings August 26, 2026 16:15
@wolfSSL-Bot

Copy link
Copy Markdown

Can one of the admins verify this patch?

@gasbytes
gasbytes marked this pull request as ready for review August 26, 2026 16:24
@gasbytes
gasbytes force-pushed the persistent-session-cache-fix branch from 34eb599 to b736db5 Compare August 26, 2026 16:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

This PR tightens permissions for persisted session cache files on POSIX builds by opening the cache file with owner-only permissions, and documents the security implications of writing session secrets to disk.

Changes:

  • Added a POSIX-specific SaveSessionCacheOpen() helper that uses open(…, 0600) + fchmod() + fdopen().
  • Switched wolfSSL_save_session_cache() to use SaveSessionCacheOpen() instead of XFOPEN().
  • Added Doxygen warning about plaintext secrets and platform-specific file permissions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/ssl_sess.c Adds POSIX open+chmod path to ensure the cache file is owner-only (0600).
doc/dox_comments/header_files/ssl.h Documents plaintext secret risk and notes 0600 behavior on POSIX.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/ssl_sess.c Outdated
Comment thread src/ssl_sess.c Outdated
@github-actions

Copy link
Copy Markdown

retest this please

@gasbytes
gasbytes force-pushed the persistent-session-cache-fix branch from b736db5 to d028a34 Compare August 26, 2026 18:15
@gasbytes

Copy link
Copy Markdown
Contributor Author

Jenkins retest this please (lost logs)

@gasbytes

Copy link
Copy Markdown
Contributor Author

Jenkins retest this please

1 similar comment
@gasbytes

Copy link
Copy Markdown
Contributor Author

Jenkins retest this please

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #11291

Scan targets checked: wolfcrypt-rs-bugs, wolfssl-bugs, wolfssl-src

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Comment thread src/ssl_sess.c Outdated
Comment thread src/ssl_sess.c Outdated
Comment thread src/ssl_sess.c Outdated

@philljj philljj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good.

I would just suggest to use the wc_open_cloexec wrapper, and see if the fchmod can be refactored to a new or existing wrapper in wc_port.c

@philljj philljj assigned gasbytes and unassigned wolfSSL-Bot Aug 28, 2026
@gasbytes
gasbytes force-pushed the persistent-session-cache-fix branch from d028a34 to a086566 Compare September 1, 2026 12:09
@gasbytes

gasbytes commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Jenkins retest this please (timeout)

@gasbytes
gasbytes force-pushed the persistent-session-cache-fix branch from a086566 to c8cc22c Compare September 1, 2026 15:03
@gasbytes

gasbytes commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Jenkins retest this please (lost logs)

@gasbytes

gasbytes commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Jenkins retest this please (timeout)

1 similar comment
@gasbytes

gasbytes commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Jenkins retest this please (timeout)

@gasbytes

gasbytes commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Jenkins retest this please (timeout)

@philljj
philljj self-requested a review September 2, 2026 20:25
@gasbytes gasbytes assigned philljj and unassigned gasbytes Sep 3, 2026
@philljj
philljj merged commit 7fe9117 into wolfSSL:master Sep 3, 2026
411 of 418 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants