Skip to content

Fix tls.create_csr log message path concatenation (#60877)#68835

Open
kimimgo wants to merge 1 commit intosaltstack:masterfrom
kimimgo:fix/tls-csr-path-60877
Open

Fix tls.create_csr log message path concatenation (#60877)#68835
kimimgo wants to merge 1 commit intosaltstack:masterfrom
kimimgo:fix/tls-csr-path-60877

Conversation

@kimimgo
Copy link
Copy Markdown

@kimimgo kimimgo commented Mar 20, 2026

Fixes #60877

Summary

tls.create_csr uses f-string concatenation for csr_path in the
return message without ensuring a path separator. When csr_path
lacks a trailing slash, the filename merges with the directory name:

Before: Created Private Key: "/etc/ssl/MYCA/certsMY.HOSTNAME.key"
After:  Created Private Key: "/etc/ssl/MYCA/certs/MY.HOSTNAME.key"

Fix

Replace f"{csr_path}{csr_filename}" with
os.path.join(csr_path, csr_filename) in the return message (lines
1256-1257). os is already imported.

Use os.path.join() instead of f-string concatenation for csr_path
in return message to avoid missing separator when csr_path lacks
a trailing slash.

Before: 'Created Private Key: "/etc/ssl/MYCA/certsMY.HOSTNAME.key"'
After:  'Created Private Key: "/etc/ssl/MYCA/certs/MY.HOSTNAME.key"'
@dwoz
Copy link
Copy Markdown
Contributor

dwoz commented Apr 11, 2026

@kimimgo The test suite passes with your change, that's great! please add a test and changelog entry so we can get this merged.

@dwoz dwoz added needs-testcase PR needs test cases written, or the issue is about a bug/feature that needs test cases needs-changelog labels Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-changelog needs-testcase PR needs test cases written, or the issue is about a bug/feature that needs test cases test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] tls.create_csr doesn't check csr_path has a trailing slash before concatenating it

2 participants