`Utils::validateHmac` fails if the query params contains non url-safe characters.
@brutal-factories ya está trabajando en esto.
Desde el 2/5/2025.
- #413 de @brutal-factories — abierto
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- php
- Área
- authentication, security
Línea de trabajo
Comienza en Utils::validateHmac y reproduce el callback de OAuth con un state que contenga caracteres codificados como Base64 o JSON. Traza cómo se manejan los parámetros de consulta del callback antes de la validación HMAC; se considera terminado cuando la validación devuelve true para una URL firmada correctamente que contenga esos caracteres.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Issue summary
Utils::validateHmac fails if the query params contains non url-safe characters. For example, for a oauth authorization callback, if the state is a base64-encoded string, the trailing = character will make the HMAC validation fail. After talking with the Shopify support, I was told that the HMAC sent from Shopify is computed based on the original query params, instead of the URL-encoded version.
Expected behavior
HMAC validation should still work if the HMAC comes for a URL containing encoded characters
Actual behavior
Utils::validateHmac returns false, even if I can manually confirm that the HMAC is correct
Steps to reproduce the problem
- Initiate an OAuth autorization request. For the
state, use non url-safe characters (i.e. JSON, Base64, or colons:). In my case, I use an app I'm developping, and requesting access for that app to a test shop. - When the autorization request is accepted, the user is redirected to your
redirect_uriwith the resulting query parameters. Save those for next step - use
Utils::validateHmacto validate the callback. It will fail if thestateindeed contains encoded characters.
Reduced test case
The best way to get your bug fixed is to provide a reduced test case.
Checklist
- I have described this issue in a way that is actionable (if possible)
- Lenguaje dominante
- PHP
- Estrellas
- 473
- Forks
- 193
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 2 días
-
backend bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 63/100
smarty-php/smarty#1215 ·
-
sync-en
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día