feat: Run Device Agent in container as unpriviledged user#565
feat: Run Device Agent in container as unpriviledged user#565ppawlowski wants to merge 12 commits intomainfrom
Conversation
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
|
Need to think about this, mainly how it will impact things with mounted volumes as any files written will previously have been owned by root. Will have to test |
Co-authored-by: Ben Hardill <ben@flowforge.com>
hardillb
left a comment
There was a problem hiding this comment.
My problem with this is it is potentially a breaking change, so we should merge and apply it the same time we change the default NodeJS version (to 20) at the next major release (4.0.0?).
I'm pretty sure this will break users that are extending the flowfuse/device-agent container (e.g. "windows") as the active user will change from root to a user that can not install apk packages or create new directories.
There is a workaround for the existing container which is to pass -u 1000:1000 to set the uid and gid to 1000 so as not to run as root.
Need to think about this some more
|
NodeJS v20 has been in maintenance for a long time, and EOL is scheduled for April/May this year. IMO if we are thinking about a breaking change release, we should aim for at least NodeJS v22 (v24 preferably) to avoid having another breaking change release in the middle of 2026. |
I agree, this is a breaking change - pulling the latest version of an image and starting a Device Agent container without any adjustments will cause a failure, since non-root user will not be able to write to directories/files owned by root (and assuming common system-wide 0022 umask). This should go in parallel with the default NodeJS version change. |
Description
This pull request changes the way how the device-agent runs inside a container. Instead of using a root user, a custom
flowfuseone is created during the container build process.Additionally, it:
Related Issue(s)
Closes #562
Checklist
flowforge.yml?FlowFuse/helmto update ConfigMap TemplateFlowFuse/CloudProjectto update values for Staging/ProductionLabels
area:migrationlabel