Skip to content

feat: added fields IP, User-Agent, Referer and sessionToken to UserJoinedMeetingEvtMsg - #24451

Merged
antobinary merged 6 commits into
bigbluebutton:v3.0.x-releasefrom
AtilaU19:task-new-data-30
Jan 20, 2026
Merged

antobinary merged 6 commits into
bigbluebutton:v3.0.x-releasefrom
AtilaU19:task-new-data-30

Conversation

@AtilaU19

@AtilaU19 AtilaU19 commented Jan 13, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds client request metadata to the UserJoinedMeetingEvtMsg event through a single joinRequestMetadata property containing IP address, User-Agent, Referer, and session token.

This metadata is extracted from HTTP headers during the join request and propagated through the user registration flow. Using a single JSON property makes it explicit that this is static request metadata (captured at join time) rather than dynamic user state.

Closes Issue(s)

Closes None

More

bbbAppsAkka 2026-01-15T13:58:53.856Z INFO  o.b.core2.AnalyticsActor - -- analytics -- {"envelope":{"name":"UserJoinedMeetingEvtMsg","routing":{"msgType":"BROADCAST_TO_MEETING","meetingId":"68f7fbc836f64b58db1f8d
6c6af491d692b7e0cd-1768485521786","userId":"w_hvofthxf6jth"},"timestamp":1768485533842},"core":{"header":{"name":"UserJoinedMeetingEvtMsg","meetingId":"68f7fbc836f64b58db1f8d6c6af491d692b7e0cd-1768485521786","us
erId":"w_hvofthxf6jth"},"body":{"intId":"w_hvofthxf6jth","extId":"w_hvofthxf6jth","name":"User 4826274","role":"MODERATOR","bot":false,"guest":false,"authed":true,"guestStatus":"ALLOW","reactionEmoji":"none","ra
iseHand":false,"away":false,"pin":false,"presenter":false,"locked":true,"avatar":"","webcamBackground":"","color":"#7b1fa2","clientType":"HTML5","joinRequestMetadata":{"referer":"https://mconf.github.io/","ipAdd
ress":"2804:1b2:9441:11ae:a45:fd1a:7793:6f5e","sessionToken":"thpdkvlkrajk7hx6","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36"},"userMetadata"
:{}}}}  

@coderabbitai

coderabbitai Bot commented Jan 13, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adds join-request metadata propagation across the user registration and join flow. ApiController extracts sanitized headers (ipAddress, userAgent, referer, and sessionToken) into a joinRequestMetadata map and passes it to MeetingService.registerUser. The new field is threaded through gateway and messaging layers, added to RegisterUser/RegisterUserReqMsgBody, RegisteredUser, UserState, and UserJoinedMeetingEvtMsgBody. Two helper methods (extractClientIp and sanitizeHeader) were introduced for header extraction and sanitization.

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 20.00% 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 describes the primary change: adding joinRequestMetadata containing IP, User-Agent, Referer and sessionToken fields to the UserJoinedMeetingEvtMsg event.
Description check ✅ Passed The description is related to the changeset, explaining that IP, User-Agent and Referer fields are being added to UserJoinedMeetingEvtMsg for use by bbb-webhooks.

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

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 977a420 and 6c23535.

📒 Files selected for processing (17)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/RegisterUserReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/UserJoinedVoiceConfEvtMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/UserJoinedMeetingEvtMsgBuilder.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala
  • bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api2/IBbbWebApiGWApp.java
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/ToAkkaAppsSendersTrait.scala
  • bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy
🚧 Files skipped from review as they are similar to previous changes (9)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/UserJoinedMeetingEvtMsgBuilder.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala
  • bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala
  • bbb-common-web/src/main/java/org/bigbluebutton/api2/IBbbWebApiGWApp.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/UserJoinedVoiceConfEvtMsgHdlr.scala
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: jaapjansma
Repo: bigbluebutton/bigbluebutton PR: 21204
File: bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala:21-21
Timestamp: 2024-10-10T12:15:03.265Z
Learning: When reviewing code changes in BigBlueButton, particularly in case classes like `RegisterUser` in `MeetingsManagerActor.scala`, ensure to accurately distinguish between added parameters and replaced parameters to avoid incorrect assessments.
📚 Learning: 2024-10-10T12:15:03.265Z
Learnt from: jaapjansma
Repo: bigbluebutton/bigbluebutton PR: 21204
File: bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala:21-21
Timestamp: 2024-10-10T12:15:03.265Z
Learning: When reviewing code changes in BigBlueButton, particularly in case classes like `RegisterUser` in `MeetingsManagerActor.scala`, ensure to accurately distinguish between added parameters and replaced parameters to avoid incorrect assessments.

