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

Đang mở Phù hợp với người mới
#2,505 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@sanchit955 đang làm issue này rồi.

Từ ngày 17/11/2026.

  • #2506 của @sanchit955 — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
85/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
django, postgresql, python
Lĩnh vực
backend, databases

Hướng nghiên cứu

Bắt đầu với PipelineSchedule.pipeline_class trong vulnerabilities/models.py, sau đó lần theo nơi nó được dùng trong PipelineRunListView và PipelineRunDetailView, cũng như trong PipelineRun.pipeline_url. Chạy PipelineRunViewsUnregisteredPipelineTestCase mới trong vulnerabilities/tests/test_view.py; hoàn tất khi cả hai trang chạy pipeline đều trả về 200 đối với một pipeline chưa đăng ký và hiển thị id của pipeline làm tên trang.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
719
Fork
359
Merge trung bình
11 giờ 59 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của aboutcode-org/vulnerablecode

Tất cả issue của aboutcode-org/vulnerablecode

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.