Commit Graph

76 Commits

Author SHA1 Message Date
Jeremy Stretch 6ecfa972fd #21025: Remove obsolete section from docs 2026-08-14 15:02:00 -04:00
Jeremy Stretch 9abbebe392 Add v4.7 release notes 2026-08-14 13:53:02 -04:00
Jeremy Stretch e6dfad94c5 Move sequential creation behavior into BulkCreateModelMixin to ensure consistent error reports 2026-08-10 15:55:00 -04:00
Jeremy Stretch d2df19790f Merge branch 'main' into feature
# Conflicts:
#	contrib/openapi.json
#	docs/release-notes/version-4.6.md
#	netbox/dcim/choices.py
#	netbox/dcim/forms/mixins.py
#	netbox/dcim/models/device_component_templates.py
#	netbox/dcim/models/device_components.py
#	netbox/extras/dashboard/widgets.py
#	netbox/extras/graphql/types.py
#	netbox/extras/models/configs.py
#	netbox/extras/tests/test_templatetags.py
#	netbox/ipam/choices.py
#	netbox/ipam/forms/model_forms.py
#	netbox/netbox/configuration_example.py
#	netbox/netbox/filtersets.py
#	netbox/netbox/tests/test_api.py
#	netbox/netbox/tests/test_scaffold.py
#	netbox/netbox/tests/test_tables.py
#	netbox/project-static/dist/netbox.js
#	netbox/project-static/dist/netbox.js.map
#	netbox/project-static/package.json
#	netbox/project-static/yarn.lock
#	netbox/release.yaml
#	netbox/translations/cs/LC_MESSAGES/django.mo
#	netbox/translations/cs/LC_MESSAGES/django.po
#	netbox/translations/da/LC_MESSAGES/django.mo
#	netbox/translations/da/LC_MESSAGES/django.po
#	netbox/translations/de/LC_MESSAGES/django.mo
#	netbox/translations/de/LC_MESSAGES/django.po
#	netbox/translations/en/LC_MESSAGES/django.po
#	netbox/translations/es/LC_MESSAGES/django.mo
#	netbox/translations/es/LC_MESSAGES/django.po
#	netbox/translations/fr/LC_MESSAGES/django.mo
#	netbox/translations/fr/LC_MESSAGES/django.po
#	netbox/translations/it/LC_MESSAGES/django.mo
#	netbox/translations/it/LC_MESSAGES/django.po
#	netbox/translations/ja/LC_MESSAGES/django.mo
#	netbox/translations/ja/LC_MESSAGES/django.po
#	netbox/translations/ko/LC_MESSAGES/django.mo
#	netbox/translations/ko/LC_MESSAGES/django.po
#	netbox/translations/lv/LC_MESSAGES/django.mo
#	netbox/translations/lv/LC_MESSAGES/django.po
#	netbox/translations/nl/LC_MESSAGES/django.mo
#	netbox/translations/nl/LC_MESSAGES/django.po
#	netbox/translations/pl/LC_MESSAGES/django.mo
#	netbox/translations/pl/LC_MESSAGES/django.po
#	netbox/translations/pt/LC_MESSAGES/django.mo
#	netbox/translations/pt/LC_MESSAGES/django.po
#	netbox/translations/ru/LC_MESSAGES/django.mo
#	netbox/translations/ru/LC_MESSAGES/django.po
#	netbox/translations/tr/LC_MESSAGES/django.mo
#	netbox/translations/tr/LC_MESSAGES/django.po
#	netbox/translations/uk/LC_MESSAGES/django.mo
#	netbox/translations/uk/LC_MESSAGES/django.po
#	netbox/translations/zh/LC_MESSAGES/django.mo
#	netbox/translations/zh/LC_MESSAGES/django.po
#	netbox/utilities/jinja2.py
#	netbox/utilities/tests/test_filters.py
#	requirements.txt
2026-07-28 14:24:24 -04:00
Jeremy Stretch 728c84470b
Closes #22753: Add `header_safe` Jinja2 filter for sanitizing webhook headers (#22754)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 10:58:25 -05:00
Jeremy Stretch e50683fee9 Merge main into feature 2026-07-21 09:09:58 -04:00
Jeremy Stretch e713b4fd07 Fixes #21988: Enforce view permissions when referencing related object by attributes in REST API 2026-07-16 11:38:33 -04:00
Jason Novinger 9f47700e23
Closes #22538: Add security note for HTTP_CLIENT_IP_HEADERS client-IP trust (#22614)
* Fixes #22538: Add security note for HTTP_CLIENT_IP_HEADERS client-IP trust

* Clarify header naming and leftmost-address behavior in client IP warning
2026-07-07 09:09:50 -07:00
Jeremy Stretch 80c81230a4 Closes #22615: Remove legacy request_id and username parameters from webhook context 2026-07-07 11:13:09 -04:00
Jeremy Stretch df83277156
Closes #22607: Sanitize HTTP requests passed to template contexts for custom links (#22616) 2026-07-07 08:59:24 -05:00
Jeremy Stretch a907ba2062
#21992: Additional cleanup (#22594) 2026-07-06 09:45:45 -05:00
Jeremy Stretch d28f0a2114 Merge branch 'main' into feature
Resolved conflicts:
- Dropped 4.7 deprecation shims (FutureWarning getattr/methods) re-introduced
  by main, which feature has already removed: pagination, constants, registry,
  forms utils/expandable, settings (Sentry), generic view mixins.
- dcim/signals.py: kept main's search-cache-on-VC-rename handler; dropped
  Prefix/Cluster/WirelessLAN imports for the scope-sync handler feature replaced
  with PostgreSQL triggers.
- extras test_management_commands.py: unioned ConfigContext + ImageAttachment
  imports.
- Rebuilt project-static dist bundles (netbox.js/.map/.css) from merged source.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 11:32:37 -04:00
mburggraf f9ce0a6741
Closes #22464: Update Documentation to use v2 Tokens in examples (#22477) 2026-06-17 13:44:29 -07:00
Jason Novinger 89504b2502
Closes #21992: Enable background job support for REST API bulk requests (#22452)
Bulk write operations (create/update/delete a JSON list at a model's list
endpoint) can opt into background processing with the ?background=true query
parameter. The request is validated synchronously and, if accepted, an
AsyncAPIJob is enqueued and a 202 Accepted is returned with the job id and
poll URL; the write is performed later by a worker that re-invokes the same
viewset action, so behavior matches the synchronous path (including
all-or-nothing transaction semantics).

- AsyncAPIJob reconstructs the request in the worker, re-applies object
  permissions, runs within the request processors (change logging/events),
  and captures the action's response into job.data as {status_code, data}.
- Handled rejections are translated to match the synchronous API: APIException
  via handle_exception(), and AbortRequest/ProtectedError/RestrictedError via a
  new NetBoxModelViewSet.exception_to_response() helper. These terminate the
  job as "failed" (reserving "errored" for unexpected crashes).
- Background processing is refused with 503 when no worker is servicing the
  queue, and rejected with 400 when combined with an If-Match precondition
  (which cannot be honored once execution is deferred).
- Single-object writes, GET requests, and non-list payloads ignore the
  parameter and run synchronously.

exception_to_response() intentionally duplicates the translation logic in
dispatch() rather than dispatch() being refactored to call it; consolidating
the two is left as a follow-up to keep this change off the synchronous hot path.

* Address code review feedback (#21992)

- Carry the request's scheme and host into the background worker so absolute
  URLs in the captured job result point at the real server instead of a
  hardcoded http://localhost/.
- Emit the same protected-delete warning log in exception_to_response() that
  dispatch() produces, restoring application-log parity for background failures.
- Drop the inert `_authenticator = None` assignment: setting request.user
  already prevents lazy re-authentication via the public API, and nothing on
  the worker's action path reads the authenticator.
- Remove the redundant success-path job.save() (JobRunner.handle() ->
  terminate() persists job.data) and hoist the AsyncAPIJob import in mixins.py
  to module level (no real import cycle through it).
- Add a test asserting result URLs reflect the request host.

* Fix IPv6 host parsing in background API request reconstruction

Parse the carried host with urlsplit (and pass it verbatim as HTTP_HOST)
instead of host.partition(':'), which split bracketed IPv6 hosts like
[::1]:8443 on their inner colons. Extract request construction into
AsyncAPIJob._build_request and add a test asserting the IPv6 host round-trips.

* Address review feedback (#21992)

- Make the bulk mixins safe to use without BackgroundOperationMixin: guard the
  _background_requested / _maybe_background_bulk_create calls with a getattr
  fallback so BulkUpdateModelMixin/BulkDestroyModelMixin/SequentialBulkCreatesMixin
  retain their standalone behavior in custom viewset composition.
- Add a test covering the background ProtectedError/RestrictedError path: a bulk
  delete of a protected object records the same 409 the synchronous API returns
  (job failed, status_code 409, object preserved), via exception_to_response().
2026-06-16 12:48:17 +02:00
Jeremy Stretch 814050a3c9 Closes #22409: Disallow chosen-plaintext API tokens 2026-06-08 14:14:30 -04:00
Jeremy Stretch 2703ff98a3
Closes #22128: Deprecate v1 API tokens (#22143)
Display a warning in the UI whenever a user goes to provision a v1
token (both via the admin token form and the user profile token form).
Update documentation to note that v1 tokens are deprecated and will be
removed in NetBox v5.0.
2026-05-07 08:48:25 -07:00
Jeremy Stretch e50aff8736
Documentation cleanup (#22127) 2026-05-06 16:58:08 -05:00
Jeremy Stretch df02abbbdf Merge branch 'main' into feature 2026-04-23 11:10:58 -04:00
Grische 26c6c59797
Fixes #21935: Document MAX_PAGE_SIZE effect on GraphQL (#21940) 2026-04-20 13:01:48 +02:00
Jeremy Stretch 06c90cb86a
Closes #21847: Correct webhook documentation for deprecated keys (#21848) 2026-04-07 15:58:45 +02:00
Jeremy Stretch 6030fc383a Merge branch 'main' into feature 2026-03-18 10:16:21 -04:00
Jeremy Stretch 6659bb3abe
Closes #21363: Implement cursor-based pagination for the REST API (#21594) 2026-03-06 17:13:08 -08:00
Martin Hauser 758b230403
docs(webhooks): Update context variables and example payload (#21607)
Clarify webhook context variable names and event types.
Replace `model` with `object_type`, update event values to match actual
output (`created` vs. `create`), and refresh example JSON to reflect the
current API response format, including new fields like `display` and
`display_url`.

Fixes #21489
2026-03-06 09:04:30 -08:00
bctiemann 3320e07b70
Closes #21284: Add deprecation note to webhooks documentation (#21491)
* Add searchable deprecation comments on request_id and username fields in EventContext

* Add deprecation note in webhooks documentation

* Expand deprecation note/warning

* Add version number to deprecation warning

* Add deprecation warning to two other places
2026-02-20 19:52:42 +01:00
Jeremy Stretch 5c6fc2fb6f
Closes #21110: Support for cursor-based pagination in GraphQL API (#21322) 2026-01-30 11:45:35 -08:00
Jeremy Stretch 1526e437f1
Closes #21244: Introduce ability to omit specific fields from REST API responses (#21312)
Introduce support for omitting specific serializer fields via an
`omit` parameter, acting as the inverse of `fields`.
Wire it through the API viewset and queryset optimization helpers
so omitted fields don’t trigger unnecessary annotations/prefetches,
and document the new behavior.
2026-01-28 22:06:46 +01:00
Mark Robert Coleman e60807adc5
Fixes #21121: Expand changelog message doc/add cross-references (#21138) 2026-01-13 09:58:06 -06:00
Jeremy Stretch 2bebfccf9b Closes #20492: Disable API token plaintext retrieval 2025-10-14 14:57:37 -04:00
Jeremy Stretch c63e60a62b Add a token prefix 2025-10-06 17:04:10 -04:00
Jeremy Stretch 82db8a9c02 Update documentation 2025-10-03 14:24:21 -04:00
Jeremy Stretch 1ee23ba6fa Initial work on #20210 2025-10-02 15:04:29 -04:00
Jeremy Stretch ae55eed98f
Closes #19965: Expand Prometheus metrics (#19966) 2025-07-31 13:27:50 -07:00
Jeremy Stretch 24a0e1907a
Closes #19713: Enable recording user messages in the change log (#19908)
* Add message field to ObjectChange model

* Set max length on changelog message

* Enable changelog messages for single object operations

* Fix tests

* Add changelog message support for bulk edit & bulk delete

* Cosmetic improvements to form fields

* Fix bulk operation templates

* Add message support for bulk import/update

* Add REST API support for changelog messages (WIP)

* Fix changelog_message assignment

* Enable changelog message support for bulk deletions

* Add documentation

* Fix changelog message support for VirtualChassis

* Add ChangeLoggingMixin to necesssary model forms

* Introduce get_random_string() utility function for tests

* Incorporate changelog messages for object view tests

* Incorporate changelog messages for object bulk view tests

* Add missing mixins for changelog message support

* Tweak test to generate expected number of change records

* Finish adding tests for changelog message functionality

* Misc cleanup

* Fixes #19956: Prevent duplicate deletion records from cascading deletions

* Tweak bulk deletion test to work around cascading deletions issue

* Correct API URL
2025-07-29 09:11:33 -05:00
Jeremy Stretch 64b5867cb3 Merge branch 'main' into feature 2025-05-01 09:45:38 -04:00
Markku Leiniö 0466c8ef9b
Closes #19167: Update REST API examples (#19353)
* Closes #19167: Update REST API examples

* Fix missing description

---------

Co-authored-by: Markku Leiniö <markkuleinio@users.noreply.github.com>
2025-04-29 13:31:06 -04:00
Jeremy Stretch 0f4afbca2c
Closes #17243: Include example of image upload using REST API (#19330) 2025-04-25 15:33:46 -05:00
Jeremy Stretch fc0acb020f Merge main into feature 2025-04-10 17:17:21 -04:00
Arthur Hanson fe7cc8cae9
Closes #16224 GraphQL Pagination (#18903)
* 16244 add pagination

* 16244 add pagination

* 16244 fix order_by pagination

* 16224 document pagination

* 16224 remove extraneous code

* 16224 missing core types

* 16224 review changes

* 16224 review changes

* 16224 review changes
2025-03-20 15:00:14 -05:00
Tobias Genannt 1a60cb9884
Fixes: #18568 Update mkdocstrings and adapt config (#18841)
* Fixes: #18568 Update mkdocstrings and adapt config

* Fixed some output formatting errors

When trying to compare the output from "mkdocstrings[python-legacy]==0.27.0" and
"mkdocstrings[python]==0.28.2" I encountered some HTML errors:
- <div> inside a <p>
- unescaped non-tags <pk>
2025-03-10 13:11:35 -04:00
Jeremy Stretch c35f5f829a
Closes #7598: Enable custom field filtering for GraphQL (#18701) 2025-03-07 10:49:06 -08:00
mr1716 9c1358e6e7 #18698 Correct REST Wikipedia URL In Documentation 2025-02-21 09:34:16 -05:00
mr1716 8aecf53d0e #18513 Updating Documentation Relating To Strawberry-Django Links 2025-01-31 14:14:48 -05:00
Jeremy Stretch 56f110c2a9
Closes #17288: Limit the number of aliases within a GraphQL API requests to 10 (#17329)
* Closes #17288: Limit the number of aliases within a GraphQL API request to 10

* Introduce GRAPHQL_MAX_ALIASES config parameter
2024-09-02 09:30:41 -04:00
Jeremy Stretch 10a74492f6 #17143: Update docs for nested serializer use 2024-08-30 10:18:29 -04:00
Arthur Hanson 56ea7b8714
16014 Update incorrect django-graphene reference and add link to filtering docs. (#16015)
* 16014 change ref from django-graphene to django-strawberry

* 16014 add references to filtering syntax

* 16014 remove graphene reference

* 16014 remove graphene reference

* Remove obsolete reference to Graphene

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-05-08 14:29:54 -04:00
Jeremy Stretch 46bd62fdc9 Merge branch 'develop' into feature 2024-04-22 13:23:42 -04:00
muTeREdO 238fa704b9
add example showing how to order results. (#15627)
* add example showing how to order results.

This addresses issue 15622 by building off filtering example to
show how to order results on a named field.

* Apply suggestions from code review

---------

Co-authored-by: Frank Clements <fclements@scoore.net>
Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-04-04 14:21:26 -04:00
Jeremy Stretch 489e956d83 Merge branch 'develop' into feature 2024-04-03 08:43:12 -04:00
Markku Leiniö d285edc0c7
Fixes #15583: Update API token provisioning example response (#15584)
* Fixes #15583: Update API token provisioning example response

* Fix 'display' field output
2024-04-03 07:58:46 -04:00
Arthur Hanson c8d288671e
15552 graphql docs (#15578)
* 15552 update query

* 15552 update query

* 15552 update query

* Update docs/integrations/graphql-api.md

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-03-29 14:50:11 -04:00