[Bug] Shiro1CryptFormat.parse() throws ArrayIndexOutOfBoundsException for malformed hashes
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 82/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- java
- Área
- authentication, security
Línea de trabajo
Shiro1CryptFormat se encuentra bajo el módulo crypto/hash (paquetes de módulo lang/crypto en shiro-core); abre el método parse(String) y sigue cómo divide por $ y recorre las partes hacia atrás con índices. Ejecuta las cuatro entradas fallidas del issue para confirmar el AIOOBE, luego añade una guarda de longitud que lance IllegalArgumentException("The argument is not a valid 'shiro1' formatted hash.") antes de cualquier indexación. Hecho se ve como que los cuatro snippets lanzan IAE y las pruebas unitarias existentes de Shiro1CryptFormat siguen pasando.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Search before asking
- I had searched in the issues, including closed issues and found no similar issues.
Environment
Not environment-specific: the bug is in pure string-parsing logic, so it happens on any OS/JDK.
Shiro version
main branch (commit ea33e99)
What was the actual outcome?
Shiro1CryptFormat.parse(String) throws ArrayIndexOutOfBoundsException when a $shiro1$ hash is missing one or more of its $-separated parts. The method counts backwards through the parts without checking how many there are.
What was the expected outcome?
IllegalArgumentException("The argument is not a valid 'shiro1' formatted hash."), the same exception the method already throws for an invalid prefix or non-numeric iterations.
How to reproduce
new Shiro1CryptFormat().parse("$shiro1$SHA-256"); // AIOOBE: Index -1 out of bounds for length 1
new Shiro1CryptFormat().parse("$shiro1$SHA-256$"); // AIOOBE
new Shiro1CryptFormat().parse("$shiro1$SHA-256$abc"); // AIOOBE
new Shiro1CryptFormat().parse("$shiro1$SHA-256$1$$"); // AIOOBE
Debug logs
No response
- Lenguaje dominante
- Java
- Estrellas
- 4.5k
- Forks
- 2.3k
- Merge medio
- 1 d 5 min
- PR fusionados (30 d)
- 27
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.
Más de apache/shiro
-
[Bug] PathMatchingFilterChainResolver.setPathMatcher() does not reach PathMatchingFiltersPosiblemente ocupada @4n86rakam1 la tomó hoy. Abierto
Dificultad 3/5 Medio día Aptitud para principiantes 38/100
Los mantenedores suelen responder en 1 día
-
[Bug] Jakarta EE: secure-session-cookie.disabled is ignored in Faces Production modePosiblemente ocupada @AndrewG10i la tomó hace 5 días. Abiertojava valid
apache/shiro#2962 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Enable strict authorization configuration by default in 3.1Posiblemente ocupada @lprimak la tomó hace 11 días. Abiertojava
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
help-wanted java valid
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
Los mantenedores suelen responder en 1 día
-
valid
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
apache/shiro#2325 · 10 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/shiro
Issues similares
-
needs-area-label
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
bug module: hybrid priority: high
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
bancolombia/bin-stash#92 ·
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
erkamyaman/rust-anything#371 ·
Los mantenedores suelen responder en 1 día
-
Bug Materialized View SQL
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
open-telemetry/opentelemetry-java-instrumentation#21429 ·
Los mantenedores suelen responder en 1 día