Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .woodpecker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Woodpecker CI pipeline.
# Server: ci.lthn.sh. Lint + sonar in parallel, both depend only on clone.
# sonar_token is admin-scoped on the Woodpecker server.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid admin-scoped Sonar tokens in CI.

Line 3 indicates the pipeline uses an admin-scoped token. That is broader access than needed and increases blast radius if leaked. Use a project-scoped analysis token instead and rotate the current secret.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.woodpecker.yml at line 3, The Sonar admin-scoped token referenced as
sonar_token in .woodpecker.yml must be replaced with a project-scoped analysis
token: generate a new project-scoped token in SonarQube (or SonarCloud), rotate
and revoke the existing admin token, then update the CI secret referenced by
sonar_token with the new project token and confirm only analysis permissions are
granted; ensure the pipeline variable name (sonar_token) and any references in
the pipeline/script remain consistent and validate the pipeline run to confirm
analysis works with the scoped credential.


when:
- event: push
branch: [dev, main]

steps:
- name: phpstan
image: ghcr.io/phpstan/phpstan:latest
depends_on: []
commands:
- if [ -f phpstan.neon ] || [ -f phpstan.neon.dist ]; then phpstan analyse --no-progress --memory-limit=1G; else echo 'no phpstan config — sonar-only'; fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "PHPStan config files:"
fd -HI -t f 'phpstan.neon*' || true

for f in $(fd -HI -t f 'phpstan.neon*'); do
  echo
  echo "---- $f ----"
  rg -n 'autoload|bootstrap|includes|extension|vendor/' "$f" || true
done

echo
echo "Composer manifests (if present):"
fd -HI -t f 'composer.json' || true

Repository: dAppCore/php

Length of output: 200


🏁 Script executed:

cat phpstan.neon

Repository: dAppCore/php

Length of output: 867


🏁 Script executed:

cat .woodpecker.yml

Repository: dAppCore/php

Length of output: 754


🏁 Script executed:

wc -l .woodpecker.yml && cat -n .woodpecker.yml

Repository: dAppCore/php

Length of output: 934


🏁 Script executed:

# Check if there's a composer.lock and if vendor directory would be cloned
fd -t d vendor

Repository: dAppCore/php

Length of output: 38


Install Composer dependencies before running PHPStan analysis.

