File tree Expand file tree Collapse file tree 2 files changed +65
-10
lines changed
crates/flagd/tests/common Expand file tree Collapse file tree 2 files changed +65
-10
lines changed Original file line number Diff line number Diff line change 1+ name : Flagd Checks
2+
3+ on :
4+ push :
5+ paths :
6+ - ' crates/flagd/**'
7+ - ' .github/workflows/flagd-check.yml'
8+ pull_request :
9+ paths :
10+ - ' crates/flagd/**'
11+ - ' .github/workflows/flagd-check.yml'
12+
13+ jobs :
14+ check :
15+ runs-on : ubuntu-latest
16+
17+ steps :
18+ - uses : actions/checkout@v4
19+
20+ - name : Update git submodules
21+ run : git submodule update --init --recursive
22+
23+ - name : Install protobuf compiler
24+ run : |
25+ sudo apt-get update
26+ sudo apt-get install -y protobuf-compiler
27+
28+ - name : Install cargo-msrv and cargo-readme
29+ working-directory : crates/flagd
30+ run : |
31+ cargo install cargo-msrv --locked
32+ cargo install cargo-readme
33+
34+ - name : Verify Minimum Supported Rust Version
35+ working-directory : crates/flagd
36+ run : cargo msrv verify
37+
38+ - name : Check README is up-to-date
39+ working-directory : crates/flagd
40+ run : |
41+ cargo readme --no-title --no-license > README.md.generated
42+ diff README.md README.md.generated
43+
Original file line number Diff line number Diff line change @@ -154,18 +154,30 @@ impl ConfigFile {
154154
155155 // Platform-specific security configuration
156156 if cfg ! ( target_os = "linux" ) {
157- // SELinux context for container access
158- let status = std:: process:: Command :: new ( "chcon" )
159- . arg ( "--type=container_file_t" )
160- . arg ( temp_file. path ( ) )
161- . status ( ) ;
162-
163- // Fallback to container-specific context if needed
164- if status. is_err ( ) {
165- let _ = std:: process:: Command :: new ( "chcon" )
166- . arg ( "--type=svirt_sandbox_file_t" )
157+ // Check if SELinux is enforcing
158+ let selinux_enforcing = std:: process:: Command :: new ( "getenforce" )
159+ . output ( )
160+ . map ( |output| {
161+ String :: from_utf8_lossy ( & output. stdout )
162+ . trim ( )
163+ . eq_ignore_ascii_case ( "enforcing" )
164+ } )
165+ . unwrap_or ( false ) ;
166+
167+ if selinux_enforcing {
168+ // SELinux context for container access
169+ let status = std:: process:: Command :: new ( "chcon" )
170+ . arg ( "--type=container_file_t" )
167171 . arg ( temp_file. path ( ) )
168172 . status ( ) ;
173+
174+ // Fallback to container-specific context if needed
175+ if status. is_err ( ) {
176+ let _ = std:: process:: Command :: new ( "chcon" )
177+ . arg ( "--type=svirt_sandbox_file_t" )
178+ . arg ( temp_file. path ( ) )
179+ . status ( ) ;
180+ }
169181 }
170182 } else if cfg ! ( target_os = "macos" ) {
171183 // Ensure POSIX permissions for Docker Desktop
You can’t perform that action at this time.
0 commit comments