Skip to content

bugfix: TLS key-log files are created with default world-readable permissions - #2559

Merged
zhuizhuhaomeng merged 1 commit into
masterfrom
codex-security/arp_2e9bf1a41fd0f58f11d8381fb16b7384
Nov 28, 2026
Merged

zhuizhuhaomeng merged 1 commit into
masterfrom
codex-security/arp_2e9bf1a41fd0f58f11d8381fb16b7384

Conversation

@zhuizhuhaomeng

Copy link
Copy Markdown
Contributor

The patch makes TLS key-log creation and reuse owner-only before any secret is written.

  • New files use NGX_FILE_OWNER_ACCESS, removing the 0644 creation path that exposed TLS secrets.
  • Existing files are accepted only when owned by the effective master user and free of group or other permission bits.
  • Validation operates on the opened descriptor before callback registration, preventing path replacement from bypassing the checks.
  • Append mode and SSLKEYLOGFILE output remain unchanged for same-owner, owner-only files.
  • Focused regression source covers mode 0600 and fail-closed handling, while documentation requires a protected directory.

Static Verification Checks

  • Owner-only file creation (Passed) — ngx_http_lua_ssl_key_log uses NGX_FILE_OWNER_ACCESS, establishing newly created Unix key logs exclude non-owner access.

  • Existing file validation (Passed) — ngx_http_lua_ssl_key_log validates descriptor ownership and mode bits, establishing unsafe existing files fail closed.

  • Callback registration ordering (Passed) — src/ngx_http_lua_module.c registers key_log_callback after validation, establishing rejected descriptors cannot receive TLS session secrets.

  • Legitimate append behavior (Passed) — t/129-ssl-socket.t retains append-and-read assertions, establishing valid SSLKEYLOGFILE output and prior content preservation.

  • Permission regression coverage (Passed) — t/200-ssl-key-log-permissions.t asserts mode 0600 and broad-file rejection, establishing both permission boundaries are regression-covered.

  • Finding: acf_fa06d998740387a02b13dbd78cf53980

  • Patch: arp_2e9bf1a41fd0f58f11d8381fb16b7384

  • Base commit: 5079ce71b15b21729ce3c5a75e98ddd1007fb619

  • Patch SHA-256: 10d89c8f122661af49e8d4567b180a1246cc5732a018547b387b62d22d52777b

@zhuizhuhaomeng
zhuizhuhaomeng marked this pull request as ready for review November 28, 2026 07:16
@zhuizhuhaomeng zhuizhuhaomeng changed the title [Codex Security] TLS key-log files are created with default world-readable permissions bugfix: TLS key-log files are created with default world-readable permissions Nov 28, 2026
@zhuizhuhaomeng
zhuizhuhaomeng merged commit 43c6209 into master Nov 28, 2026
7 checks passed
@zhuizhuhaomeng
zhuizhuhaomeng deleted the codex-security/arp_2e9bf1a41fd0f58f11d8381fb16b7384 branch November 28, 2026 07:25
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.

1 participant