The phpstan container executes without composer install, so vendor dependencies are unavailable. Since the code depends on Laravel (visible in phpstan.neon's larastan configuration), PHPStan cannot resolve framework types and will produce incomplete analysis.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.woodpecker.yml at line 14, The CI step runs phpstan but never installs PHP
dependencies, so Laravel types from vendor are missing; before running the
phpstan command in the job that checks for phpstan.neon, add a step to run
composer install (e.g., run composer install --no-interaction --prefer-dist
--no-progress --no-scripts) so vendor/ is populated; update the block that
references phpstan.neon/phpstan.neon.dist to first ensure composer install (or
gate on composer.json) so phpstan/larastan can resolve framework types.

- name: sonar
image: sonarsource/sonar-scanner-cli:latest
depends_on: []
environment:
SONAR_HOST_URL: https://sonar.lthn.sh
SONAR_TOKEN:
from_secret: sonar_token
commands:
- sonar-scanner
61 changes: 23 additions & 38 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,91 +1,76 @@
module dappco.re/go/php

go 1.26.0
go 1.26.2

require (
dappco.re/go/cli v0.8.0-alpha.1
dappco.re/go/i18n v0.8.0-alpha.1
dappco.re/go/io v0.8.0-alpha.1
dappco.re/go v0.9.0
dappco.re/go/cli v0.9.0
dappco.re/go/i18n v0.9.0
dappco.re/go/io v0.9.0
github.com/dunglas/frankenphp v1.12.1
github.com/stretchr/testify v1.11.1
gopkg.in/yaml.v3 v3.0.1
)

require (
dappco.re/go/core v0.8.0-alpha.1
dappco.re/go/api v0.8.0-alpha.1
dappco.re/go/i18n v0.8.0-alpha.1
dappco.re/go/io v0.8.0-alpha.1
dappco.re/go/log v0.8.0-alpha.1
dappco.re/go/process v0.8.0-alpha.1
dappco.re/go/scm v0.8.0-alpha.1
dappco.re/go/store v0.8.0-alpha.1
dappco.re/go/ws v0.8.0-alpha.1
dappco.re/go/core v0.8.0-alpha.1 // indirect
dappco.re/go/inference v0.8.0-alpha.1 // indirect
dappco.re/go/log v0.8.0-alpha.1 // indirect
github.com/klauspost/compress v1.18.5 // indirect
github.com/stretchr/testify v1.11.1 // indirect
)

require (
dappco.re/go/inference v0.9.0 // indirect
dappco.re/go/log v0.9.0 // indirect
Comment on lines 14 to +21
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
govulncheck ./...

Repository: dAppCore/php

Length of output: 108


🏁 Script executed:

# Check if go.mod exists and examine its contents
if [ -f "go.mod" ]; then
  echo "=== go.mod found ==="
  cat -n go.mod
else
  echo "=== go.mod NOT found ==="
  find . -name "go.mod" -type f 2>/dev/null | head -20
fi

Repository: dAppCore/php

Length of output: 3477


🏁 Script executed:

# Search for Mercure in the dependency files
if [ -f "go.sum" ]; then
  echo "=== Searching for mercure in go.sum ==="
  rg "mercure" go.sum || echo "No mercure found in go.sum"
fi

Repository: dAppCore/php

Length of output: 271


🌐 Web query:

GHSA-hwr4-mq23-wcv5 github.com/dunglas/mercure security advisory

💡 Result:

GHSA-hwr4-mq23-wcv5 is a GitHub security advisory for the Mercure project (github.com/dunglas/mercure), published on April 8, 2026. It describes a cache key collision vulnerability in the TopicSelectorStore component. Vulnerability details: The cache key was constructed by concatenating the topic selector and topic with an underscore separator (k = "m_" + topicSelector + "_" + topic). Since both can contain underscores, distinct pairs can collide, e.g., selector="foo_bar" topic="baz" and selector="foo" topic="bar_baz" both produce "m_foo_bar_baz". An attacker who can subscribe or publish with crafted topics can poison the cache, causing private updates to be delivered to unauthorized subscribers or blocking authorized ones (CWE-1289: Improper Validation of Integrity Check Value). Impact: Bypasses authorization checks on private updates if the attacker can interact with the hub. Affected versions: < 0.22.0 Patched in: v0.22.0 (released April 8, 2026), which replaces string keys with a typed struct {topicSelector string; topic string} for collision-free hashing, removes sharded cache (~38% faster), and uses a single otter cache. Workaround: Disable topic selector cache by setting topic_selector_cache to -1 in Caddyfile or 0 in library usage (reduces performance). Severity: High (CVSS v4: 7.1 AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:L/SC:N/SI:N/SA:N) CVE: CVE-2026-39972 References: Official advisory at GHSA-hwr4-mq23-wcv5, GitHub advisories GHSA-hwr4-mq23-wcv5, release https://github.com/dunglas/mercure/releases/tag/v0.22.0.

Citations:


Upgrade github.com/dunglas/mercure to v0.22.0 or later to address GHSA-hwr4-mq23-wcv5.

The dependency graph includes github.com/dunglas/mercure v0.21.11, which is vulnerable to a high-severity cache key collision issue (CVSS 7.1) that bypasses authorisation checks on private updates. This has been patched in v0.22.0. Upgrade the dependency and verify the updated graph before merging.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go.mod` around lines 14 - 21, Update the vulnerable module
github.com/dunglas/mercure to v0.22.0 or later in go.mod (replace/add a require
entry for github.com/dunglas/mercure v0.22.0+), then run your module maintenance
to refresh the dependency graph and checks (e.g., run go mod tidy and verify
with go list -m all or go mod graph) to ensure the upgraded version is resolved
and go.sum updated before merging.

github.com/MauriceGit/skiplist v0.0.0-20211105230623-77f5c8d3e145 // indirect
github.com/RoaringBitmap/roaring/v2 v2.15.0 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.24.4 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/charmbracelet/bubbletea v1.3.10 // indirect
github.com/charmbracelet/colorprofile v0.4.3 // indirect
github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 // indirect
github.com/charmbracelet/x/ansi v0.11.6 // indirect
github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
github.com/charmbracelet/x/term v0.2.2 // indirect
github.com/clipperhouse/displaywidth v0.11.0 // indirect
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dunglas/mercure v0.21.11 // indirect
github.com/dunglas/skipfilter v1.0.0 // indirect
github.com/e-dant/watcher v0.0.0-20260223030516-06f84a1314be // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
github.com/gofrs/uuid/v5 v5.4.0 // indirect
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
github.com/gorilla/handlers v1.5.2 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.21 // indirect
github.com/maypok86/otter/v2 v2.3.0 // indirect
github.com/mschoch/smat v0.2.0 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.67.5 // indirect
github.com/prometheus/procfs v0.20.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/rs/cors v1.11.1 // indirect
github.com/sagikazarmark/locafero v0.12.0 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/cobra v1.10.2 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/spf13/viper v1.21.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/unrolled/secure v1.17.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
go.etcd.io/bbolt v1.4.3 // indirect
go.yaml.in/yaml/v2 v2.4.4 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.49.0 // indirect
golang.org/x/net v0.52.0 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/term v0.41.0 // indirect
golang.org/x/text v0.35.0 // indirect
golang.org/x/crypto v0.50.0 // indirect
golang.org/x/net v0.53.0 // indirect
golang.org/x/sys v0.43.0 // indirect
golang.org/x/term v0.42.0 // indirect
golang.org/x/text v0.36.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect
)

replace (
dappco.re/go/cli => ./internal/clishim
dappco.re/go/i18n => ./internal/i18nshim
)
Loading
Loading