Skip to content

fix: Address security audit findings (1.2) - #371

Draft
nielsenko wants to merge 16 commits into
serverpod:stable-1.2from
nielsenko:fix-sec-findings-1.2
Draft

fix: Address security audit findings (1.2)#371
nielsenko wants to merge 16 commits into
serverpod:stable-1.2from
nielsenko:fix-sec-findings-1.2

Conversation

@nielsenko

Copy link
Copy Markdown
Collaborator

No description provided.

@nielsenko nielsenko self-assigned this Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 662952d4-510d-4876-b659-b737f8669884

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nielsenko
nielsenko changed the base branch from main to stable-1.2 August 10, 2026 13:39
@nielsenko nielsenko changed the title TODO fix: Address security audit findings (1.2) Aug 10, 2026
use() on a catch-all was skipped for the prefix itself, so /api bypassed
the middleware that /api/keys ran.
Backported from serverpod#360 (RFC compliant typed headers) so the header-parsing
security fixes can build on the same primitives as main. The files are
deliberately not exported from relic_core.dart: they are an implementation
detail here, and keeping them internal leaves the 1.2.x public API surface
unchanged.
The unanchored regexes backtracked quadratically, wedging the isolate on a
long value. Text between auth-params is now rejected, not skipped.
Sections were materialised before the response returned, and the count was
unbounded, so a short request could ask for many times the file size.
Random().nextInt(1000000) gave ~20 bits, so boundaries repeated within a
few thousand responses.
Returning the future from inside the try skipped the catch, so a failed
response write left the connection open and the client waiting.
Rejects CR, LF and NUL where every header write funnels, so the defence is
Relic own rather than inherited from dart:io.
No such check exists. The page now says every file in the directory is
served, including dot files.
The host was only segment 0 of a flat string, so a path resolving upwards
could pop it and select another virtual host.
Decoding first turned %2F into a separator no upstream proxy ever saw.
NormalizedPath.fromUri names the safe conversion.
Refuse a mismatched Origin with 403; opt out with allowAnyOrigin. Only the
host is compared, since a TLS-terminating proxy changes scheme and port.
Breaking for apps relying on cross-origin sockets.
Emitted through ParameterValue, so a quote in a filename can no longer end
the value and append a filename*. Parsing is now quote-aware too, or Relic
could not read its own output.
An unescaped realm could close its value and graft a second challenge onto
the response.
io.ContentType takes the parts separately, so they bypassed the CR/LF check
dart:io applies to ordinary header values.
Hijacking and upgrading detach the connection from the underlying server,
which then reports and closes nothing, so a hijacked socket survived
close(force: true) and connectionsInfo() could not show it.

Track them in the adapter: a forced close destroys them, a graceful close
drains, sends 1001 to WebSocket peers, then closes the rest after a bounded
wait. 40 hijack cycles ignoring the socket leaked 80 sockets before, none
after.
The teardown closed with a 5s timeout and, on timeout, retried close with
none, so a shutdown that could not complete hung the suite instead of
reporting it. Close forcefully once: this test deliberately leaves the
hijacked connection open.

The timeout expectation was also never awaited, so it raced the teardown.
@nielsenko
nielsenko force-pushed the fix-sec-findings-1.2 branch from e9ab5d1 to 095f221 Compare August 10, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant