-
Notifications
You must be signed in to change notification settings - Fork 0
KPMP 6426 update vulns #62
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| FROM alpine:3.19.1 | ||
| FROM alpine:3.22.4 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win Dockerfile is now orphaned by the migration. With the move to Note: the Trivy "USER should not be root" finding is moot if the file is removed; if you choose to keep the 🧰 Tools🪛 Trivy (0.69.3)[error] 1-1: Image user should not be 'root' Specify at least 1 USER command in Dockerfile with non-root user as argument Rule: DS-0002 (IaC/Dockerfile) |
||
|
|
||
| RUN apk update && \ | ||
| apk upgrade | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,17 +3,16 @@ buildscript { | |
| mavenCentral() | ||
| } | ||
| dependencies { | ||
| classpath("org.springframework.boot:spring-boot-gradle-plugin:3.2.2") | ||
| classpath("org.springframework.boot:spring-boot-gradle-plugin:4.0.6") | ||
| } | ||
| } | ||
|
|
||
| plugins { | ||
| id 'com.palantir.docker' version '0.35.0' | ||
| id 'org.springframework.boot' version '3.2.2' | ||
| id 'org.springframework.boot' version '4.0.6' | ||
| } | ||
|
|
||
| group='kingstonduo' | ||
| version='1.11.0' | ||
| version='1.12.0' | ||
|
|
||
|
|
||
| apply plugin: 'java' | ||
|
|
@@ -37,29 +36,20 @@ dependencies { | |
| implementation 'org.springframework.boot:spring-boot-starter-cache' | ||
| implementation 'org.springframework.boot:spring-boot-starter-web' | ||
| implementation 'org.springframework.boot:spring-boot-starter-data-jpa' | ||
| implementation 'org.springframework.boot:spring-boot-starter-graphql' | ||
| implementation 'com.fasterxml.jackson.core:jackson-databind' | ||
| implementation 'com.mysql:mysql-connector-j:8.3.0' | ||
| implementation 'org.apache.commons:commons-text:1.12.0' | ||
|
|
||
| implementation 'com.graphql-java:graphql-spring-boot-starter:5.0.2' | ||
| implementation 'com.graphql-java:graphiql-spring-boot-starter:5.0.2' | ||
| implementation 'com.graphql-java:graphql-java-tools:5.2.4' | ||
|
|
||
| testImplementation('org.mockito:mockito-junit-jupiter:3.12.4') | ||
| testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
| testImplementation 'org.springframework:spring-test:5.2.25.RELEASE' | ||
| testImplementation 'org.mockito:mockito-core' | ||
| } | ||
|
|
||
| springBoot { | ||
| mainClass = "org.kpmp.Application" | ||
| } | ||
|
|
||
| task unpack(type: Copy) { | ||
| dependsOn bootJar | ||
| from(zipTree(tasks.bootJar.outputs.files.singleFile)) | ||
| into("build/dependency") | ||
| } | ||
|
|
||
| def getCurrentGitBranch() { | ||
| if (project.hasProperty('tag')) { | ||
| def tagValue = project.property('tag') | ||
|
|
@@ -83,9 +73,10 @@ def getCurrentGitBranch() { | |
| } | ||
| } | ||
|
|
||
|
|
||
| docker { | ||
| name "kingstonduo/hydra-data:" + getCurrentGitBranch() | ||
| copySpec.from(tasks.unpack.outputs).into("dependency") | ||
| buildArgs(['DEPENDENCY': "dependency"]) | ||
| bootBuildImage { | ||
| imageName = "kingstonduo/hydra-data:" + getCurrentGitBranch() | ||
| createdDate = "now" | ||
| } | ||
|
|
||
| // Docker image building is now handled by Spring Boot's bootBuildImage task | ||
| // Usage: ./gradlew bootBuildImage | ||
|
Comment on lines
+81
to
+82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win Stale Dockerfile left behind after migrating to
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip | ||
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists |
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.
🧩 Analysis chain
🏁 Script executed:
Repository: KPMP/hydra-data
Length of output: 1699
🏁 Script executed:
Repository: KPMP/hydra-data
Length of output: 102
🏁 Script executed:
Repository: KPMP/hydra-data
Length of output: 3929
🏁 Script executed:
Repository: KPMP/hydra-data
Length of output: 1195
🌐 Web query:
actions/checkout v3 detached HEAD default behavior push event rev-parse --abbrev-ref HEAD💡 Result:
In GitHub Actions, with actions/checkout v3, when the workflow is triggered by a push and you do not explicitly set
ref, the action checks out the commit for the event in detached HEAD mode (sogit rev-parse --abbrev-ref HEADprintsHEAD, not a branch name). This detached-head behavior is because the action checks out a specific commit/ref rather than creating/checking out a local branch by default.[1][2] Whatgit rev-parse --abbrev-ref HEADreturns: - In detached HEAD state,--abbrev-refcannot resolve a “current branch” symbolic ref, so it outputsHEAD(i.e., the name of the commit-ish you’re on).[1][3] How to get the branch name for a push event (recommended): - Use GitHub context variables rather than parsinggitmetadata. For example, for push workflows you can useGITHUB_REF_NAME(orGITHUB_REF) to get the branch/ref that triggered the workflow. (This avoids relying on the detached-HEAD checkout that actions/checkout performs.)[2] If you truly need a local branch in the runner: - You can create/switch to a branch after checkout (e.g., usinggit switch -c <name>), but note this is a separate step and doesn’t change that checkout itself happens detached.[2] Notes on other checkout-related defaults (unrelated to the detached HEAD behavior): - actions/checkout fetches only a single commit by default (unless you setfetch-depth). It documentsfetch-depthand that0means fetch all history.[4][5]Citations:
🏁 Script executed:
Repository: KPMP/hydra-data
Length of output: 3100
Critical: Docker push tag likely mismatches Gradle-built image tag (detached HEAD).
bootBuildImagetags the image askingstonduo/hydra-data:+getCurrentGitBranch(), andgetCurrentGitBranch()runsgit rev-parse --abbrev-ref HEAD. Withactions/checkout@v3(noref:) onon: push, the checkout is in detached-HEAD by default, sorev-parse --abbrev-ref HEADreturnsHEADand the built image tag becomeskingstonduo/hydra-data:HEAD(not the branch name).As a result, both Docker Hub push steps can fail: the
developstep pushes...:${{ env.IMAGE_TAG }}(1.12.0) and the non-develop step pushes...:${{ steps.branch-names.outputs.current_branch }}(e.g.,feature/...)—neither matches...:HEAD.🧰 Tools
🪛 zizmor (1.25.2)
[info] 49-49: code injection via template expansion (template-injection): may expand into attacker-controllable code
(template-injection)