Certificate output directories created with mode 0777 #28

Open
opened 2026-05-17 23:13:16 +02:00 by heiko · 1 comment
Owner

Summary

internal/shared/mkdir.go:10 creates directories with mode 0777:

err := os.Mkdir(dir, 0777)

A typical umask of 022 reduces this to 0755 (world-readable and world-executable). Certificate subdirectories holding private key files should not be world-accessible.

Impact

Any local user can list the contents of the cert output directories. Combined with a permissive umask, the actual privkey.pem files inside may also be readable if their own permissions are misconfigured.

Fix

Use mode 0700 (or at minimum 0750) for directories that hold certificate material:

err := os.Mkdir(dir, 0700)
## Summary `internal/shared/mkdir.go:10` creates directories with mode `0777`: ```go err := os.Mkdir(dir, 0777) ``` A typical umask of `022` reduces this to `0755` (world-readable and world-executable). Certificate subdirectories holding private key files should not be world-accessible. ## Impact Any local user can list the contents of the cert output directories. Combined with a permissive umask, the actual `privkey.pem` files inside may also be readable if their own permissions are misconfigured. ## Fix Use mode `0700` (or at minimum `0750`) for directories that hold certificate material: ```go err := os.Mkdir(dir, 0700) ```
Author
Owner

AI attribution comment added per repository instruction for this open issue.\n\n(co)authored by ai:gpt-5-codex

AI attribution comment added per repository instruction for this open issue.\n\n(co)authored by ai:gpt-5-codex
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
heiko/cert-proxy#28
No description provided.