This repository was archived by the owner on Jul 28, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Fixed Java container installing gnupg #45
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| FROM mcr.microsoft.com/devcontainers/java:1-21-bookworm | ||
|
|
||
| # Ensure gnupg/curl available and add Yarn APT public key so apt can verify the repo | ||
| RUN set -eux \ | ||
| # Temporarily move Yarn APT source if present so apt-get update doesn't fail | ||
| && mv /etc/apt/sources.list.d/yarn*.list /tmp/ 2>/dev/null || true \ | ||
| && apt-get update \ | ||
| && apt-get install -y --no-install-recommends gnupg dirmngr ca-certificates curl \ | ||
| && curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor -o /usr/share/keyrings/yarn-archive-keyring.gpg \ | ||
| # Restore any moved Yarn source list(s) | ||
| && mv /tmp/yarn*.list /etc/apt/sources.list.d/ 2>/dev/null || true \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "features": { | ||
| "ghcr.io/devcontainers/features/dotnet:2.3.0": { | ||
| "version": "2.3.0", | ||
| "resolved": "ghcr.io/devcontainers/features/dotnet@sha256:edcfa7fed1eb62fc3b742b5a13e2279da4721dfd766819f04b24f4981ae99764", | ||
| "integrity": "sha256:edcfa7fed1eb62fc3b742b5a13e2279da4721dfd766819f04b24f4981ae99764" | ||
| }, | ||
| "ghcr.io/devcontainers/features/java:1": { | ||
| "version": "1.8.0", | ||
| "resolved": "ghcr.io/devcontainers/features/java@sha256:9663ce0219ff85786e87901ce5f0a59f488edd5f99b46015192cda48468b233a", | ||
| "integrity": "sha256:9663ce0219ff85786e87901ce5f0a59f488edd5f99b46015192cda48468b233a" | ||
| }, | ||
| "ghcr.io/devcontainers/features/python:1": { | ||
| "version": "1.8.0", | ||
| "resolved": "ghcr.io/devcontainers/features/python@sha256:fbcad6955caeecc5ad3f7886baf652e25cba5225a6c4c2287c536de2e5607511", | ||
| "integrity": "sha256:fbcad6955caeecc5ad3f7886baf652e25cba5225a6c4c2287c536de2e5607511" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semgrep identified an issue in your code:
By not specifying a USER, a program in the container may run as 'root'. This is a security hazard. If an attacker can control a process running as root, they may have control over the container. Ensure that a USER directive is defined in the Dockerfile.
To resolve this comment:
✨ Commit fix suggestion
Keep the base image as-is, but add a
USERdirective in the Dockerfile so the container does not start asroot.Place the
USERdirective after theRUNsteps that need package installation, becauseapt-getusually requires root privileges.Switch to a non-root account that already exists in this base image, if available. For Microsoft devcontainer images, that is commonly
vscode, so addUSER vscodenear the end of the Dockerfile.Update file ownership before switching users if later steps need write access to application directories. For example, use
RUN chown -R vscode:vscode /path/to/appbeforeUSER vscode.Alternatively, if this image does not already include a non-root user, create one first and then switch to it with
USER appuser. For example, addRUN useradd -m -u 10001 appuserand thenUSER appuser. Running as a non-root user limits what an attacker can do inside the container.💬 Ignore this finding
Reply with Semgrep commands to ignore this finding.
/fp <comment>for false positive/ar <comment>for acceptable risk/other <comment>for all other reasonsAlternatively, triage in Semgrep AppSec Platform to ignore the finding created by missing-user-definition.
🛟 Help? Slack #semgrep-help or go/semgrep-help.
Resolution Options:
/fp $reason(if security gap doesn’t exist)/ar $reason(if gap is valid but intentional; add mitigations/monitoring)/other $reason(e.g., test-only)You can view more details about this finding in the Semgrep AppSec Platform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ar as these containers run in GitHub's infra or in Instruqt, never on Atlas this "risk" is harmless. They can destroy the container if they want.