~martijnbraam/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH numberstation] URL-decode otpauth:// labels

Details
Message ID
<20210723121314.1327573-1-tom@tom-fitzhenry.me.uk>
DKIM signature
pass
Download raw message
Patch: +2 -2
Fixes https://todo.sr.ht/~martijnbraam/numberstation/1

Prior to this commit the following URI:

    otpauth://totp/Biscuits:foo%40example.com?secret=uaqvphgzqy46rrrbjdnqmfg6zzmafjfh&issuer=Bar

rendered as "foo%40example.com"

As of this commit, it is rendered as "foo@example.com"
---
 numberstation/otpurl.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/numberstation/otpurl.py b/numberstation/otpurl.py
index a05b20d..5859bf7 100644
--- a/numberstation/otpurl.py
+++ b/numberstation/otpurl.py
@@ -1,7 +1,7 @@
from datetime import datetime

import pyotp
from urllib.parse import urlparse, parse_qs, urlencode, urlunparse
from urllib.parse import urlparse, parse_qs, unquote, urlencode, urlunparse
import hashlib


@@ -13,7 +13,7 @@ class OTPUrl:
            raise ValueError("Not an otpauth:// url")

        self.type = parts.hostname
        self.label = parts.path[1:]
        self.label = unquote(parts.path[1:])

        qs = parse_qs(parts.query)
        self.secret = qs['secret'][0]
-- 
2.31.1
Details
Message ID
<e4095f14-a655-2c98-d564-f0faddcedeb0@brixit.nl>
In-Reply-To
<20210723121314.1327573-1-tom@tom-fitzhenry.me.uk> (view parent)
DKIM signature
missing
Download raw message
Thanks for the patch, it will be in the 0.5.0 release

On 7/23/21 2:13 PM, Tom Fitzhenry wrote:
> Fixes https://todo.sr.ht/~martijnbraam/numberstation/1
>
> Prior to this commit the following URI:
>
>      otpauth://totp/Biscuits:foo%40example.com?secret=uaqvphgzqy46rrrbjdnqmfg6zzmafjfh&issuer=Bar
>
> rendered as "foo%40example.com"
>
> As of this commit, it is rendered as "foo@example.com"
> ---
>   numberstation/otpurl.py | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/numberstation/otpurl.py b/numberstation/otpurl.py
> index a05b20d..5859bf7 100644
> --- a/numberstation/otpurl.py
> +++ b/numberstation/otpurl.py
> @@ -1,7 +1,7 @@
>   from datetime import datetime
>   
>   import pyotp
> -from urllib.parse import urlparse, parse_qs, urlencode, urlunparse
> +from urllib.parse import urlparse, parse_qs, unquote, urlencode, urlunparse
>   import hashlib
>   
>   
> @@ -13,7 +13,7 @@ class OTPUrl:
>               raise ValueError("Not an otpauth:// url")
>   
>           self.type = parts.hostname
> -        self.label = parts.path[1:]
> +        self.label = unquote(parts.path[1:])
>   
>           qs = parse_qs(parts.query)
>           self.secret = qs['secret'][0]
Reply to thread Export thread (mbox)