-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: db test on SELinux enabled systems #2683
fix: db test on SELinux enabled systems #2683
Conversation
Related to supabase#2659 SELinux will require docker to pass the z option to label the directory as usable inside the container
Pull Request Test Coverage Report for Build 10906052517Details
💛 - Coveralls |
efd4bd8
to
7e1776d
Compare
Made the changes to scope the Changed the volume binding option across the codebase instead of just for the |
I'm not fully convinced about the scope of this change. We use different docker volume mount types, including named, anonymous, and bind mounts. Perhaps it's only bind mount that's breaking in selinux rather than every mount type. Therefore, I think it's worth setting up a selinux test to reproduce this error, and to find out if other commands like There's also the alternative to disable selinux for a specific container which should be fine for running db tests https://jaosorior.dev/2018/selinux-and-docker-notes/ P.S. We probably need to use bitbucket which supports fedora runner https://bitbucket.org/supabase-cli/setup-cli/src/master/bitbucket-pipelines.yml |
I was able to reproduce the issue locally on a virtual machine. The However, I wasn't able to find a way to test this in a CI environment. Interestingly, the tests passed in my reproduction environment as well, likely due to our use of mocked filesystems and Docker. I encountered a separate issue related to an invalid |
Amazing, thank you for going the extra mile to reproduce this. Is the rlimit issue a warning or straight error starting storage container? Either way, I'm happy to deal with that separately. |
What kind of change does this PR introduce?
This PR adds the
:z
flag to the volume binding for SELinux systems when using thesupabase db test
command.Fixes #2659
What is the current behavior?
When running
supabase db test
on a system with SELinux enabled,pg_tap
fails to execute because the/tmp
volume does not have the appropriate permissions, causing issues with the bind mount.What is the new behavior?
With this change, the
:z
flag ensures the/tmp
volume is properly relabeled to allowpg_tap
to run successfully on SELinux-enabled systems. There are no expected impacts on systems where SELinux is not enabled.Additional context
I'm hesitant about applying this change across all volume bindings in the CLI codebase. While this should fix the issue for SELinux users without affecting other systems, there might be security concerns, especially for "dynamic" bindings where the exact directory being mounted is unpredictable. Since this change is intended for local development, the security impact should be minimal, but I’m open to feedback on whether this is the best approach.