Skip to content

server/plugin: don't panic on whitespace in Jitsi Server URL#282

Open
SAY-5 wants to merge 1 commit into
mattermost-community:masterfrom
SAY-5:fix/startmeeting-nil-url-281
Open

server/plugin: don't panic on whitespace in Jitsi Server URL#282
SAY-5 wants to merge 1 commit into
mattermost-community:masterfrom
SAY-5:fix/startmeeting-nil-url-281

Conversation

@SAY-5

@SAY-5 SAY-5 commented Apr 20, 2026

Copy link
Copy Markdown

Summary

startMeeting in server/plugin.go discarded the error from url.Parse and then read jURL.Hostname():

// Error check is done in configuration.IsValid()
jURL, _ := url.Parse(p.getConfiguration().GetJitsiURL())
...
claims.Subject = jURL.Hostname() // panics if jURL is nil

url.Parse(" https://...") returns (nil, err) because the leading space breaks scheme parsing, and IsValid() runs on config change, not per command. So an admin who pasted a URL with trailing or leading whitespace saw the plugin panic on the first /jitsi invocation (#281) and every subsequent command returned the opaque "plugin crashed, contact your administrator" message.

Fixes #281.

Change

  • Parse the already-trimmed jitsiURL local variable (which is strings.TrimSpace(...)'d a few lines up) instead of the raw config value, so trimming actually reaches url.Parse.
  • Don't discard the error: if parseErr != nil || jURL == nil, return "Jitsi plugin is misconfigured: invalid Jitsi Server URL" via errors.New (the already-imported github.com/pkg/errors).

Testing

  • go build ./server/... passes.
  • Manual regression: set JitsiURL to " https://meet.example.com " (spaces on both sides). Previously /jitsi panicked inside the plugin goroutine; now it returns the misconfigured-message error and the plugin keeps running.

startMeeting discarded the error from url.Parse and then read
jURL.Hostname(), so an admin who pasted a URL with a leading or
trailing space saw the plugin crash on the first /jitsi invocation
(mattermost-community#281). url.Parse(" https://...") returns (nil, err) because the
space breaks scheme parsing; IsValid() on config-change doesn't
catch the whitespace either.

Parse the already-trimmed jitsiURL local (not the raw config
string), check the error, and surface a user-visible
'misconfigured' message instead of panicking.

Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com>

Fixes mattermost-community#281
@SAY-5
SAY-5 force-pushed the fix/startmeeting-nil-url-281 branch from 8add5d1 to 0b69112 Compare May 31, 2026 02:40
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.

Plugin crashes with nil pointer dereference when JitsiURL contains whitespace

1 participant