Skip to content

security(CORE-1121): bind geolocation/notifications/fullscreen permissions to known server origin - #3395

Merged
jeanfbrito merged 1 commit into
masterfrom
security/CORE-1121-permission-origin
Jul 9, 2026
Merged

security(CORE-1121): bind geolocation/notifications/fullscreen permissions to known server origin#3395
jeanfbrito merged 1 commit into
masterfrom
security/CORE-1121-permission-origin

Conversation

@jeanfbrito

@jeanfbrito jeanfbrito commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

  • geolocation, notifications, and fullscreen permission requests in the server webview were granted unconditionally (callback(true)) regardless of the requesting origin.
  • Added isRequestFromKnownServer(requestingUrl, servers) in src/ui/main/serverView/index.ts, validating the request's origin against the app's configured server list — same origin-binding pattern already used by isServerWebview in src/ipc/validateSender.ts.
  • media and openExternal permissions already had proper validation and are unchanged. midiSysex/pointerLock remain unconditionally allowed (low-risk, out of scope for CORE-1121).

Test plan

  • npx tsc --noEmit clean
  • yarn eslint clean on changed files
  • New unit tests in isRequestFromKnownServer.main.spec.ts (8 cases: known origin match, trailing-slash server URL, unknown origin, undefined/invalid requestingUrl, empty server list, malformed server URLs in the list) — all passing

Summary by CodeRabbit

  • Bug Fixes
    • Permission prompts in the server view now only approve sensitive browser permissions for trusted server origins.
    • Requests with missing, invalid, or unrecognized URLs are now denied more safely.
    • Server URLs with formatting differences like trailing slashes are handled correctly.
  • Tests
    • Added coverage for allowed and denied permission requests, including invalid and empty server URL cases.

…sions to known server origin

geolocation, notifications, and fullscreen permission requests were granted
unconditionally (callback(true)) regardless of requestingUrl. Any origin
loaded in the server webview — not just a configured Rocket.Chat server —
could request and receive these permissions.

Extracted isRequestFromKnownServer(requestingUrl, servers) to validate the
request's origin against the app's configured server list (same pattern as
isServerWebview in src/ipc/validateSender.ts), and gate the three
permissions on it.

media and openExternal already had proper validation; midiSysex/pointerLock
are unaffected (low-risk permissions, out of scope for this ticket).
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2bd7a201-3931-4ff1-b32f-a70850883b8d

📥 Commits

Reviewing files that changed from the base of the PR and between a459f10 and 668be6d.

📒 Files selected for processing (2)
  • src/ui/main/serverView/index.ts
  • src/ui/main/serverView/isRequestFromKnownServer.main.spec.ts

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.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
putComment timed out

@jeanfbrito
jeanfbrito merged commit 96c81d4 into master Jul 9, 2026
9 checks passed
@jeanfbrito
jeanfbrito deleted the security/CORE-1121-permission-origin branch July 9, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant