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

darnit plan and darnit validate crash on openssf-baseline: controls mix level=None and int

Abierto
#568 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@i-am-paradox ya está trabajando en esto.

Desde el 13/10/2026.

  • #597 de @i-am-paradox — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python
Área
cli

Línea de trabajo

The crash is in cmd_plan in darnit/cli.py (around line 425, where by_level keys are sorted) and in the matching sort in darnit validate. Check how ControlConfig.level and tags.level are read, and FrameworkConfig.get_controls_by_level, before choosing a canonical source as framework-design.md should specify. Done means darnit plan and darnit validate run on openssf-baseline.toml without a TypeError, with None sorted last, and a test covers every shipped framework TOML.

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

Descripción

interface-cli module-baseline module-core needs triage

darnit plan and darnit validate crash on the shipped openssf-baseline framework (reproduced on main 06e905e).

$ darnit plan
  File ".../darnit/cli.py", line 425, in cmd_plan
    for level in sorted(by_level.keys()):
TypeError: '<' not supported between instances of 'int' and 'NoneType'

$ darnit validate packages/darnit-baseline/src/darnit_baseline/openssf-baseline.toml
    logger.info(f"  By level: {', '.join(f'L{k}={v}' for k, v in sorted(by_level.items()))}")
TypeError: '<' not supported between instances of 'int' and 'NoneType'

Cause: both commands group controls by ControlConfig.level. openssf-baseline declares levels in tags.level (tags = { level = 1, ... }), so 65 of its 66 controls have level = None. One control, STAGE1-REF-SECURITY-01, sets the top-level level, so the keys mix int and None and sorted() raises. darnit plan -f community-spec works because none of its controls set level.

Same root cause, no crash: FrameworkConfig.get_controls_by_level(n) filters on ControlConfig.level, so it returns nothing for the 65 baseline controls that use tags.level. It has no production caller today. The audit path reads the level some other way and is not affected; a fix should check that.

Suggested direction:

  1. Give a control's level one source. Either ControlConfig.level falls back to tags.level, or the shipped TOMLs move to the top-level field. The spec (framework-design.md) should say which one is canonical.
  2. Make plan and validate sort with None last instead of crashing.
  3. Add a test that runs plan and validate against every shipped framework TOML.

Found while removing dead code for #487 (#566).

Drafted with Claude Code; reviewed and posted by me.

Lenguaje dominante
Python
Estrellas
22
Forks
27
Merge medio
1 d 20 h
PR fusionados (30 d)
39

Preparar el entorno

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 darnitdevorg/darnit

Todos los issues de darnitdevorg/darnit

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.