Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: try base64 legacy decoding for maximum compatibility #298

Merged
merged 2 commits into from
Oct 14, 2024

Conversation

amircybersec
Copy link
Contributor

Currently Outline SDK config parser fails for strings encoded in legacy base64 mode such as the example below:

ss://YWVzLTEyOC1nY206c2hhZG93c29ja3M=@210.100.100.100:443

Current Outline client is however able to parse and decode the above URL. For consistent behaviour between Outline SDK and Outline client, I have added a secondary decoding step if current method fails.

Current aproach:

encoding := base64.URLEncoding.WithPadding(base64.NoPadding).DecodeString(userInfo)

Backup approach:

encoding := base64.StdEncoding.WithPadding(base64.NoPadding).DecodeString(userInfo)

@amircybersec amircybersec requested a review from sbruens October 14, 2024 19:45
Copy link
Contributor

@sbruens sbruens left a comment

Choose a reason for hiding this comment

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

Do you mind adding a unit test for this case?

@amircybersec
Copy link
Contributor Author

@sbruens I added two tests; Please let me know if more tests are needed.

@amircybersec amircybersec requested a review from sbruens October 14, 2024 21:23
@sbruens sbruens merged commit c7e1aea into main Oct 14, 2024
6 checks passed
@sbruens sbruens deleted the amir-ss-base64-issue branch October 14, 2024 21:28
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.

2 participants