Skip to content

fix(dockerfile): copy file with proper permissions#746

Merged
acouvreur merged 1 commit into
mainfrom
745-error-open-etcsabliersablieryaml-permission-denied
Nov 23, 2025
Merged

fix(dockerfile): copy file with proper permissions#746
acouvreur merged 1 commit into
mainfrom
745-error-open-etcsabliersablieryaml-permission-denied

Conversation

@acouvreur

@acouvreur acouvreur commented Nov 23, 2025

Copy link
Copy Markdown
Member

Closes #745

Copilot AI review requested due to automatic review settings November 23, 2025 16:29
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots

See analysis details on SonarQube Cloud

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR attempts to fix file permissions in the Dockerfile by adding --chown flags to COPY commands and reordering instructions. However, the changes introduce a critical bug by placing the USER directive before copying the application files.

Key Changes:

  • Reordered USER directive to execute before COPY commands (problematic)
  • Added --chown=65532:65532 flags to COPY commands for explicit ownership
  • Moved the "Add non-root user" comment after the USER directive

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread build/Dockerfile
Comment on lines 5 to +11
# Run as non-root user
USER 65532:65532

# Add non-root user
COPY --chmod=0755 --chown=65532:65532 $TARGETPLATFORM/sablier /bin/sablier
COPY --chmod=0644 --chown=65532:65532 build/sablier.yaml /etc/sablier/sablier.yaml

Copilot AI Nov 23, 2025

Copy link

Choose a reason for hiding this comment

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

The USER directive is set before copying the application files. This means the container switches to a non-root user (65532:65532) before the necessary files (/bin/sablier and /etc/sablier/sablier.yaml) are available. This will cause the ENTRYPOINT to fail since /bin/sablier won't exist when the container runs.

The correct order should be:

  1. COPY the files first (with appropriate --chmod and --chown flags)
  2. Then set the USER directive

The original order in the diff (lines with '-' prefix) was correct.

Suggested change
# Run as non-root user
USER 65532:65532
# Add non-root user
COPY --chmod=0755 --chown=65532:65532 $TARGETPLATFORM/sablier /bin/sablier
COPY --chmod=0644 --chown=65532:65532 build/sablier.yaml /etc/sablier/sablier.yaml
# Add non-root user
COPY --chmod=0755 --chown=65532:65532 $TARGETPLATFORM/sablier /bin/sablier
COPY --chmod=0644 --chown=65532:65532 build/sablier.yaml /etc/sablier/sablier.yaml
# Run as non-root user
USER 65532:65532

Copilot uses AI. Check for mistakes.
Comment thread build/Dockerfile
# Run as non-root user
USER 65532:65532

# Add non-root user

Copilot AI Nov 23, 2025

Copy link

Choose a reason for hiding this comment

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

The comment "Add non-root user" is misleading. The USER directive doesn't add a user; it switches the execution context to an existing user (UID 65532). Consider updating this comment to something like "# Copy application files" or "# Copy files with non-root ownership" to accurately describe what these COPY commands do.

Suggested change
# Add non-root user
# Copy files with non-root ownership

Copilot uses AI. Check for mistakes.
@acouvreur acouvreur merged commit 12d00e0 into main Nov 23, 2025
12 of 14 checks passed
@acouvreur acouvreur deleted the 745-error-open-etcsabliersablieryaml-permission-denied branch November 23, 2025 16:32
@github-actions

Copy link
Copy Markdown

✅ All tests successful. No failed tests were found.

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

@github-actions

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 23, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

emilien-jegou pushed a commit to emilien-jegou/sablier that referenced this pull request Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: open /etc/sablier/sablier.yaml: permission denied

2 participants