Skip to content

Use octal file modes in the Redis and Valkey modules - #1626

Open
Mario-Mohar wants to merge 1 commit into
testcontainers:mainfrom
Mario-Mohar:fix/redis-valkey-file-modes
Open

Mario-Mohar wants to merge 1 commit into
testcontainers:mainfrom
Mario-Mohar:fix/redis-valkey-file-modes

Conversation

@Mario-Mohar

@Mario-Mohar Mario-Mohar commented Oct 30, 2026 •

Copy link
Copy Markdown

Summary

The Redis and Valkey modules copied the initial data file and import.sh with modes 666 and 777 written as decimal numbers, which Docker applies as octal 1232 and 1411. The data file ended up write only for its owner and the script read only for its owner.

This changes them to 0o644 and 0o755 and adds a short JSDoc note on FileToCopy.mode and ContentToCopy.mode saying the value is an octal permission.

#1525 will follow in a separate PR. While testing it I found that a password with a space also breaks the Redis server start and executeCliCmd, so I've asked on that issue how much of it should go into one change.

Verification

New test in both modules: after withInitialData, the image's own non-root user (redis, valkey) must be able to read the data file and read and execute import.sh. It runs against every image in IMAGES.

  • Before the fix: 6 of 6 new tests fail (test -r exits with 1)
  • After the fix: npx vitest run packages/modules/redis packages/modules/valkey, 57 passed
  • npm run format, npm run lint, npm run knip and npm run check-compiles pass

Run with Podman 6.1 through the Docker socket.

Not breaking

Only the permissions of two files the modules copy for their own import change. Root still has full access, so withInitialData behaves as before. The JSDoc change is documentation only.

Closes #1526

@Mario-Mohar
Mario-Mohar marked this pull request as ready for review October 30, 2026 11:36

This branch has not been deployed

No deployments
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.

Use octal file modes in the Redis and Valkey modules

1 participant