Applied to files:

  • bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/RegisterUserReqMsgHdlr.scala
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/ToAkkaAppsSendersTrait.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala
🧬 Code graph analysis (2)
bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java (1)
bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala (1)
  • RegisterUser (18-21)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/RegisterUserReqMsgHdlr.scala (1)
bigbluebutton-html5/imports/ui/components/layout/push-layout/pushLayoutEngine.jsx (1)
  • enforceLayout (488-488)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build-package (bbb-fsesl-akka)
  • GitHub Check: build-package (bbb-html5)
  • GitHub Check: build-package (bbb-web)
  • GitHub Check: build-package (bbb-apps-akka)
  • GitHub Check: build-package (bbb-playback-record)
🔇 Additional comments (11)
bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java (3)

1012-1020: LGTM - formatting changes only.

The DARK_LOGO fallback logic is preserved: darklogo param → logo param → default dark logo → default logo (if dark logo disabled).


1854-1882: Well-implemented IP extraction with proper fallback chain.

The method correctly handles the X-Forwarded-For header by taking the first (client-originating) IP from the comma-separated list. The fallback order (X-Forwarded-For → X-Real-IP → remoteAddr) follows standard proxy header conventions. The 128-character limit is generous enough for IPv6 addresses with zone identifiers.


1884-1896: Clean utility method for header sanitization.

The method correctly handles null/empty inputs and enforces length limits. Consider adding a note that this sanitization is for length/whitespace only and does not validate or escape content for specific contexts (e.g., logging, JSON).

bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java (1)

27-27: New joinRequestMetadata field correctly added to support static join-request data.

The field placement and type are appropriate. This immutable message class follows the existing pattern.

One minor consideration: the Map reference is stored directly without a defensive copy. If callers could modify the map after construction, this could lead to unexpected behavior. However, since this is an internal message class and follows the same pattern as userMetadata, this is acceptable.

Also applies to: 34-34, 54-54

bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala (1)

18-21: Case class correctly extended with joinRequestMetadata parameter.

The new parameter is properly positioned after logoutUrl and before userMetadata, maintaining consistency with the Java RegisterUser class and other related message bodies across the codebase.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala (1)

66-69: Test data correctly updated for new signature.

Using Map.empty for joinRequestMetadata is appropriate for fake test users where the join request metadata (IP, User-Agent, etc.) is not relevant to the test scenarios.

bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/ToAkkaAppsSendersTrait.scala (1)

29-38: Message body construction correctly propagates joinRequestMetadata.

The RegisterUserReqMsgBody construction properly includes joinRequestMetadata from the incoming RegisterUser message, ensuring the metadata flows through to the Akka apps layer. The named parameter style is consistent with the existing code.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/RegisterUserReqMsgHdlr.scala (1)

61-64: LGTM!

The joinRequestMetadata parameter is correctly threaded through to RegisteredUsers.create in the expected position between logoutUrl and userMetadata. This aligns with the broader PR changes to propagate join request metadata through the registration flow.

bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala (1)

63-68: LGTM!

The joinRequestMetadata field is correctly included in the RegisterUserReqMsgBody construction, positioned after logoutUrl and before userMetadata as expected by the updated message schema.

bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala (2)

8-12: LGTM!

The joinRequestMetadata field is correctly added to RegisterUserReqMsgBody in the expected position, enabling the propagation of join request metadata through the registration flow.


88-109: Design aligns with reviewer feedback; verify downstream privacy handling.

The consolidation of IP address, User-Agent, referer, and sessionToken into a single joinRequestMetadata field (rather than individual fields) addresses the PR review feedback to make the static nature of this data explicit and reduce property proliferation.

