Skip to content

Added regex to remove inline oauth params from repo urls. #570

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

Merged
merged 3 commits into from
Dec 1, 2017
Merged

Added regex to remove inline oauth params from repo urls. #570

merged 3 commits into from
Dec 1, 2017

Conversation

cmonr
Copy link
Contributor

@cmonr cmonr commented Nov 30, 2017

Reference bug #569

Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

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

Thanks for the fix. Looks great.

@screamerbg We should make a release of Mbed CLI with this fix after we merge it.

@janjongboom
Copy link
Contributor

janjongboom commented Dec 1, 2017

Why a regex and not a URL parser? Most URL parsers will parse the auth data out straight away, and there could be a URL that this regex will choke on.

E.g. in JS:

> a.href='https://SECRET:[email protected]/'
< "https://SECRET:[email protected]/"
> a.username
< "SECRET"
> a.password
< "x-oauth-basic"

Easy to create new URL without the data.

@theotherjimmy
Copy link
Contributor

@janjongboom I updated this PR to use urlparse

@theotherjimmy
Copy link
Contributor

With the example from #569, and the code change from this PR:

>>> ref = 'https://77f0469f687b8b085d25cee082df6a89009aa0ee:[email protected]/ARMmbed/mbed-os/#fc1836545dcc2fc86f03b01292b62bf2089f67c3'
>>> with_auth = urlparse(ref)
>>> print(with_auth._replace(netloc=with_auth.hostname).geturl())
https://github.com/ARMmbed/mbed-os/#fc1836545dcc2fc86f03b01292b62bf2089f67c3

@theotherjimmy theotherjimmy merged commit f8a8527 into ARMmbed:master Dec 1, 2017
@bridadan
Copy link
Contributor

bridadan commented Dec 1, 2017

Nice work y'all 👍

@cmonr cmonr deleted the issue_569 branch December 1, 2017 16:46
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.

4 participants