feat(config): add hub.allowedOrigins and notebook.allowedOrigins for origin policy#47
Merged
KerwinTsaiii merged 2 commits intodevelopfrom Mar 25, 2026
Merged
Conversation
…ocket origins Add a native YAML-based configuration field `custom.allowedOrigins` to control allowed origins for notebook server WebSocket connections, replacing the need for raw Python injection via `hub.extraConfig`. - ParsedConfig: add `allowedOrigins: list[str]` field - HubConfig: expose `allowed_origins` property - RemoteLabKubeSpawner: inject `--ServerApp.allow_origin_pat` (and `--ServerApp.allow_origin=*` when wildcard is set) into notebook server startup args at spawn time - chart/values.yaml: document new field under `custom` - chart/values.schema.yaml + values.schema.json: add schema definition - runtime/values.yaml: add commented usage examples
Replace the flat `custom.allowedOrigins` field with two clearly scoped fields: - `custom.hub.allowedOrigins`: sets Access-Control-Allow-Origin on Hub HTTP responses via JupyterHub tornado_settings - `custom.notebook.allowedOrigins`: injected into each notebook server's startup args via --ServerApp.allow_origin_pat, targeting kernel WebSocket connections Naming avoids confusion with the z2jh top-level `singleuser` section. Schema updated in values.schema.yaml and values.schema.json.
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.
Summary
Add native YAML configuration for controlling allowed origins on Hub and notebook servers separately, replacing the need for raw Python in
hub.extraConfig.custom.hub.allowedOrigins: setsAccess-Control-Allow-Originon Hub HTTP responses viaJupyterHub.tornado_settingscustom.notebook.allowedOrigins: injected into each notebook server's startup args via--ServerApp.allow_origin_pat, for kernel WebSocket connections behind a reverse proxynotebook(notsingleuser) to avoid confusion with the z2jh top-levelsingleusersectionvalues.schema.yamland regeneratedvalues.schema.jsonUsage
Test plan
helm upgrade --dry-runpasses with no errors or warningsnotebook.allowedOrigins: ["*"]and verify kernel WebSocket works through reverse proxyhub.allowedOrigins: ["*"]and verifyAccess-Control-Allow-Originheader appears on Hub responses