However, since UserJoinedMeetingEvtMsg is an event that may be persisted in analytics logs or consumed by external systems (bbb-webhooks), ensure that downstream consumers handle the IP address appropriately per your privacy/compliance requirements (e.g., GDPR data minimization, retention policies, access controls).

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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.

@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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala (1)

14-52: Database persistence issue: new fields not mapped in UserDAO.insert()

The create method correctly includes and passes ipAddress, userAgent, and referer to the RegisteredUser case class, but UserDAO.insert() does not map these fields when persisting to the database. Lines 73-108 in UserDAO.scala construct the UserDbModel up through logoutUrl, but the three new fields are missing. The data will be lost when inserted into the database.

Update UserDAO.insert() to include mappings for these fields in the UserDbModel construction.

bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala (1)

88-112: Remove privacy-sensitive fields from broadcast message or implement per-recipient filtering.

The UserJoinedMeetingEvtMsgBody is broadcast to all meeting clients via BROADCAST_TO_MEETING routing, not limited to webhooks. This exposes ipAddress, userAgent, referer, and sessionToken to every meeting participant. IP addresses are PII under GDPR/CCPA, and user-agent strings enable fingerprinting.

Either exclude these fields from the client broadcast message, or implement a filtering layer that removes sensitive fields before sending to clients while preserving them for server-side webhooks/analytics.

🤖 Fix all issues with AI agents
In
@bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy:
- Around line 459-465: The code trusts X-Forwarded-For/X-Real-IP in
paramsProcessorUtil.extractClientIp and should either document that
trusted-proxy network filtering is required or enforce it: add a configurable
trusted proxy list (e.g., config.trustedProxies) and modify extractClientIp to
only accept X-Forwarded-For/X-Real-IP when request.getRemoteAddr() is in that
whitelist (or expose a new helper isTrustedProxy(remoteAddr)); alternatively add
a clear inline comment next to the extractClientIp/sanitizeHeader calls stating
the trusted-proxy assumption and where to configure the trusted proxy list
(referencing paramsProcessorUtil.extractClientIp,
paramsProcessorUtil.sanitizeHeader, and the new config key such as
trustedProxies or a validator method like paramsProcessorUtil.isTrustedProxy).
🧹 Nitpick comments (2)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala (1)

454-457: Vector("") is a necessary workaround for unsafe .head usage—the real issue deserves attention.

regUser.sessionToken.head is called without validation in UserDAO.scala (line 117). Using Vector.empty would cause a NoSuchElementException at runtime. The Vector("") default is intentional but indicative of fragile code.

Consider:

  1. Add safety checks before calling .head on sessionToken
  2. Use .headOption and handle the None case explicitly
  3. Only then can the default safely become Vector.empty

This refactoring would improve both safety and semantic clarity.

bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java (1)

27-29: Minor indentation inconsistency.

The new fields userAgent and referer use 4-space indentation while other fields use tab indentation. This doesn't affect functionality but creates inconsistent formatting.

🔧 Suggested formatting fix
 	public final String ipAddress;
-    public final String userAgent;
-    public final String referer;
+	public final String userAgent;
+	public final String referer;
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 17f1e9e and 977a420.

📒 Files selected for processing (17)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/RegisterUserReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/UserJoinedVoiceConfEvtMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/UserJoinedMeetingEvtMsgBuilder.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala
  • bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api2/IBbbWebApiGWApp.java
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/ToAkkaAppsSendersTrait.scala
  • bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: jaapjansma
Repo: bigbluebutton/bigbluebutton PR: 21204
File: bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala:21-21
Timestamp: 2024-10-10T12:15:03.265Z
Learning: When reviewing code changes in BigBlueButton, particularly in case classes like `RegisterUser` in `MeetingsManagerActor.scala`, ensure to accurately distinguish between added parameters and replaced parameters to avoid incorrect assessments.
📚 Learning: 2024-10-10T12:15:03.265Z
Learnt from: jaapjansma
Repo: bigbluebutton/bigbluebutton PR: 21204
File: bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala:21-21
Timestamp: 2024-10-10T12:15:03.265Z
Learning: When reviewing code changes in BigBlueButton, particularly in case classes like `RegisterUser` in `MeetingsManagerActor.scala`, ensure to accurately distinguish between added parameters and replaced parameters to avoid incorrect assessments.

