Skip to content

outposts: fix docker_tls created files permission#19978

Merged
BeryJu merged 3 commits intogoauthentik:mainfrom
kolega-ai-dev:v2-finding_32
Feb 3, 2026
Merged

outposts: fix docker_tls created files permission#19978
BeryJu merged 3 commits intogoauthentik:mainfrom
kolega-ai-dev:v2-finding_32

Conversation

@kolega-ai-dev
Copy link
Contributor

@kolega-ai-dev kolega-ai-dev commented Feb 3, 2026

Vulnerability identified and fix provided by Kolega.dev

Location

authentik/outposts/docker_tls.py:29

Vulnerability

Unlike docker_ssh.py which uses a custom opener with 0o700 permissions, docker_tls.py's write_file() method uses plain open() without specifying file permissions. This means files are created with the default umask (typically 0o644), making private keys readable by other users. While the container environment provides significant mitigation (runs as UID 1000, isolated tmpfs at /dev/shm/), this is still a code defect that should be fixed. The fix is simple: add an opener parameter similar to docker_ssh.py or use os.open() with explicit mode 0o600. The practical exploitability is low due to container isolation, but this represents a genuine coding error where sensitive cryptographic material is written with overly permissive file permissions.

Fix

Added an opener function that creates files with 0o600 permissions, matching the security pattern used in docker_ssh.py. This ensures TLS certificate keys are only readable by the file owner.

The write_file() method used plain open() without specifying permissions,
creating files with the default umask (typically 0o644). This made private
keys readable by other users. Added an opener parameter with 0o600 mode
to ensure sensitive cryptographic material is only accessible by the owner.
@kolega-ai-dev kolega-ai-dev requested a review from a team as a code owner February 3, 2026 15:49
@netlify
Copy link

netlify bot commented Feb 3, 2026

Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 0e3aac0
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6982190503339e0008c4abc1
😎 Deploy Preview https://deploy-preview-19978--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
@BeryJu BeryJu changed the title Insecure Temporary File Handling for Private Keys outposts: fix docker_tls created files permission Feb 3, 2026
@BeryJu BeryJu reopened this Feb 3, 2026
@BeryJu BeryJu added area:backend backport/version-2025.12 Add this label to PRs to backport changes to version-2025.12 labels Feb 3, 2026
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
@netlify
Copy link

netlify bot commented Feb 3, 2026

Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit c907e7a
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6982638eccb16d0008bedac7
😎 Deploy Preview https://deploy-preview-19978--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Feb 3, 2026

Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 50a75f5
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/698263cc1571150008857acd
😎 Deploy Preview https://deploy-preview-19978--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.18%. Comparing base (ad6ce84) to head (50a75f5).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #19978      +/-   ##
==========================================
- Coverage   93.26%   93.18%   -0.09%     
==========================================
  Files         968      968              
  Lines       53346    53417      +71     
==========================================
+ Hits        49755    49777      +22     
- Misses       3591     3640      +49     
Flag Coverage Δ
conformance 38.06% <50.00%> (-0.02%) ⬇️
e2e 43.87% <50.00%> (-0.22%) ⬇️
integration 22.71% <100.00%> (-0.21%) ⬇️
unit 91.37% <50.00%> (-0.05%) ⬇️
unit-migrate 91.40% <50.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BeryJu BeryJu merged commit 1e35482 into goauthentik:main Feb 3, 2026
95 of 97 checks passed
authentik-automation bot pushed a commit that referenced this pull request Feb 3, 2026
* security: use restrictive file permissions for TLS certificate files

The write_file() method used plain open() without specifying permissions,
creating files with the default umask (typically 0o644). This made private
keys readable by other users. Added an opener parameter with 0o600 mode
to ensure sensitive cryptographic material is only accessible by the owner.

* reuse

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* revert import change

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: kolega.dev <faizan@kolega.ai>
Co-authored-by: Jens Langhammer <jens@goauthentik.io>
@authentik-automation
Copy link
Contributor

🍒 Cherry-pick to version-2025.12 created: #19993

BeryJu added a commit that referenced this pull request Feb 4, 2026
…to version-2025.12) (#19993)

outposts: fix docker_tls created files permission (#19978)

* security: use restrictive file permissions for TLS certificate files

The write_file() method used plain open() without specifying permissions,
creating files with the default umask (typically 0o644). This made private
keys readable by other users. Added an opener parameter with 0o600 mode
to ensure sensitive cryptographic material is only accessible by the owner.

* reuse



* revert import change



---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Kolega.dev <security@kolega.ai>
Co-authored-by: kolega.dev <faizan@kolega.ai>
Co-authored-by: Jens Langhammer <jens@goauthentik.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend backport/version-2025.12 Add this label to PRs to backport changes to version-2025.12

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants