← Back to Pull requests

docker: SGLang v0.5.23 secure-r2 image #510

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 17, 2026 14:47 UTC
Author

Supersedes #481 for this dir. Adds docker/sglang-v0.5.23-secure-r2 and its publish workflow: stock lmsysorg/sglang v0.5.23 by digest, with exact-rid aborts, credential and request-content log redaction, request validation, a token-id range check, and the sglang-diffusion media URL and request-field policy. One build dir, no compose file changes. Nothing is pinned to this image yet; a later PR adds the digest, its images.allow row and its docs/verifying.md rows.

Engine variables and flags this image reads

Every one is read inside the image. None is set by any compose file in this PR.

| variable or flag | default | at the default |
|---|---|---|
| SGLANG_ALLOW_LOCAL_MEDIA_PATHS | unset | changes behaviour: file:// URLs and server paths in image, audio and video inputs get a 400; sglang-diffusion loaders read only files the server saved itself |
| SGLANG_TRUST_CALLER_MM_HASHES | unset | moved default: the server computes the multimodal cache identity; caller mm_hashes and the hash / pad_value of preprocessed items are ignored |
| SGLANG_DIFFUSION_ALLOW_PRIVATE_MEDIA_URLS | unset | changes behaviour: sglang-diffusion fetches client media URLs only from public addresses, without reading proxy settings |
| SGLANG_DIFFUSION_ALLOW_REQUEST_DEBUG_FIELDS | unset | changes behaviour: 400 on perf_dump_path, profile, profile_all_stages, upscaling_model_path and frame_interpolation_model_path in diffusion requests |
| --audio-transcription-max-file-size-mb (new server flag) | 25 | changes behaviour: 413 on larger /v1/audio/transcriptions uploads; 0 turns the cap off |

SGLANG_MAX_BATCH_REQS_PER_HTTP_REQ already exists in stock v0.5.23; patch 05 also uses it as the upper bound of n on /generate. Patches 05-07, 10-12 and 17 return a 400 for request values stock v0.5.23 accepts; the README lists them. No new sink, endpoint, port or mount. No secret-suffixed variable is introduced.

Review items

1. Runner: the publish job runs on the standard ubuntu-24.04 runner, the label the workflows on main use, so lint passes without a config change. It removes preinstalled toolchains the job never uses and fails early unless 100 GB is free (the base image is about 16 GB compressed and 57 GB unpacked), then releases the build storage before the scan pulls the published digest.
2. One build dir per PR: this PR carries only sglang-v0.5.23-secure-r2. sglang-v0.5.23-glm53-r2 follows in its own PR on top of this one.
3. Names describe behaviour: patches 02-credential-redaction, 03-request-content-log-redaction, 04-log-redaction-more-sites, 09-media-local-paths-opt-in, 11-expert-distribution-needs-recorder, 12-send-weights-group-validation, 15-diffusion-media-public-urls-only; tests test_credential_redaction.py, test_request_content_log_redaction.py, test_request_validation.py, test_diffusion_media_and_request_fields.py; the labels are one nearai.sglang.patch_series label plus nearai.python.packages and nearai.os.linux_libc_dev, which the workflow checks. SHA256SUMS, SERIES, the labels and the workflow's Dockerfile and SHA256SUMS pins are regenerated in the same commit as the files they cover.
4. Public text: README, Dockerfile comments, the comments and docstrings the patches add, the tests, the workflow, the commit messages and this body state what the image does. Where a patch carries upstream pull-request code (05-08, 10-12, 14), the comment and docstring lines it adds are reworded the same way; the code is upstream's.
5. Build-dir contract: no parser directive, final FROM equals PROVENANCE base_image, PROVENANCE has exactly the six keys, README.md is neither copied nor listed in SHA256SUMS, patches are numbered 01..17 without gaps, RUN fetches nothing unpinned (pip --require-hashes, apt name=version).
6. Secret scanner: the dummy API key in tests/test_credential_redaction.py is a low-entropy value the scanner does not flag, so ci/config/gitleaks.toml is unchanged.

Carried-over patches

Patches 01-04 have the same code as the patches 05-rid-abort-exact-match, 14-admin-auth-redaction, 15-customer-data-log-redaction and 26-log-format-followup of the deleted docker/sglang-glm53-v0523 dir, read at its last commit before deletion. 02 is byte-identical; 01, 03 and 04 differ only in comment and docstring lines. Patches 05-16 have the same code as patches 05-16 of this dir at #481's head (48310b8); all of them except 07 differ in comment and docstring lines, and 15 also skips one upstream unit-test case (an https source in test_prefer_remote_source_still_avoids_disk_io) instead of removing it from the parametrize list. 17 is new. Checked by applying both series to a clean 297e54fd checkout: the Python ASTs of every changed file match once docstrings are dropped, apart from that test skip.

Gates

No gate file changes. ci/data/images.allow: one row for the upstream base lmsysorg/sglang@sha256:f832b5c3… (- - -). No waiver, no expected.json change.

Evidence

<details><summary>verification</summary>

## branch docker-sglang-v0.5.23-secure-r2 on origin/main ff994fd

$ python3 ci/run.py --self-test
OK (293)
$ python3 ci/run.py --base origin/main
OK
$ PR_TITLE=... PR_BODY=... PR_BRANCH=docker-sglang-v0.5.23-secure-r2 python3 ci/run.py --base origin/main
OK

$ actionlint, zizmor --offline, yamllint (ci.yaml images)
OK

$ gitleaks dir . ; gitleaks git origin/main..HEAD (ci.yaml image and config)
no leaks found

## reproduced from the pinned upstream revision
$ git checkout 297e54fd105e974cdf401e5b4d20253a22c16f90   # clean tree
$ for p in $(grep -v '^#' SERIES | awk '{print $2}'); do git apply --check patches/$p && git apply patches/$p; done
applied 17 patches
$ sha256sum --check --strict SHA256SUMS
28 of 28 OK

## image built from this dir, CPU checks (no GPU test exists for this image)
$ docker run --rm --runtime runc --entrypoint bash <image> /usr/share/nearai/sglang-v0.5.23-secure-r2/test-cpu.sh
== 1 admin auth and credential redaction (credential-redaction)
== 2 request-content log redaction (request-content-log-redaction, log-redaction-more-sites)
== 3 upstream unit tests the patches add or edit (rid-abort-exact-match, credential-redaction, log-redaction-more-sites)
603 passed, 446 subtests passed
== 4 request validation: recipe checks and the upstream unit tests the validation patches add or edit
366 passed, 2 skipped, 187 subtests passed
== 5 sglang-diffusion media URL policy and operator-only request fields
254 passed, 1 skipped
== 6 upstream unit suites around the patches: no failure beyond stock v0.5.23's own
556 failed, 5547 passed, 375 skipped, 19 errors, 7890 subtests passed
sglang-v0.5.23-secure-r2 CPU checks passed
(the failures in the last step are all listed in tests/stock-v0523-known-failures.txt; the script fails on any other)

</details>

🤖 Generated with Claude Code

Diff: 650 lines (+487 / -163) across 8 files Reviewer: chatgpt-codex-connector[bot] Review duration: 5m
All Vouch review confidence checks passed
Residual risk 0.39 = Change Risk (0.52) × (1 − Review Confidence (0.25)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
0.52
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 33% · Reviewer familiarity: 35%
25%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.388
Shallow Review Depth shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #510"
general weight: 0.35
Assignees
Unassigned
Labels
risk: medium confidence: 25.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 52% (MEDIUM) · Higher = larger blast radius
52%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 25.5% · Lower = rushed or shallow review
25.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 38.8% · Moderate risk
38.8%