Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Failed REST uploads expose internal error details

Đang mở Phù hợp với người mới
#77 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

Chưa có ai nhận issue này.

Đá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
72/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ệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu với trình xử lý tải lên được mô tả trong issue và fixture UploadAPITestCase hiện có. Theo dõi cách StorageError, OSError và ImproperlyConfigured được chuyển thành phản hồi HTTP 400, sau đó chạy các bài kiểm tra API tải lên. Hoàn tất khi các lỗi trả về một thông báo cố định mà không để lộ chi tiết ngoại lệ, trong khi lỗi gốc vẫn có trong log.

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

Mô tả

app: scripts severity: medium status: backlog type: bug
Plugin Version

v0.0.1

NetBox Version

v4.7.4

Python Version

3.12

Steps to Reproduce
  1. Create a Script Project with source type Upload.
  2. In a local API test, patch the configured netbox_scripts storage backend's save() method to raise:
    PermissionError(
        13,
        'Permission denied',
        '/srv/netbox/private/deploy.py',
    )
    
  3. As a user with permission to change the Project and add Script Files, POST a Python source file as multipart form data to /api/plugins/netbox-scripts/projects/<id>/upload/.

This was reproduced using the existing UploadAPITestCase fixture and a mocked backend failure.

Expected Behavior

The upload returns HTTP 400 with a fixed message, such as “The upload could not be stored.” The underlying exception and traceback are logged for troubleshooting.

Configuration failures should also return a fixed message without including internal exception details.

Observed Behavior

The response is HTTP 400, but its detail includes the storage exception's message, including the internal path:

[Errno 13] Permission denied: '/srv/netbox/private/deploy.py'

A failure from the backend's save() method also includes the generated storage key.

The upload handler formats caught StorageError and OSError exceptions into the response. Its adjacent ImproperlyConfigured handler returns the exception text directly, which can include internal details from a failed NetBox Branching routing check.

Ngôn ngữ chính
Python
Star
8
Fork
0
Merge trung bình
11 giờ 23 phút
Pull request đã merge (30 ngày)
24

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

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 netbox-community/netbox-scripts

Tất cả issue của netbox-community/netbox-scripts

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.