Applied to files:

  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/ToAkkaAppsSendersTrait.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/RegisterUserReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/UserJoinedMeetingEvtMsgBuilder.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala
  • bbb-common-web/src/main/java/org/bigbluebutton/api2/IBbbWebApiGWApp.java
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala
  • bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala
  • bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/UserJoinedVoiceConfEvtMsgHdlr.scala
  • bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java
🧬 Code graph analysis (3)
bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java (1)
bbb-common-web/src/main/java/org/bigbluebutton/api/ApiParams.java (1)
  • ApiParams (22-124)
bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala (1)
bigbluebutton-html5/imports/ui/components/layout/push-layout/pushLayoutEngine.jsx (1)
  • enforceLayout (488-488)
bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java (1)
bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala (1)
  • RegisterUser (18-21)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build-package (bbb-web)
  • GitHub Check: build-package (bbb-fsesl-akka)
  • GitHub Check: build-package (bbb-apps-akka)
🔇 Additional comments (20)
bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/ToAkkaAppsSendersTrait.scala (1)

34-35: LGTM!

The new fields (ipAddress, userAgent, referer) are correctly propagated from the RegisterUser message to the RegisterUserReqMsgBody. The field ordering is consistent with the established pattern.

bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java (3)

998-1006: LGTM!

The dark logo fallback chain is logically sound: prioritizes explicit DARK_LOGO param, falls back to LOGO param, then default dark logo, and finally default logo if dark logo defaults are disabled.


1836-1864: Implementation follows standard X-Forwarded-For parsing patterns.

The method correctly extracts the first (leftmost) IP from X-Forwarded-For, which represents the original client when proxies append IPs. The fallback chain to X-Real-IP and remoteAddr is appropriate.

Note: If this IP is used for security-sensitive decisions (rate limiting, access control), ensure that the reverse proxy configuration strips/overwrites client-supplied X-Forwarded-For headers to prevent spoofing.


1866-1878: LGTM!

Simple and defensive utility for sanitizing header values. Correctly handles null/empty inputs and enforces length limits.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/UserJoinedMeetingEvtMsgBuilder.scala (1)

20-24: LGTM!

The new fields (sessionToken, ipAddress, userAgent, referer) are correctly sourced from userState and included in the UserJoinedMeetingEvtMsgBody. This fulfills the PR objective to enrich the event payload with client-origin metadata for bbb-webhooks consumption.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala (1)

67-71: LGTM!

The new fields are correctly propagated from regUser (RegisteredUser) to the new UserState during user join. This bridges the registration metadata to the live meeting user state, enabling downstream event builders to include this data.

bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala (1)

68-68: LGTM!

The new fields (ipAddress, userAgent, referer) are correctly included in the RegisterUserReqMsgBody construction, sourced from the msg parameter. This maintains consistency with the field propagation pattern across the registration flow.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/RegisterUserReqMsgHdlr.scala (1)

61-64: LGTM - New metadata fields correctly propagated.

The new ipAddress, userAgent, and referer fields are correctly extracted from msg.body and passed to RegisteredUsers.create. The change aligns with the broader PR objective to enrich user records with request context.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/UserJoinedVoiceConfEvtMsgHdlr.scala (1)

48-53: LGTM - Empty metadata fields for dial-in users is appropriate.

For dial-in users joining via voice conference, there's no HTTP request context available, so passing empty strings for ipAddress, userAgent, and referer is the correct approach. The signature aligns with the updated RegisteredUsers.create method.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala (1)

66-69: LGTM - Test data generation correctly updated.

The RegisteredUsers.create call is properly updated with empty strings for the new ipAddress, userAgent, and referer fields. Using empty strings for test/fake data is appropriate.

bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy (1)

568-571: New metadata fields correctly passed to registration service.

The clientIp, userAgent, and referer values extracted earlier are properly forwarded to meetingService.registerUser, completing the data flow from HTTP request to the registration backend.

bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala (1)

18-21: LGTM - Parameter additions are consistent with the registration flow.

The new ipAddress, userAgent, and referer parameters are correctly positioned after logoutUrl and before userMetadata, aligning with the corresponding changes in IBbbWebApiGWApp.java and RegisterUser.java. Based on learnings, these are correctly identified as additions rather than replacements.

bbb-common-web/src/main/java/org/bigbluebutton/api2/IBbbWebApiGWApp.java (1)

79-82: LGTM - Interface signature updated consistently.

The new parameters ipAddress, userAgent, and referer are correctly added to the interface method signature, positioned before userMetadata. This aligns with the implementation in BbbWebApiGWApp.scala and the data model in RegisterUser.java.

bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java (1)

32-59: LGTM - Constructor correctly initializes new fields.

The constructor signature and field assignments for ipAddress, userAgent, and referer are implemented correctly, maintaining consistency with the existing field initialization pattern.

bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala (2)

314-318: LGTM - RegisterUser construction correctly includes new fields.

The new fields are correctly passed to the RegisterUser constructor in the expected order, aligning with the updated case class definition.


304-305: Header values are already sanitized upstream.

In ApiController.groovy (lines 459-465), the userAgent and referer parameters are sanitized via paramsProcessorUtil.sanitizeHeader() with size limits (512 and 1024 characters respectively) before being passed to registerUser(). The clientIp is properly extracted via paramsProcessorUtil.extractClientIp() which handles X-Forwarded-For header parsing. No additional validation is needed in registerUser().

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala (1)

267-301: LGTM - Case class correctly extended with new fields.

The RegisteredUser case class properly includes ipAddress, userAgent, and referer as required String fields, positioned consistently with the factory method and related data structures across the PR.

bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (2)

135-153: LGTM! Method signature extended with client-origin metadata.

The registerUser method correctly propagates ipAddress, userAgent, and referer to the RegisterUser message. Parameter ordering is consistent between the method signature and constructor call.

Note: The RegisteredUser instantiation at lines 149-150 doesn't include the new fields, which appears intentional since the message-based flow handles propagation to downstream components.


628-634: LGTM! Gateway call correctly extended with new fields.

The processRegisterUser method properly forwards ipAddress, userAgent, and referer from the message to the gateway, maintaining consistent parameter ordering with the rest of the registration flow.

bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala (1)

8-12: LGTM! Registration request message extended with client metadata.

The RegisterUserReqMsgBody case class correctly includes ipAddress, userAgent, and referer fields. As a request message, this appropriately captures client-origin metadata for server-side processing during user registration.

Comment on lines +459 to +465
String clientIp = paramsProcessorUtil.extractClientIp(
request.getHeader("X-Forwarded-For"),
request.getHeader("X-Real-IP"),
request.getRemoteAddr()
)
String userAgent = paramsProcessorUtil.sanitizeHeader(request.getHeader('User-Agent'), 512)
String referer = paramsProcessorUtil.sanitizeHeader(request.getHeader('Referer'), 1024)

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 | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -name "*paramsProcessorUtil*" -o -name "*ParamsProcessorUtil*" | head -20

Repository: bigbluebutton/bigbluebutton

Length of output: 231


🏁 Script executed:

rg -l "extractClientIp|sanitizeHeader" --type groovy -i | head -20

Repository: bigbluebutton/bigbluebutton

Length of output: 166


🏁 Script executed:

rg "class.*ParamsProcessorUtil" --type groovy -A 30

Repository: bigbluebutton/bigbluebutton

Length of output: 53


🏁 Script executed:

wc -l ./bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java

Repository: bigbluebutton/bigbluebutton

Length of output: 153


🏁 Script executed:

cat -n ./bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java

Repository: bigbluebutton/bigbluebutton

Length of output: 50383


🏁 Script executed:

wc -l ./bigbluebutton-web/test/groovy/org/bigbluebutton/api/ParamsProcessorUtilTest.java

Repository: bigbluebutton/bigbluebutton

Length of output: 156


🏁 Script executed:

rg "def extractClientIp|public.*extractClientIp" ./bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java -A 25

Repository: bigbluebutton/bigbluebutton

Length of output: 970


🏁 Script executed:

rg "def sanitizeHeader|public.*sanitizeHeader" ./bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java -A 10

Repository: bigbluebutton/bigbluebutton

Length of output: 402


🏁 Script executed:

cat -n ./bigbluebutton-web/test/groovy/org/bigbluebutton/api/ParamsProcessorUtilTest.java

