Skip to content

py_vapid: do not enforce dot in sub claim email host part #90

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

Closed
wants to merge 1 commit into from

Conversation

felixrindt
Copy link

While developing our django application, we had admin@localhost configured as our site contact address, which was automatically used by our webpush lib. While testing, py_vapid errored complaining that the sub claim wasn't there, even though it was. mailto:admin@localhost wasn't considered as a valid sub claim.
I propose not enforcing having a dot in the regex, so people don't have to get frustrated figuring that out like me.

Although I would understand if you would say that a localhost host shouldn't be considered valid in a sub claim. We mitigated by changing our default developing contact address.

While developing our django application, we had `admin@localhost` configured as our site contact address, which was automatically used by our webpush lib. While testing, py_vapid errored complaining that the sub claim wasn't there, even though it was. `mailto:admin@localhost` wasn't considered as a valid sub claim. 
I propose not enforcing having a dot in the regex, so people don't have to get frustrated figuring that out like me.

Although I would understand if you would say that a `localhost` host shouldn't be considered valid in a sub claim. We mitigated by changing our default developing contact address.
@jrconlin
Copy link
Member

jrconlin commented Mar 20, 2021

I feel like I should push back on this one a little bit, but not for the reason you're saying. VAPID is there mostly for Ops folk to have a way to contact the origin if there's a problem, so having something reasonably valid is kind of important. RFC8292 notes that aud should be the origin of the push service URL as either a mailto: or https:.

I took a fairly lazy route on this one, and it's kinda come back to haunt me, so, going to file a proper issue and see about resolving that.

@felixrindt
Copy link
Author

Thanks for explaining! :)

@felixrindt felixrindt closed this Mar 20, 2021
@jrconlin
Copy link
Member

No worries. Thanks for pointing out the issue!

@felixrindt felixrindt deleted the patch-1 branch March 20, 2021 20:23
jrconlin added a commit that referenced this pull request Mar 20, 2021
While far from perfect, this is a little better about checking the sorts
of values passed in the `sub` claim. It checks for ipv6 like as well as
localhost in mailto and https forms. (Yeah, you'll still need to supply
`https` since that's part of the RFC. Plus, letsEncrypt is a thing, so
there's that.)

I've also introduced a new option `--no-strict` which turns off
`sub` checks. It has to be present, but what the value is can be up to
you. I'll note that this kinda ruins what VAPID is supposed to be about.
The `sub` is there so that if there's a problem with your subscription,
Ops can reach out to you to help fix it rather than just straight up
block you.

Closes: #90
jrconlin added a commit that referenced this pull request Mar 29, 2021
While far from perfect, this is a little better about checking the sorts
of values passed in the `sub` claim. It checks for ipv6 like as well as
localhost in mailto and https forms. (Yeah, you'll still need to supply
`https` since that's part of the RFC. Plus, letsEncrypt is a thing, so
there's that.)

I've also introduced a new option `--no-strict` which turns off
`sub` checks. It has to be present, but what the value is can be up to
you. I'll note that this kinda ruins what VAPID is supposed to be about.
The `sub` is there so that if there's a problem with your subscription,
Ops can reach out to you to help fix it rather than just straight up
block you.

Closes: #90
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