Pipeline run pages return 500 for a schedule whose pipeline is not registered

オープン 初心者向け
#2,505 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

@sanchit955 がすでに取り組んでいます。

2026年11月17日 から。

  • #2506 @sanchit955 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
django, postgresql, python
領域
backend, databases

調査の方向性

vulnerabilities/models.py の PipelineSchedule.pipeline_class から始め、その後 PipelineRunListView と PipelineRunDetailView、および PipelineRun.pipeline_url での使用をたどってください。vulnerabilities/tests/test_view.py の新しい PipelineRunViewsUnregisteredPipelineTestCase を実行してください。未登録のパイプラインに対して両方の実行ページが 200 を返し、その id をページ名として表示すれば完了です。

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

説明

Problem

PipelineSchedule rows persist in the database. When a pipeline is removed or renamed (for example the open "Remove v1 code" work), every stale schedule's run pages crash:

  • GET /pipelines/<pipeline_id>/runs/ → 500
  • GET /pipelines/<pipeline_id>/run/<uuid>/ → 500

Evidence

PipelineSchedule.pipeline_class (vulnerabilities/models.py) does a bare dict lookup, pipeline_registry[self.pipeline_id], which raises KeyError for an id that is no longer registered. Both PipelineRunListView.get_context_data and PipelineRunDetailView.get_context_data dereference it (pipeline_class.__name__), and the run detail template also reaches it through PipelineRun.pipeline_url when the run has a commit recorded.

Reproduced locally on PostgreSQL 16 with a schedule and a run using pipeline_id="hunt_probe_no_such_pipeline": both pages 500 with KeyError: 'hunt_probe_no_such_pipeline'. The dashboard list page is not affected — its template never calls pipeline_class.

Fix

  • pipeline_class returns None for an unregistered id (.get() instead of []); description already guards on a falsy class.
  • Both views fall back to the raw pipeline_id as the page name when the class is unknown.
  • pipeline_url returns None when the class is unknown, so the detail template's commit link degrades cleanly.

Tests

New PipelineRunViewsUnregisteredPipelineTestCase in vulnerabilities/tests/test_view.py: both pages return 200 with the pipeline id as the name for an unregistered pipeline. Both tests fail on unmodified main and pass with the fix. Full test_view.py: 14 passed (1 pre-existing flaky timing failure in test_aggregate_fixed_and_affected_packages, fails on main too); pipeline model tests 10 passed.

主要言語
Python
スター
719
フォーク
359
平均マージ
11時間 59分
マージ済み PR(30日)
2

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

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

aboutcode-org/vulnerablecode のほかの issue

aboutcode-org/vulnerablecode の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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