Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#568 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@i-am-paradox がすでに取り組んでいます。

2026年10月13日 から。

  • #597 @i-am-paradox による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
cli

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
22
フォーク
27
平均マージ
1日 20時間
マージ済み PR(30日)
39

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

darnitdevorg/darnit のほかの issue

darnitdevorg/darnit の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。