Using tight permissions causes tag filtering to fail #7914

Closed
opened 2025-12-29 20:29:55 +01:00 by adam · 6 comments
Owner

Originally created by @frippe75 on GitHub (Apr 17, 2023).

NetBox version

v3.0.7

Python version

3.8

Steps to Reproduce

Created a token and assigned it a user. Created tighter permissions to allow only viewing of prefixes.

If I do a get on /api/ipam/prefixes all prefixes belonging to my tenant is returned.
If I do a /api/ipam/prefixes/?tag=myslug001 it returns zero prefixes.

I have not been able to figure out how to use Netbox in a multitenancy setting but found an article about using constraints so I think it's my constraint that messed things up:

{ "tenant__name": "my-tenant01" }

Expected Behavior

Return a single prefix with the unique tag I have assigned that prefix

Observed Behavior

Returns a count of zero

Originally created by @frippe75 on GitHub (Apr 17, 2023). ### NetBox version v3.0.7 ### Python version 3.8 ### Steps to Reproduce Created a token and assigned it a user. Created tighter permissions to allow only viewing of prefixes. If I do a get on /api/ipam/prefixes all prefixes belonging to my tenant is returned. If I do a /api/ipam/prefixes/?tag=myslug001 it returns zero prefixes. I have not been able to figure out how to use Netbox in a multitenancy setting but found an article about using constraints so I think it's my constraint that messed things up: { "tenant__name": "my-tenant01" } ### Expected Behavior Return a single prefix with the unique tag I have assigned that prefix ### Observed Behavior Returns a count of zero
adam added the type: bug label 2025-12-29 20:29:55 +01:00
adam closed this issue 2025-12-29 20:29:55 +01:00
Author
Owner

@frippe75 commented on GitHub (Apr 17, 2023):

One way to make this work is to run GET and handle it client side but not very pretty.

It appears the constraint together with "tag-filtering" is not working.

@frippe75 commented on GitHub (Apr 17, 2023): One way to make this work is to run GET and handle it client side but not very pretty. It appears the constraint together with "tag-filtering" is not working.
Author
Owner

@jeremystretch commented on GitHub (Apr 17, 2023):

Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

@jeremystretch commented on GitHub (Apr 17, 2023): Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.
Author
Owner

@frippe75 commented on GitHub (Apr 17, 2023):

Ok I thought it was quite clear.

  1. Create a user user01, a tenant and a tenant group with the name tenant01.
  2. Create the tag NET:A
  3. Create a prefix with an associated tag NET:A (slug = neta) with the prefix and set the tenant and tenant group to tenant01.
  4. Create a view permission on "ipam | prefix" and set a constraint of { "tenant__name": "tenant01" }

Run the two different REST API calls:

Remove the constraint and both will work.

@frippe75 commented on GitHub (Apr 17, 2023): Ok I thought it was quite clear. 1. Create a user user01, a tenant and a tenant group with the name tenant01. 2. Create the tag NET:A 3. Create a prefix with an associated tag NET:A (slug = neta) with the prefix and set the tenant and tenant group to tenant01. 4. Create a view permission on "ipam | prefix" and set a constraint of { "tenant__name": "tenant01" } **Run the two different REST API calls:** - https://netbox01/api/ipam/prefixes (all (count=1) prefixes belonging to tenant01 is returned) - https://netbox01/api/ipam/prefixes/?tag=neta (it returns zero prefixes.) Remove the constraint and both will work.
Author
Owner

@kkthxbye-code commented on GitHub (Apr 18, 2023):

@frippe75 - Followed your steps and I cannot replicate it on v3.4.8.

@kkthxbye-code commented on GitHub (Apr 18, 2023): @frippe75 - Followed your steps and I cannot replicate it on v3.4.8.
Author
Owner

@frippe75 commented on GitHub (Apr 18, 2023):

That is great news. Maybe I simply need to update. Lagging behind. Thanks for taking the time to reproduce!

@frippe75 commented on GitHub (Apr 18, 2023): That is great news. Maybe I simply need to update. Lagging behind. Thanks for taking the time to reproduce!
Author
Owner

@jeremystretch commented on GitHub (Apr 18, 2023):

Closing this as it does not appear to be actionable.

@jeremystretch commented on GitHub (Apr 18, 2023): Closing this as it does not appear to be actionable.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7914