Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Polynomial ReDoS in python-markdown2 metadata parsing (_key_val_list_pat)

Cerrado
#741 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

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
Activo
Stack tecnológico
python
Área
security

Línea de trabajo

The slowdown comes from the regex named _key_val_list_pat, used by the metadata extra. Start by running the timing script in the issue with increasing input sizes to confirm the super-linear growth, then read that pattern and find which quantifiers or alternations overlap. Done means the timings stay roughly linear and the existing metadata tests still pass. Because this is a security report and the thread has no discussion yet, check with a maintainer before writing a fix.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Bug

Describe the bug

Please note: I'm not the author of this bug report, I merely report it to the project community as it has been published a while ago publically and seems to not have reached the right audience.

Please read https://gist.github.com/NanaSec/354b4188bbd7f4105008c7b8be49b0ba for the writeup.

To Reproduce

import time, markdown2
def render(value):
    doc = "---\nkey: %s\n---\n\n# hello\n" % value
    t = time.time(); markdown2.markdown(doc, extras=["metadata"]); return time.time()-t
for n in (8000, 16000, 32000, 64000, 128000):
    print(n, round(render("-" + " " * n), 3), "s")
Lenguaje dominante
Python
Estrellas
2.8k
Forks
464
Merge medio
3 d 2 h
PR fusionados (30 d)
11

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de trentm/python-markdown2

Todos los issues de trentm/python-markdown2

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.