Skip to content

Fix RunSecretProvider path issue#1078

Merged
dgageot merged 1 commit intodocker:mainfrom
jeanlaurent:RunSecretProviderFix
Dec 13, 2025
Merged

Fix RunSecretProvider path issue#1078
dgageot merged 1 commit intodocker:mainfrom
jeanlaurent:RunSecretProviderFix

Conversation

@jeanlaurent
Copy link
Copy Markdown
Member

Fix path traversal vulnerability in RunSecretsProvider

Issue

The RunSecretsProvider.Get() method didn't validate secret names before constructing file paths, allowing path traversal attacks. Malicious secret names like ../../../etc/passwd could read arbitrary files accessible to the application.

Fix

  • Added path validation using the existing path.ValidatePathInDirectory() function before reading files
  • Blocks ../ sequences and absolute paths outside /run/secrets
  • Returns empty string for invalid paths (consistent with existing error handling)
  • Follows the same security pattern already used in env_files.go

Signed-off-by: Jean-Laurent de Morlhon <jeanlaurent@morlhon.net>
@jeanlaurent jeanlaurent requested a review from a team as a code owner December 13, 2025 10:05
@dgageot dgageot merged commit 0954300 into docker:main Dec 13, 2025
5 checks passed
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.

2 participants