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

Wrong Subscription.Keys.Auth value does not return an error #47

Open
eugbyte opened this issue Jul 29, 2022 · 1 comment
Open

Wrong Subscription.Keys.Auth value does not return an error #47

eugbyte opened this issue Jul 29, 2022 · 1 comment

Comments

@eugbyte
Copy link

eugbyte commented Jul 29, 2022

Wrong Subscription.Keys.Auth value does not return an error

For example, if I were to append a random value to the Auth field as such,

sub := &webpush.Subscription{
		Endpoint: endpoint,
		Keys: webpush.Keys{
			Auth:   "my_auth" + "a",
			P256dh: "my_p256dh",
		},
	}

I still get status code 201 when calling webpush.SendNotification(), indicating that the request to send a push message was received and accepted

resp, err := webpush.SendNotification([]byte(message), sub, &webpush.Options{
		Subscriber:      "my_email",
		VAPIDPublicKey:  "my_public_key",
		VAPIDPrivateKey: "my_private_key",
		TTL:             ttl,
	})
	
fmt.Println(resp.Status, resp.StatusCode)
// "201 Created" 201 
@eugbyte eugbyte changed the title Wrong subscription.keys.auth value does not return an error Wrong Subscription.Keys.Auth value does not return an error Jul 29, 2022
@eugbyte
Copy link
Author

eugbyte commented Jul 29, 2022

I notice that so long as the appended value to Subscription.Keys.Auth does not exceed length of 2, no error is returned. Otherwise, the error message will be illegal base64 data at input byte 25

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

No branches or pull requests

1 participant