Skip to content

Fix SSL key permission check to allow modes stricter than 0600/0640#1265

Merged
arp242 merged 2 commits intolib:masterfrom
mdz:fix-ssl-key-permission-check
Mar 9, 2026
Merged

Fix SSL key permission check to allow modes stricter than 0600/0640#1265
arp242 merged 2 commits intolib:masterfrom
mdz:fix-ssl-key-permission-check

Conversation

@mdz
Copy link
Copy Markdown
Contributor

@mdz mdz commented Mar 3, 2026

The permission check in checkPermissions used XOR (^) which only accepted
an exact mode match (0600 for user-owned, 0640 for root-owned). Modes more
restrictive than the maximum (e.g. 0400, read-only) were incorrectly rejected.

Use AND NOT (&^) to check that no permission bits exceed the allowed maximum
instead.

Fixes #1257

The permission check used XOR (^) which only accepted an exact mode
match. Modes more restrictive than the maximum (e.g. 0400) were
incorrectly rejected. Use AND NOT (&^) to check that no bits exceed
the allowed maximum instead.

Fixes lib#1257
@arp242 arp242 force-pushed the fix-ssl-key-permission-check branch from b18e797 to 8be4559 Compare March 5, 2026 18:14
@arp242 arp242 force-pushed the fix-ssl-key-permission-check branch from 8be4559 to 2acc8ae Compare March 9, 2026 13:10
@arp242 arp242 merged commit f006daf into lib:master Mar 9, 2026
34 of 37 checks passed
@arp242
Copy link
Copy Markdown
Collaborator

arp242 commented Mar 9, 2026

Thanks!

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.

ssl key mode 400 can not used

2 participants