[UI] UI container should NOT run with root privilege
Security guidelines would suggest running the containers without root privilege. However, both opea/chatqna-ui and opea/chatqna-conversation-ui requires root privilege to run. It brings potential risk to the system when the UI is running as a pod within Kubernetes such as privilege escalation, container escape, etc.
When running as non-root user of opea/chatqna-ui image,it fails with the following logs:
failed to load config from /home/user/svelte/vite.config.ts
error when starting preview server:
Error: EACCES: permission denied, open '/home/user/svelte/vite.config.ts.timestamp-1741934587046-d9551c9aabbc1.mjs'
When running as non-root user of opea/chatqna-conversation-ui, it fails with the following logs:
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/env.sh
APP_DATA_PREP_GET_FILE_URL=/v1/dataprep/get
sed: can't create temp file '/usr/share/nginx/html/assets/index-CMyKwVIa.cssXXXXXX': Permission denied
APP_DATA_PREP_SERVICE_URL=/v1/dataprep/ingest
sed: can't create temp file '/usr/share/nginx/html/assets/index-CMyKwVIa.cssXXXXXX': Permission denied
APP_BACKEND_SERVICE_ENDPOINT=/v1/chatqna
sed: can't create temp file '/usr/share/nginx/html/assets/index-CMyKwVIa.cssXXXXXX': Permission denied
APP_DATA_PREP_DELETE_FILE_URL=/v1/dataprep/delete
sed: can't create temp file '/usr/share/nginx/html/assets/index-CMyKwVIa.cssXXXXXX': Permission denied
This is not limited to chatqna-ui only, but is common for most of the svelte and react UI in GenAIExamples.
Implementation of the Conversational UI requires root privilege to run
Why? Node / JS in general does not require that...
@Ruoyu-y
Is this issue resolved?
@jaswanth8888
It decreases the security of OPEA. This is a critical issue.
Pleased resolve is ASAP.
I don't think this is specific to ChatQnA, I think it concerns all UIs containers?
@xiguiw please tag also related ticket in "GenAIInfra": https://github.com/opea-project/GenAIInfra/issues/500
I've updated the bug description to be more precise. It's a common security bug for all svelte and react UIs. @xiguiw we need the maintainers to assign this to the correct owners.
Ok, first issue seems to be wrong read access to config file, and second one is temp files being written to wrong location. If you make those 2 locations writable by non-root, are there additional issues?
Hi @WenjiaoYue please help to consider the feature, thanks [Remind]
[Remind]:
@sgurunat Please help on this issue for React UI, thanks!
@WenjiaoYue Please help on this issue for svelte UI, Thanks!
@xiguiw - Will look into this issue for React UI
I don't think this is specific to ChatQnA, I think it concerns all UIs containers?
@xiguiw please tag also related ticket in "GenAIInfra": opea-project/GenAIInfra#500
@eero-t
- Yes. opea-project/GenAIInfra#500 UI pod is run with full privileges has dependency on this.
- It's not ChatQnA specific, the other examples UI have the same issue.
[Remind] @WenjiaoYue Please look into this issue for svelte UI
Just update for remind.
We have no resource for this issue for now, and v1.4 is approaching feature freeze. Let's solve it in v1.5.