Skip to content

Fix/dockerfile non root user#397

Open
okyashgajjar wants to merge 3 commits into
imDarshanGK:mainfrom
okyashgajjar:fix/dockerfile-non-root-user
Open

Fix/dockerfile non root user#397
okyashgajjar wants to merge 3 commits into
imDarshanGK:mainfrom
okyashgajjar:fix/dockerfile-non-root-user

Conversation

@okyashgajjar
Copy link
Copy Markdown

@okyashgajjar okyashgajjar commented May 27, 2026

Description

Added a non-root user directive to both Dockerfile and
backend/Dockerfile. Neither file specified a USER directive,
meaning containers ran as root by default. If an attacker gains
container access, they would have full root control — violating
the principle of least privilege.

Fix applied to both files:

RUN adduser --disabled-password --gecos "" appuser
USER appuser

Related Issue

Fixes #389

Type of change

  • Bug fix

Checklist

  • I have read CONTRIBUTING.md
  • My branch is up to date with main
  • I have run pytest -v and all tests pass
  • I have not introduced duplicate issues or features
  • My PR title follows the format: fix: add non-root USER directive to Dockerfiles
  • No hardcoded secrets or API keys in my code
  • This PR is linked to a GSSoC 2026 issue

Test evidence

pytest -v
# 93 passed in 3.96s

@okyashgajjar okyashgajjar requested a review from imDarshanGK as a code owner May 27, 2026 09:15
@imDarshanGK
Copy link
Copy Markdown
Owner

@okyashgajjar update your branch with the latest main changes

@okyashgajjar okyashgajjar force-pushed the fix/dockerfile-non-root-user branch from 71ad0eb to 58b9410 Compare May 28, 2026 19:25
@okyashgajjar
Copy link
Copy Markdown
Author

Done @imDarshanGK Check this now.

@okyashgajjar okyashgajjar force-pushed the fix/dockerfile-non-root-user branch 2 times, most recently from 5c43a10 to b62a98e Compare May 28, 2026 20:06
@okyashgajjar
Copy link
Copy Markdown
Author

image image

whoever contributed to this an updates is failing due to frontend checks errors.

@okyashgajjar
Copy link
Copy Markdown
Author

Although I updated my branches with latest main changes

You can merge it

also issued PR #437 - check this and allow me i'll update the code.

@imDarshanGK
Copy link
Copy Markdown
Owner

@okyashgajjar update the branch with the latest main changes

@okyashgajjar okyashgajjar force-pushed the fix/dockerfile-non-root-user branch from b62a98e to d04d9c9 Compare May 30, 2026 10:29
@okyashgajjar
Copy link
Copy Markdown
Author

@imDarshanGK Done updated, please merge this.

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.

Security: Docker container runs as root — missing USER directive (Dockerfile:19)

2 participants