Repository navigation
CI: report Clojure dependencies so Dependabot alerts cover them - #49
Conversation
Dependabot cannot read project.clj, so it watched only the workflows and the npm test tools. lein pom writes the dependencies as a Maven pom, which the submission action resolves and uploads; Dependabot alerts then cover the server's libraries. Weekly, on pushes and on pull requests.
…ond workflow The standalone workflow failed at Leiningen setup: the project's plugins and Datomic Pro need the setup the main job already does (local libs into ~/.m2, Datomic Pro installed). Submitting after its lein deps avoids duplicating forty lines. Push and manual runs only; a weekly schedule is not needed, because GitHub re-checks a submitted graph against new advisories by itself.
|
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: write |
There was a problem hiding this comment.
PR code gets write credentials
On a same-repository pull request that changes project.clj, this job checks out the proposed code and runs lein pom, which evaluates that file. Because the job has contents: write and checkout persists its token, code in the PR can use repository write credentials before it is merged. Run PR code with read-only permissions and reserve write-capable submission for a trusted context.
How this was verified: The pull-request job grants contents: write, checkout persists its token, and lein pom evaluates the checked-out project.clj.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/dependency-graph.yml
Line: 26
Comment:
**PR code gets write credentials**
On a same-repository pull request that changes `project.clj`, this job checks out the proposed code and runs `lein pom`, which evaluates that file. Because the job has `contents: write` and checkout persists its token, code in the PR can use repository write credentials before it is merged. Run PR code with read-only permissions and reserve write-capable submission for a trusted context.
**How this was verified:** The pull-request job grants `contents: write`, checkout persists its token, and `lein pom` evaluates the checked-out `project.clj`.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fixed in 050e7d4: pinned to fe8d4d650a4b66508612d0683ce4726d51dfe6ac, the commit v4 resolved to in our first run.
| pull_request: | ||
| branches: [integration, develop, main] |
There was a problem hiding this comment.
Fork PR submissions fail
When a pull request comes from a fork, its GITHUB_TOKEN is read-only despite this workflow requesting contents: write. The submission step uses that token, so it cannot upload the snapshot to the repository’s dependency graph. The new workflow fails for external contributors instead of reporting their dependencies.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/dependency-graph.yml
Line: 18-19
Comment:
**Fork PR submissions fail**
When a pull request comes from a fork, its `GITHUB_TOKEN` is read-only despite this workflow requesting `contents: write`. The submission step uses that token, so it cannot upload the snapshot to the repository’s dependency graph. The new workflow fails for external contributors instead of reporting their dependencies.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fixed in 050e7d4: pinned to fe8d4d650a4b66508612d0683ce4726d51dfe6ac, the commit v4 resolved to in our first run.
| sed -i 's#http://repository.apache.org#https://repository.apache.org#' pom.xml | ||
|
|
||
| - name: Submit the dependency snapshot | ||
| uses: advanced-security/maven-dependency-submission-action@v4 |
There was a problem hiding this comment.
Privileged action uses mutable tag
The third-party submission action runs with contents: write but is referenced by the mutable @v4 tag. If that tag changes upstream, different code can run with the job’s write credential without a change in this repository. Pinning it to an immutable commit would make updates deliberate.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/dependency-graph.yml
Line: 58
Comment:
**Privileged action uses mutable tag**
The third-party submission action runs with `contents: write` but is referenced by the mutable `@v4` tag. If that tag changes upstream, different code can run with the job’s write credential without a change in this repository. Pinning it to an immutable commit would make updates deliberate.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fixed in 050e7d4: pinned to fe8d4d650a4b66508612d0683ce4726d51dfe6ac, the commit v4 resolved to in our first run.
…a local action Greptile on #49: the test job runs pull-request code, so it must not hold contents: write. The submission is now a separate push-only job, the only one with write access, and the setup both jobs need (JDK, Leiningen, Maven cache, local libs, Datomic Pro, lein deps) lives once in .github/actions/setup-lein. The third-party submission action is pinned to a commit.
Reports the app's Clojure and Java libraries to GitHub's dependency graph, so the Dependabot alerts turned on today cover them. Dependabot cannot read
project.clj;lein pomwrites the same dependencies as a Maven pom, andadvanced-security/maven-dependency-submission-action(pinned to a commit) resolves and uploads them. It needs no secrets.dependency-graphjob in the main CI. It runs only on pushes and manual runs, and it is the only job withcontents: write. The test job, which runs pull-request code, keeps the read-only default..github/actions/setup-lein: JDK, Leiningen, the Maven cache, the local libs, Datomic Pro, andlein deps. Both jobs use it.A test run on this branch submitted 245 packages ("Snapshot successfully created").