Skip to content

Commit 728dad6

Browse files
authored
chore: security hardening for CI/CD and file permissions (#99)
1 parent 95a3c29 commit 728dad6

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

.github/workflows/update-checksums.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,15 @@ jobs:
3434
# last; comparing that to a bot name is a check zizmor rightly calls
3535
# spoofable. The author is fixed when the pull request is opened and cannot
3636
# be set to another account.
37+
#
38+
# Also require the head repo to be this repo, not a fork. This job checks
39+
# out github.head_ref and runs a script from it with a write token, so a
40+
# PR from a fork naming its branch renovate/* would otherwise get its
41+
# attacker-controlled script executed with push access.
3742
if: >-
3843
startsWith(github.head_ref, 'renovate/') &&
39-
github.event.pull_request.user.login == 'renovate[bot]'
44+
github.event.pull_request.user.login == 'renovate[bot]' &&
45+
github.event.pull_request.head.repo.full_name == github.repository
4046
permissions:
4147
contents: write
4248
steps:

src/static/scripts/saxion-eduroam.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def install_ca_bundle(self) -> str:
288288
os.makedirs(CA_DIR, mode=0o755, exist_ok=True)
289289
with open(CA_FILE, "w", encoding="ascii") as handle:
290290
handle.write(SAXION_CA_PEM)
291-
os.chmod(CA_FILE, 0o644)
291+
os.chmod(CA_FILE, 0o600)
292292
except OSError as error:
293293
self.show_message(
294294
f"Could not write the CA certificate to {CA_FILE}: {error}", True

0 commit comments

Comments
 (0)