chore: backport commit from develop#151
Conversation
Signed-off-by: SequeI <asiek@redhat.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR updates the TUF repository initialization script to normalize file permissions for generated repository artifacts and add a temporary debug listing after permissions are set. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
There was a problem hiding this comment.
Hey there - I've reviewed your changes and found some issues that need to be addressed.
- If
chmodorfindfails, the script currently continues silently; consider adding error handling orset -e-style behavior around the permission-setting step to fail fast on unexpected issues.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- If `chmod` or `find` fails, the script currently continues silently; consider adding error handling or `set -e`-style behavior around the permission-setting step to fail fast on unexpected issues.
## Individual Comments
### Comment 1
<location> `rhtas/tuf-repo-init.sh:316-317` </location>
<code_context>
rm -- "$file"
done
+echo "Setting 644 permissions on public repository files..."
+find "${OUTDIR}" -type f -exec chmod 644 {} +
+
+# test
</code_context>
<issue_to_address>
**🚨 issue (security):** Applying 644 to all files in OUTDIR may unintentionally weaken or change permissions on sensitive or executable files.
This `find "${OUTDIR}" -type f -exec chmod 644 {} +` treats all files as public, non-executable. If `OUTDIR` ever holds secrets (keys, internal data) or executables, this will silently relax or change their permissions. Consider limiting this to a known public subdirectory, only specific file types that must be public, or explicitly excluding sensitive paths/files.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
PR Type
Enhancement
Description
Add permission setting for public repository files
Set 644 permissions on all files in output directory
Add diagnostic listing of repository structure
Diagram Walkthrough
File Walkthrough
tuf-repo-init.sh
Add file permissions and diagnostic outputrhtas/tuf-repo-init.sh
chmod 644command to set read permissions on all public repositoryfiles
findcommand to recursively apply permissions in output directoryls -Rlacommand to display repository structuresteps