Repository navigation
feat (bbb-web): Introduce a new /create param clientSettingsOverrideJsonUrl - #24782
gustavotrott merged 4 commits into
Conversation
…presentation upload
WalkthroughThis pull request introduces a new feature enabling BigBlueButton to load client settings overrides from a remote JSON URL during meeting creation. The implementation adds a new API parameter Sequence Diagram(s)sequenceDiagram
actor Client
participant ApiController
participant ParamsProcessorUtil
participant ClientSettingsOverrideUrlValidator
participant RedirectFollowerService
participant SecureUrlDownloader
participant RemoteServer
Client->>ApiController: POST /create with clientSettingsOverrideJsonUrl param
ApiController->>ParamsProcessorUtil: processParameters()
ParamsProcessorUtil->>ClientSettingsOverrideUrlValidator: validateUrl(clientSettingsOverrideJsonUrl)
ClientSettingsOverrideUrlValidator->>ClientSettingsOverrideUrlValidator: Parse URL & validate protocol
ClientSettingsOverrideUrlValidator->>ClientSettingsOverrideUrlValidator: Check DNS resolution & IP validation
alt URL valid
ParamsProcessorUtil->>RedirectFollowerService: followRedirectSecure(validatedUrl)
RedirectFollowerService->>SecureUrlDownloader: downloadToString(contextId, validatedUrl, timeout, maxSize)
SecureUrlDownloader->>RemoteServer: HTTP GET (with pinned host header)
RemoteServer-->>SecureUrlDownloader: JSON response
SecureUrlDownloader->>SecureUrlDownloader: Validate JSON parseable
SecureUrlDownloader-->>ParamsProcessorUtil: JSON string
ParamsProcessorUtil->>ParamsProcessorUtil: meeting.setOverrideClientSettings(json)
else URL invalid or download fails
ParamsProcessorUtil->>ParamsProcessorUtil: Log error, skip URL override
end
ApiController->>ApiController: Apply clientSettingsOverride from POST body if URL override empty
ApiController-->>Client: Meeting created
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment Tip CodeRabbit can use OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.OpenGrep is compatible with Semgrep configurations. Add an |
|
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
docs/docs/data/create.tsx (1)
602-605: Call out that this URL is fetched server-side under fetch-url restrictions.This description currently reads like any public URL is acceptable. In practice BigBlueButton fetches it from the server side and applies protocol/host validation before downloading, so mentioning that here would save integrators from confusing
createfailures.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/docs/data/create.tsx` around lines 602 - 605, Update the description to explicitly state that the JSON URL is fetched server-side (not client-side) and is subject to server fetch-url restrictions and protocol/host validation before download; mention that integrators must provide an allowed/proxied URL to avoid create call failures, and keep the existing references to clientSettingsOverride and allowOverrideClientSettingsOnCreateCall to explain precedence and difference.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@bbb-common-web/src/main/java/org/bigbluebutton/api/service/impl/BaseUrlRedirectValidator.java`:
- Around line 38-45: The logs in BaseUrlRedirectValidator currently print the
full user-supplied redirectUrl in both success and error paths; create a shared
helper (e.g., a static utility method redactUrl(String)) that strips or masks
sensitive parts (query string, auth info, tokens) and use it wherever
redirectUrl is logged (replace direct uses in BaseUrlRedirectValidator around
the URL parsing block, and also at the other locations noted in the file near
the blocks at lines ~94-100 and ~150-153). Update all log.info/log.error calls
to pass redactUrl(redirectUrl) instead of redirectUrl so the redacted value is
consistently logged across the new URL-fetch path. Ensure the helper is reusable
and unit-testable and referenced from BaseUrlRedirectValidator.
In
`@bbb-common-web/src/main/java/org/bigbluebutton/api/service/SecureUrlDownloader.java`:
- Around line 91-109: The current loop in SecureUrlDownloader reads chars via
BufferedReader/InputStreamReader and decrements remaining against decoded chars,
so multibyte UTF-8 payloads can exceed maxSizeKib; change to read raw bytes from
response.getEntity().getContent() (use a byte[] buffer and a
ByteArrayOutputStream), track remainingBytes = maxSizeKib * 1024 and decrement
by the actual bytes read (n) immediately after each read, and if remainingBytes
<= 0 log the warning (using validatedUrl.originalUrl(), maxSizeKib, contextId)
and return null; after the loop convert the accumulated bytes to a UTF-8 string
and return it (replace the BufferedReader/InputStreamReader/sb logic with
byte-based buffering and final new String(bytes, StandardCharsets.UTF_8)).
In
`@bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy`:
- Around line 213-215: Remove the raw payload print to stdout: delete the
println(xmlModules.get("clientSettingsOverride").text()) call and rely on the
existing structured log line (log.info("Module `clientSettingsOverride` in POST
body loaded.")); if you need additional diagnostic info, replace the println
with a debug-level, redacted summary (e.g., length or keys) before calling
newMeeting.setOverrideClientSettings(...) so sensitive clientSettingsOverride
content is not printed to stdout.
---
Nitpick comments:
In `@docs/docs/data/create.tsx`:
- Around line 602-605: Update the description to explicitly state that the JSON
URL is fetched server-side (not client-side) and is subject to server fetch-url
restrictions and protocol/host validation before download; mention that
integrators must provide an allowed/proxied URL to avoid create call failures,
and keep the existing references to clientSettingsOverride and
allowOverrideClientSettingsOnCreateCall to explain precedence and difference.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a237674c-0f39-4fe9-b8d6-89b66b9a1c64
📒 Files selected for processing (12)
bbb-common-web/src/main/java/org/bigbluebutton/api/ApiParams.javabbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.javabbb-common-web/src/main/java/org/bigbluebutton/api/service/SecureUrlDownloader.javabbb-common-web/src/main/java/org/bigbluebutton/api/service/impl/BaseUrlRedirectValidator.javabbb-common-web/src/main/java/org/bigbluebutton/api/service/impl/ClientSettingsOverrideUrlValidator.javabbb-common-web/src/main/java/org/bigbluebutton/api/service/impl/PresRedirectValidator.javabbb-common-web/src/main/java/org/bigbluebutton/presentation/PresentationUrlDownloadService.javabigbluebutton-web/grails-app/conf/bigbluebutton.propertiesbigbluebutton-web/grails-app/conf/spring/resources.xmlbigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovydocs/docs/data/create.tsxdocs/docs/development/api.md
| log.info("Validating redirect URL [{}]", redirectUrl); | ||
|
|
||
| URL url; | ||
| try { | ||
| url = new URL(redirectUrl); | ||
| } catch (MalformedURLException e) { | ||
| log.error("Malformed URL [{}]", redirectUrl); | ||
| return false; |
There was a problem hiding this comment.
Redact redirect URLs before logging them.
These log lines write the full user-supplied URL on both success and error paths. Presentation URLs and override URLs are often presigned, so query strings can carry temporary credentials or bearer tokens. Please introduce a shared redaction helper and use it throughout this new URL-fetch path.
Also applies to: 94-100, 150-153
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@bbb-common-web/src/main/java/org/bigbluebutton/api/service/impl/BaseUrlRedirectValidator.java`
around lines 38 - 45, The logs in BaseUrlRedirectValidator currently print the
full user-supplied redirectUrl in both success and error paths; create a shared
helper (e.g., a static utility method redactUrl(String)) that strips or masks
sensitive parts (query string, auth info, tokens) and use it wherever
redirectUrl is logged (replace direct uses in BaseUrlRedirectValidator around
the URL parsing block, and also at the other locations noted in the file near
the blocks at lines ~94-100 and ~150-153). Update all log.info/log.error calls
to pass redactUrl(redirectUrl) instead of redirectUrl so the redacted value is
consistently logged across the new URL-fetch path. Ensure the helper is reusable
and unit-testable and referenced from BaseUrlRedirectValidator.
| private boolean isAddressPubliclyRoutable(InetAddress address) { | ||
| if (address instanceof Inet6Address inet6) { | ||
| if (isNotGlobalUnicastIPv6(inet6)) { | ||
| log.error("Address [{}] is not a globally routable IPv6 address", address.getHostAddress()); | ||
| return false; | ||
| } | ||
| } else { | ||
| if (address.isAnyLocalAddress()) { | ||
| log.error("Address [{}] is a local address", address.getHostAddress()); | ||
| return false; | ||
| } | ||
| if (address.isLoopbackAddress()) { | ||
| log.error("Address [{}] is a loopback address", address.getHostAddress()); | ||
| return false; | ||
| } | ||
| if (address.isSiteLocalAddress()) { | ||
| log.error("Address [{}] is a private/site-local address", address.getHostAddress()); | ||
| return false; | ||
| } | ||
| if (address.isLinkLocalAddress()) { | ||
| log.error("Address [{}] is a link local address", address.getHostAddress()); | ||
| return false; | ||
| } | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| private boolean isNotGlobalUnicastIPv6(Inet6Address address) { | ||
| byte[] bytes = address.getAddress(); | ||
| // Global unicast is 2000::/3 — first 3 bits must be 001 | ||
| if ((bytes[0] & 0xE0) != 0x20) return true; | ||
| // 6to4 (2002::/16) embeds arbitrary IPv4 in bytes 2-3; block it explicitly | ||
| return bytes[0] == 0x20 && bytes[1] == 0x02; | ||
| } |
There was a problem hiding this comment.
Broaden the non-public address filter.
The IPv4 branch only rejects any-local/loopback/site-local/link-local addresses. Special-use ranges such as 100.64.0.0/10, 198.18.0.0/15, 224.0.0.0/4, and 240.0.0.0/4 still pass as “publicly routable”, which weakens the SSRF boundary now that this shared validator is reused by multiple server-side fetchers.
| newMeeting.setOverrideClientSettings(xmlModules.get("clientSettingsOverride").text()) | ||
| log.info("Module `clientSettingsOverride` in POST body loaded.") | ||
| println(xmlModules.get("clientSettingsOverride").text()) |
There was a problem hiding this comment.
Remove the raw override dump.
Line 215 prints the entire clientSettingsOverride payload to stdout. That can leak environment-specific settings and bypasses the application's normal logging controls. Keep the structured log entry only, or log a redacted summary at debug.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy`
around lines 213 - 215, Remove the raw payload print to stdout: delete the
println(xmlModules.get("clientSettingsOverride").text()) call and rely on the
existing structured log line (log.info("Module `clientSettingsOverride` in POST
body loaded.")); if you need additional diagnostic info, replace the println
with a debug-level, redacted summary (e.g., length or keys) before calling
newMeeting.setOverrideClientSettings(...) so sensitive clientSettingsOverride
content is not printed to stdout.
✅ Automated tests have passed! |
paultrudel
left a comment
There was a problem hiding this comment.
This refactor looks good. I will be able to make good use of it in some of the work I am doing now.



Add
clientSettingsOverrideJsonUrlparameter to the/createAPI.Allows overriding HTML5 client settings by passing a URL to a JSON file as a GET parameter on the
/createcall.Key differences from the existing
clientSettingsOverride:allowOverrideClientSettingsOnCreateCall=trueto be enabledclientSettingsOverridewhen both are presentDocs added:

It also refactor
bbb-common-webin order to make it easier for any module to use the same secure flow of presentations to validate URLs and download its content: 97271c9