Skip to content

Fix: Example Servers Users Parsing#527

Merged
adrianosela merged 1 commit intopion:masterfrom
adrianosela:fix-example-servers-users-parsing
Jan 12, 2026
Merged

Fix: Example Servers Users Parsing#527
adrianosela merged 1 commit intopion:masterfrom
adrianosela:fix-example-servers-users-parsing

Conversation

@adrianosela
Copy link
Copy Markdown
Contributor

@adrianosela adrianosela commented Jan 12, 2026

Fix: Example Servers Users Parsing

Fixes #364

There is a bug in all server examples where usernames/passwords with non-alphanumeric characters are parsed incorrectly. We are using the regex (\w+)=(\w+) to parse the -users flag, but the \w+ pattern only matches [a-zA-Z0-9_]). So for example:

  • user-name=pass-word --> Parses as name:pass (drops user- and -word)
  • user:name=pass:word --> Parses as name:pass (drops everything before colons)
  • test@example.com=P@ssw0rd! --> Parses as example:P (completely breaks)

This PR drops the regex based logic in favor of strings.Split

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.00%. Comparing base (9960f3c) to head (79d308e).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #527      +/-   ##
==========================================
+ Coverage   80.93%   81.00%   +0.06%     
==========================================
  Files          46       46              
  Lines        3022     3022              
==========================================
+ Hits         2446     2448       +2     
+ Misses        364      363       -1     
+ Partials      212      211       -1     
Flag Coverage Δ
go 81.00% <ø> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@adrianosela adrianosela force-pushed the fix-example-servers-users-parsing branch from b72480c to 2afe01d Compare January 12, 2026 01:53
@Sean-Der
Copy link
Copy Markdown
Member

@adrianosela amazing catch!

Should we add a } else { panic when things fail to split? Otherwise users might be surprised.

Would you mind squashing + adding more details to your commit message? Just copying out of GitHub
would be perfect. Your explanation is great, don't want it to get lost :)

Merge w/e you want! Y

Fixes a bug in all server examples where usernames/passwords with
non-alphanumeric characters are parsed incorrectly. We are using the
regex (\w+)=(\w+) to parse the -users flag, but the \w+ pattern only
matches [a-zA-Z0-9_]). So for example:
- user-name=pass-word -> Parses as name:pass (drops user- and -word)
- user:name=pass:word -> Parses as name:pass (drops before colons)
- test@example.com=P@ssw0rd! -> Parses as example:P (breaks)

This change drops the regex based logic in favor of strings.Split
@adrianosela adrianosela force-pushed the fix-example-servers-users-parsing branch from 2afe01d to 79d308e Compare January 12, 2026 04:18
@adrianosela adrianosela merged commit edb776d into pion:master Jan 12, 2026
18 checks passed
@adrianosela adrianosela deleted the fix-example-servers-users-parsing branch January 12, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

integrity check failed

2 participants