Repository navigation
fix: validate embedded app paths with filepath.IsLocal - #2721
Merged
Merged
Conversation
This was referenced Oct 16, 2026
dunglas
added a commit
that referenced
this pull request
Oct 21, 2026
…own (#2724) `tests/shutdown_test.sh` (added in #2645) failed on #2721 with `FAIL: PHP request failed with curl exit code 55` ([job](https://github.com/php/frankenphp/actions/runs/38898098911/job/116963348236)). The failure lines up with the last server log line, `servers shutting down; grace period initiated`, logged when Caddy closes its listeners after `shutdown_delay`. Closing a listening socket resets the connections still waiting in its accept queue. Depending on when the reset reaches curl, the request fails with 52 (empty reply), 56 (receive error) or 55 (send error). The test already treated 52 and 56 as `closing`, but not 55, which needs the reset to arrive between `connect()` and the first `send()`. Stressing the shutdown in a Linux container (40 restarts, 24 concurrent clients, ~36k requests against `main`) produced 29 × 52 and 30 × 56 at listener close and no other errors, so 55 is the same race with a narrower window. The server can't prevent it, so the test now accepts 55 too. The checks that matter are unchanged: requests served during `shutdown_delay`, in-flight requests drained, PHP shut down last. The patched script passed 10/10 runs in the same container.
dunglas
added a commit
that referenced
this pull request
Oct 21, 2026
CodeQL has not analyzed the repository since October 2024. Default setup is disabled, and its last C/C++ run failed because autobuild can't find the PHP headers. This adds an advanced setup workflow that installs ZTS PHP through the existing `setup-php` action, exports `php-config --includes` as `CGO_CFLAGS`, and builds both the root module and `caddy/` so the tracers see the C and Go compilations. It covers `actions`, `c-cpp` and `go` on pull requests, pushes to `main`, and weekly. Notes: - The Go build cache is disabled for this job: a warm cache skips the compiler invocations CodeQL traces. - `caddy/` is built from its own `working-directory` because the Go tracer doesn't recognize `go -C`. - CodeQL's Go extractor records files that use cgo (`frankenphp.go`, `worker.go`, …) under their generated copies in `GOCACHE`, so Go alerts in those files are dropped. C sources and pure Go files (including the whole Caddy module) are covered. - GitHub default setup must stay disabled, otherwise the two configurations conflict. Running the default suites locally on top of this branch reports two issues, fixed separately: - #2721 (`go/zipslip`, https://github.com/php/frankenphp/security/code-scanning/1) - #2722 (`go/incorrect-integer-conversion`, 7 occurrences in `caddy/`)
dunglas
marked this pull request as ready for review
October 21, 2026 10:47
dunglas
force-pushed
the
fix/embed-islocal
branch
from
October 21, 2026 10:49
4e096c2 to
768df2e
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Replaces the
nativeRelPathhelper copied fromx/buildwithfilepath.IsLocal, which rejects absolute paths,..traversal, volume names and, on Windows, reserved names. The behavior is the same for valid archives and the code is shorter.CodeQL recognizes
filepath.IsLocalas a path sanitizer, which resolves https://github.com/php/frankenphp/security/code-scanning/1. The archive is embedded at build time, so this alert was not exploitable in practice.Found while setting up CodeQL in #2720.