Malformed revision manifests cause server errors

未关闭
#232 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
python
领域
backend

调研方向

Start by reading the existing manifest validation used by the revision file's Source tab, then trace the manifest consumers named in the issue across the project pages, file detail pages, upload operations, and REST API. Check how each consumer handles malformed stored data and how operations avoid changes when validation fails. Done means affected pages show a meaningful error without manifest-derived information, and dependent operations are refused without changes.

由索引模型根据 Issue 内容生成。

描述

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

v0.1.0

NetBox Version

v4.7.6

Python Version

3.12

Steps to Reproduce
  1. Create an upload-backed Script Project and upload a Script.
  2. Once the revision is active, overwrite its manifest using nbshell:
    from netbox_scripts.models import ScriptProjectRevision
    
    ScriptProjectRevision.objects.filter(pk=<revision_id>).update(manifest=[None])
    
  3. Open any of the following pages or attempt to upload another Script:
    • Script Project's Script Files tab
    • Script Project's Revision Files tab
    • Script File detail page
    • Revision's Files tab
    • Revision file's File tab

The last three pages are affected by the changes introduced in #224.

Expected Behavior

The affected pages remain usable and display a meaningful error, consistent with the revision file's Source tab. Information and links derived from an invalid manifest are not displayed.

Operations that depend on the manifest are refused without making changes.

Observed Behavior

The affected pages and operations fail with an HTTP 500 error, for example:

TypeError: 'NoneType' object is not subscriptable

Several consumers access the stored manifest without validating it first. This also affects the REST API.

The revision file's Source tab already handles this gracefully by displaying "The stored manifest cannot be trusted."

All manifest consumers should handle malformed manifests consistently by reusing the existing manifest validation mechanism.

The issue was identified during the implementation and review of #24 (#224).

主要语言
Python
星标
9
派生
0
平均合并
18 小时 59 分钟
30 天内合并 PR
93

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

netbox-community/netbox-scripts 的其他 Issue

查看 netbox-community/netbox-scripts 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。