Data Source revisions can import native extensions instead of reviewed Python source
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
- 76/100
Hướng nghiên cứu
Bắt đầu bằng cách đọc chính sách đường dẫn nguồn loại trừ .pyc, .pyo và __pycache__, sau đó theo dõi cách các bản sửa đổi Data Source tạo manifest và tải các mô-đun script. Kiểm tra các bài kiểm thử hiện có về việc nhập dữ liệu và xác thực bản sửa đổi. Công việc hoàn tất khi các tệp phần mở rộng gốc như .so và .pyd bị loại trừ, đồng thời bản sửa đổi có cả helper.so và helper.py sử dụng mã nguồn Python đã được xem xét.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Plugin Version
v0.0.1
NetBox Version
v4.7.1
Python Version
3.12
Steps to Reproduce
- On Linux with CPython 3.12, build a minimal native extension named
helper.sofromhelper.c:#include <Python.h> static int initialize(PyObject *module) { return PyModule_AddStringConstant(module, "VALUE", "native extension"); } static PyModuleDef_Slot slots[] = {{Py_mod_exec, initialize}, {0, NULL}}; static struct PyModuleDef def = {PyModuleDef_HEAD_INIT, "helper", NULL, 0, NULL, slots}; PyMODINIT_FUNC PyInit_helper(void) { return PyModuleDef_Init(&def); }gcc -shared -fPIC $(python3.12-config --includes) -o helper.so helper.c - Create a Data Source containing these files under
scripts/:helper.so— the compiled extension.helper.py— containingVALUE = "reviewed source".deploy.py— containing:
from netbox_scripts.scripts import Script from . import helper class Deploy(Script): class Meta: description = helper.VALUE - Create a Script Project backed by that Data Source, using
scriptsas its data path, with Automatic if valid activation anddeploy.pyenabled as a Script File. - Stage the source using
netbox_scripts.ingestion.ingest_data_source()and run the revision's validation Job. - Inspect the revision manifest, the published Script's description, and the loader used for
helper.
Expected Behavior
Compiled Python extension modules should not be included in Project revisions, consistent with the existing policy for compiled Python files.
A native extension should not be imported instead of a reviewed .py file with the same module name.
Observed Behavior
The revision includes helper.so in its manifest, validates without errors, and activates successfully.
The published Deploy Script has the description "native extension" instead of "reviewed source".
Python imports helper.so using ExtensionFileLoader, giving it precedence over helper.py. The extension also imports successfully when helper.py is absent.
When only helper.py is present, the published description is "reviewed source".
The source path policy currently excludes .pyc, .pyo, and __pycache__, but does not exclude native extension modules such as .so or .pyd.
This affects Data Source Projects; uploads accept only .py files.
Someone with permission to modify the Data Source can already execute Python code, so this does not introduce a new execution capability. However, it allows a compiled module to run instead of the source a reviewer expects.
Related to #138, but a separate import mechanism.
- Ngôn ngữ chính
- Python
- Star
- 8
- Fork
- 0
- Merge trung bình
- 12 giờ 34 phút
- Pull request đã merge (30 ngày)
- 57
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của netbox-community/netbox-scripts
-
app: scripts severity: low status: backlog type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
netbox-community/netbox-scripts#164 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
app: scripts severity: low status: backlog type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
netbox-community/netbox-scripts#153 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Committed `runcustomscript` runs do not deliver Event Rule actionsCó thể đã có người làm @pheus đã nhận 1 ngày trước. Đang mởapp: scripts Bucket: KTLO severity: medium status: accepted type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
netbox-community/netbox-scripts#152 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Document that Project revisions do not preserve symbolic links or device filesCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởapp: scripts status: backlog type: documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
netbox-community/netbox-scripts#137 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
app: scripts severity: low status: backlog type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
netbox-community/netbox-scripts#134 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của netbox-community/netbox-scripts
Issue tương tự
-
Claiming namespace `kliklamala`Đang mởnamespace
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
EclipseFdn/open-vsx.org#15604 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 5 ngày
-
Public function to read participants.tsvCó thể đã có người làm @bruAristimunha đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
huggingface/tau#799 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
allenai/open-instruct#2245 ·
Maintainer thường phản hồi trong vòng 1 ngày