Repository: bigbluebutton/bigbluebutton

Length of output: 3005


🏁 Script executed:

rg "trusted.*proxy|proxy.*trusted|X-Forwarded-For" ./bbb-common-web/src/main/java/org/bigbluebutton/api/ -i -B 2 -A 2

Repository: bigbluebutton/bigbluebutton

Length of output: 1265


🏁 Script executed:

rg "extractClientIp" ./bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy -B 5 -A 5

Repository: bigbluebutton/bigbluebutton

Length of output: 597


🏁 Script executed:

rg "X-Forwarded-For" . --type java --type xml -B 3 -A 3 | grep -E "(filter|trusted|proxy|allow)" -i -B 2 -A 2

Repository: bigbluebutton/bigbluebutton

Length of output: 53


🏁 Script executed:

find . -name "web.xml" -o -name "*Filter*.java" | head -10

Repository: bigbluebutton/bigbluebutton

Length of output: 263


Client metadata extraction is implemented, but document the trusted proxy assumption.

The extraction of client IP, User-Agent, and Referer with sanitization works as designed. Character limits (512 for User-Agent, 1024 for Referer, 128 for IP) are reasonable. The extractClientIp method correctly parses X-Forwarded-For by taking the first non-empty value and falling back to X-Real-IP, then remoteAddr.

However, the implementation does not actively mitigate IP spoofing—it simply trusts all values in the X-Forwarded-For chain without validation against a whitelist of trusted proxies. This approach is safe only if the deployment enforces strict network-level filtering to prevent untrusted sources from injecting X-Forwarded-For headers. Document this security assumption or implement trusted proxy validation if untrusted networks can reach this endpoint.

🤖 Prompt for AI Agents
In
@bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy
around lines 459 - 465, The code trusts X-Forwarded-For/X-Real-IP in
paramsProcessorUtil.extractClientIp and should either document that
trusted-proxy network filtering is required or enforce it: add a configurable
trusted proxy list (e.g., config.trustedProxies) and modify extractClientIp to
only accept X-Forwarded-For/X-Real-IP when request.getRemoteAddr() is in that
whitelist (or expose a new helper isTrustedProxy(remoteAddr)); alternatively add
a clear inline comment next to the extractClientIp/sanitizeHeader calls stating
the trusted-proxy assumption and where to configure the trusted proxy list
(referencing paramsProcessorUtil.extractClientIp,
paramsProcessorUtil.sanitizeHeader, and the new config key such as
trustedProxies or a validator method like paramsProcessorUtil.isTrustedProxy).

@gustavotrott

Copy link
Copy Markdown
Contributor

As mentioned earlier (at #23910), these fields (IP, user agent, referer) represent metadata from the initial join request, not the user’s current state. For example, the IP may change during the session and won’t be updated.

Given that, adding multiple static fields to akka-apps user data seems unnecessary, especially since their only use is for bbb-webhooks through the UserJoinedMeetingEvtMsg message.

I’d suggest introducing a single property joinRequestMetadata, as a JSON object containing this data (ipAddress, userAgent, referer, etc.).
This makes it explicit that the data is static request metadata, not dynamic user state, and avoids unnecessary additions of user properties (with the option to include other fields in the future without touching akka-apps).

Would bbb-webhooks be able to handle it as a single JSON property instead of multiple fields? (cc @prlanzarin)

Replace individual fields (ipAddress, userAgent, referer, sessionToken) with
a single joinRequestMetadata Map[String, String] property as suggested by
@gustavotrott.

This change:
- Makes explicit that data is static request metadata, not dynamic user state
- Avoids unnecessary additions of user properties in akka-apps
- Allows future extensions without touching akka-apps core
- Provides bbb-webhooks a single JSON property to consume

The joinRequestMetadata contains:
- ipAddress: Client IP from X-Forwarded-For/X-Real-IP/remoteAddr
- userAgent: Browser/client user agent (max 512 chars)
- referer: Origin page URL (max 1024 chars)
- sessionToken: User session token
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

@antobinary antobinary added this to the Release 3.0 milestone Jan 20, 2026
@antobinary
antobinary merged commit e5b5183 into bigbluebutton:v3.0.x-release Jan 20, 2026
30 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