|
| 1 | +# Copyright 2025 The Secureblue Authors |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software distributed under the License is |
| 10 | +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | +# See the License for the specific language governing permissions and limitations under the License. |
| 12 | + |
| 13 | +name: validate-exec-bit |
| 14 | +permissions: {} |
| 15 | +on: |
| 16 | + pull_request: |
| 17 | + branches: |
| 18 | + - live |
| 19 | + - staging |
| 20 | +jobs: |
| 21 | + validate-exec-bit: |
| 22 | + name: Validate exec bit |
| 23 | + runs-on: ubuntu-24.04 |
| 24 | + permissions: |
| 25 | + contents: read |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 28 | + with: |
| 29 | + persist-credentials: false |
| 30 | + |
| 31 | + - name: Validate exec bit |
| 32 | + shell: bash |
| 33 | + run: | |
| 34 | + executable_paths=( |
| 35 | + "files/system/usr/libexec/*.sh" |
| 36 | + "files/system/usr/libexec/secureblue/*" |
| 37 | + "files/system/usr/bin/*" |
| 38 | + "files/system/kinoite/usr/libexec/secureblue/*" |
| 39 | + ) |
| 40 | +
|
| 41 | + files_missing_exec=() |
| 42 | +
|
| 43 | + for executable_path in "${executable_paths[@]}"; do |
| 44 | + for file in $executable_path; do |
| 45 | + if [ -f "$file" ] && [ ! -x "$file" ]; then |
| 46 | + files_missing_exec+=("$file") |
| 47 | + fi |
| 48 | + done |
| 49 | + done |
| 50 | +
|
| 51 | + if [ ${#files_missing_exec[@]} -ne 0 ]; then |
| 52 | + for file in "${files_missing_exec[@]}"; do |
| 53 | + echo "File missing exec bit: $file" |
| 54 | + done |
| 55 | + exit 1 |
| 56 | + else |
| 57 | + exit 0 |
| 58 | + fi |
0 commit comments