Skip to content

Ensure app files are owned by appuser#54

Merged
schivmeister merged 2 commits into
developfrom
feature/perms-fix
Jul 16, 2026
Merged

Ensure app files are owned by appuser#54
schivmeister merged 2 commits into
developfrom
feature/perms-fix

Conversation

@schivmeister

Copy link
Copy Markdown

Add --chown=appuser:appuser to COPY commands in runtime stage. Without explicit ownership, files inherit root:root with source permissions -- breaks when built with restrictive umask (027/077).

Add `--chown=appuser:appuser` to COPY commands in runtime stage.
Without explicit ownership, files inherit `root:root` with source
permissions -- breaks when built with restrictive umask (027/077).
@schivmeister
schivmeister requested a review from gkostkowski July 16, 2026 10:08
@schivmeister schivmeister self-assigned this Jul 16, 2026
Copilot AI review requested due to automatic review settings July 16, 2026 10:08

Copilot AI left a comment

Copy link
Copy Markdown

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 ensures files copied into the runtime image are owned by the non-root appuser, preventing permission failures when source files (or copied artifacts) have restrictive modes (e.g., from umask 027/077) and the container runs as appuser.

Changes:

  • Add --chown=appuser:appuser to COPY statements in the runtime stage for the venv and app/config directories.
  • Keep /data creation and ownership aligned with the non-root runtime user.

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

There appear to be many files with CRLF line endings, but this
particular one was problematic as it would be interpreted as modified by
Git perpetually, for anyone who checks it out with no `autocrlf`
setting. As a result, Git would forbid switching branches, and
downstream tools will continue to interpret that there is a change.

```sh
$ git ls-files --eol | grep rdf_mapping.yaml
i/lf      w/lf    attr/text eol=lf        src/config/rdf_mapping.yaml
i/crlf    w/crlf  attr/text eol=lf        test/resources/rdf_mapping.yaml
```

This is because the file was committed as CRLF despite there being an
enforcement of UNIX EOL via `.gitattributes`. Both Git internal and
working copies are CRLF in this case. The fix is to renormalize and
commit the file:

```sh
git add --renormalize .
git commit -m "Normalize line endings"
```

And then reinitialize the local copy:

```sh
rm test/resources/rdf_mapping.yaml
git checkout HEAD -- test/resources/rdf_mapping.yaml
```

Verify that the Git-internal (`i`) and working copy (`w`; yours) are now
correct:

```sh
$ git ls-files --eol | grep rdf_mapping.yaml
i/lf    w/lf    attr/text eol=lf        src/config/rdf_mapping.yaml
i/lf    w/lf    attr/text eol=lf        test/resources/rdf_mapping.yaml
```
@schivmeister
schivmeister merged commit adfbc77 into develop Jul 16, 2026
2 checks passed
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.

3 participants