Skip to content

scripts/diffcheck.sh: Use secure temp files and git archive for better safety #1924

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maradini77
Copy link

Summary

Refactor scripts/diffcheck.sh to improve security and reliability by replacing fixed /tmp paths with secure temporary directories and avoiding destructive git checkout.

Changes

  • Secure temp files: Use mktemp -d with automatic cleanup via trap instead of hardcoded /tmp paths
  • Non-destructive git operations: Replace git checkout HEAD^ with git archive to avoid modifying working tree state

@jonatack jonatack added the CI label Aug 12, 2025
Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I'm not a bash expert. Pinging file authors @kallewoof @achow101 for feedback.

@kallewoof
Copy link
Contributor

I didn't really write that code. The reason I'm on blame is because of the move that happened in #1432.

That said, this PR seems to unnecessarily complicate things. This script is meant to be run in Github Actions. It's not meant to be run by users, and doesn't need "better safety". I have no strong opinion on the subject though so if others think this is useful, go ahead.

@jonatack
Copy link
Member

Thank you for the feedback @kallewoof.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants