Concurrent Project creation allows overlapping Data Source paths

Open
#213 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
22/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
django, python
Domain
backend, database

Research direction

The bug is in the POST handler for /api/plugins/netbox-scripts/projects/, where data path overlap is validated before the Project is saved. Start by finding that validation and the create path, then check how it runs inside a transaction. Reproduce with two concurrent requests using the steps in the issue. Done means concurrent creation of overlapping Projects on one Data Source is rejected, and the existing edit validation still passes.

Written by the indexing model from the issue text.

Description

app: scripts Bucket: KTLO 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 and synchronize a Data Source containing the directory automation/netbox.
  2. From separate clients, concurrently send two POST requests to /api/plugins/netbox-scripts/projects/ to create Data Source-backed Projects on the same Data Source, using distinct names and keys and the following data paths:
    • automation
    • automation/netbox
  3. Check the resulting Projects.
Expected Behavior

One request succeeds and the other is rejected with a validation error. Projects on the same Data Source must not have overlapping directories.

Observed Behavior

If both requests validate before either transaction commits, both Projects can be created despite their overlapping directories.

Subsequent attempts to edit either Project fail validation because of the overlapping data paths.

The race condition was reproduced using separate database sessions on the development branch for #33.

Dominant language
Python
Stars
9
Forks
0
Avg merge
18h 59m
Merged PRs (30d)
93

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from netbox-community/netbox-scripts

All issues in netbox-community/netbox-scripts

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.