Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use non-root user in Docker #571

Merged
merged 10 commits into from
Feb 20, 2024
Merged

Conversation

tangowithfoxtrot
Copy link
Contributor

@tangowithfoxtrot tangowithfoxtrot commented Feb 1, 2024

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

Use a non-root user in Docker. There doesn't seem to be an agreed upon standard for what to name the non-root user, so I named it app, as I followed the general guidance from this MS blog post.

A BWS_CONFIG_FILE environment variable was added to bws as well to make it easier to avoid guessing where the correct config file dir is if you are unaware of the app user's name (and therefor, their home directory).

Code changes

  • crates/bws/Dockerfile: Use a non-root user.
  • crates/bws/README.md: Document using the CLI with Docker.
  • crates/bws/src/main.rs: Add BWS_CONFIG_FILE environment variable.
  • crates/bws/CHANGELOG.md: Update changelog.

Before you submit

  • Please add unit tests where it makes sense to do so

@tangowithfoxtrot tangowithfoxtrot marked this pull request as ready for review February 1, 2024 17:24
Copy link

codecov bot commented Feb 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1b636e3) 59.41% compared to head (75b62ff) 59.41%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #571   +/-   ##
=======================================
  Coverage   59.41%   59.41%           
=======================================
  Files         171      171           
  Lines       10342    10342           
=======================================
  Hits         6145     6145           
  Misses       4197     4197           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bitwarden-bot
Copy link

bitwarden-bot commented Feb 1, 2024

Logo
Checkmarx One – Scan Summary & Details7b524e4a-98a3-4878-852d-1ba881e48119

Fixed Issues

Severity Issue Source File / Package
HIGH Missing User Instruction /Dockerfile: 23

crates/bws/README.md Outdated Show resolved Hide resolved
Copy link
Member

@dani-garcia dani-garcia left a comment

Choose a reason for hiding this comment

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

LGTM now

Copy link
Member

@coltonhurst coltonhurst left a comment

Choose a reason for hiding this comment

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

Thanks for adding the BWS_CONFIG_FILE option 🎉

@tangowithfoxtrot tangowithfoxtrot merged commit ff94313 into main Feb 20, 2024
60 checks passed
@tangowithfoxtrot tangowithfoxtrot deleted the sm/SM-1083/dockerfile-as-non-root branch February 20, 2024 18:40
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.

5 participants