Skip to content

feat (bbb-web): Introduce a new /create param clientSettingsOverrideJsonUrl - #24782

Merged
gustavotrott merged 4 commits into
bigbluebutton:v3.0.x-developfrom
gustavotrott:settingsOverrideJsonUrl
Mar 23, 2026
Merged

gustavotrott merged 4 commits into
bigbluebutton:v3.0.x-developfrom
gustavotrott:settingsOverrideJsonUrl

Conversation

@gustavotrott

Copy link
Copy Markdown
Contributor

Add clientSettingsOverrideJsonUrl parameter to the /create API.

Allows overriding HTML5 client settings by passing a URL to a JSON file as a GET parameter on the /create call.

Key differences from the existing clientSettingsOverride:

  • Accepts a JSON file URL instead of inline JSON in a POST body XML wrapper
  • Does not require allowOverrideClientSettingsOnCreateCall=true to be enabled
  • Takes precedence over clientSettingsOverride when both are present

Docs added:


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

@gustavotrott
gustavotrott requested a review from paultrudel March 20, 2026 13:07
@coderabbitai

coderabbitai Bot commented Mar 20, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

This 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 clientSettingsOverrideJsonUrl that is processed by fetching and validating the URL before downloading the JSON content. New services handle secure URL downloading with configurable timeout and payload limits, while URL validation enforces protocol allowlists, blocks external hosts, and validates DNS resolution. The feature integrates with existing redirect-validation infrastructure through a refactored abstract base class. Configuration properties control timeout and maximum payload size. URL-based overrides take precedence over POST-body-based overrides when both are provided.

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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.88% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: introducing a new /create API parameter named clientSettingsOverrideJsonUrl.
Description check ✅ Passed The description is clearly related to the changeset, explaining the new parameter, its differences from existing functionality, and the refactoring of bbb-common-web.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Tip

CodeRabbit can use OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.

OpenGrep is compatible with Semgrep configurations. Add an opengrep.yml or semgrep.yml configuration file to your project to enable OpenGrep analysis.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 create failures.

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between b6c0c5c and e2f6eb1.

📒 Files selected for processing (12)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/ApiParams.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/service/SecureUrlDownloader.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/service/impl/BaseUrlRedirectValidator.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/service/impl/ClientSettingsOverrideUrlValidator.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/service/impl/PresRedirectValidator.java
  • bbb-common-web/src/main/java/org/bigbluebutton/presentation/PresentationUrlDownloadService.java
  • bigbluebutton-web/grails-app/conf/bigbluebutton.properties
  • bigbluebutton-web/grails-app/conf/spring/resources.xml
  • bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy
  • docs/docs/data/create.tsx
  • docs/docs/development/api.md

Comment on lines +38 to +45
log.info("Validating redirect URL [{}]", redirectUrl);

URL url;
try {
url = new URL(redirectUrl);
} catch (MalformedURLException e) {
log.error("Malformed URL [{}]", redirectUrl);
return false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

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.

Comment on lines +187 to +220
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;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

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.

Comment on lines +213 to +215
newMeeting.setOverrideClientSettings(xmlModules.get("clientSettingsOverride").text())
log.info("Module `clientSettingsOverride` in POST body loaded.")
println(xmlModules.get("clientSettingsOverride").text())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

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.

@github-actions

Copy link
Copy Markdown

✅ Automated tests have passed!

@antobinary
antobinary changed the base branch from v3.0.x-release to v3.0.x-develop March 20, 2026 15:04
@antobinary antobinary added this to the Release 3.0 milestone Mar 20, 2026
@antobinary antobinary mentioned this pull request Mar 20, 2026
22 of 26 tasks

@paultrudel paultrudel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This refactor looks good. I will be able to make good use of it in some of the work I am doing now.

@gustavotrott
gustavotrott merged commit 1c8db93 into bigbluebutton:v3.0.x-develop Mar 23, 2026
32 checks passed
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.

3 participants