Skip to content

Commit 7fe1e31

Browse files
reidspencerclaude
andcommitted
Fix SonarCloud bugs and vulnerabilities
Bug fix: - Pass.scala: Remove duplicate conditional branches that had identical code in both if and else blocks Vulnerability fixes: - hugo.yml: Move permissions from workflow level to job level - Build job: contents: read - Deploy job: pages: write, id-token: write Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 807bdba commit 7fe1e31

2 files changed

Lines changed: 9 additions & 16 deletions

File tree

.github/workflows/hugo.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ on:
1212
- '.github/workflows/hugo.yml'
1313

1414

15-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16-
permissions:
17-
contents: read
18-
pages: write
19-
id-token: write
20-
2115
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
2216
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2317
concurrency:
@@ -34,6 +28,8 @@ jobs:
3428
build:
3529
timeout-minutes: 30
3630
runs-on: ubuntu-latest
31+
permissions:
32+
contents: read
3733
env:
3834
HUGO_VERSION: 0.112.0
3935
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -114,6 +110,9 @@ jobs:
114110
# Deployment job
115111
deploy:
116112
timeout-minutes: 10
113+
permissions:
114+
pages: write
115+
id-token: write
117116
environment:
118117
name: github-pages
119118
url: ${{ steps.deployment.outputs.page_url }}

passes/shared/src/main/scala/com/ossuminc/riddl/passes/Pass.scala

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -338,16 +338,10 @@ abstract class DepthFirstPass(
338338
parents.pop()
339339
process(root, parents)
340340
case include: Include[?] =>
341-
if withIncludes then
342-
// Depth-first: process children first, then parent
343-
// Don't add Include to parent stack - contents belong to parent container
344-
include.contents.foreach { value => traverse(value, parents) }
345-
process(include, parents)
346-
else
347-
// NOTE: no push/pop here because include is an unnamed container and does not participate in parent stack
348-
include.contents.foreach { value => traverse(value, parents) }
349-
process(include, parents)
350-
end if
341+
// Depth-first: process children first, then parent
342+
// NOTE: no push/pop here because include is an unnamed container and does not participate in parent stack
343+
include.contents.foreach { value => traverse(value, parents) }
344+
process(include, parents)
351345
case leaf: Leaf =>
352346
process(leaf, parents)
353347
case branch: Branch[?] =>

0 commit comments

Comments
 (0)