Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/hardware/audit/{due,overdue} API returning all assets, not just those which are due for an audit #15548

Closed
2 tasks done
samuelb opened this issue Sep 24, 2024 · 3 comments
Closed
2 tasks done

Comments

@samuelb
Copy link

samuelb commented Sep 24, 2024

Debug mode

Describe the bug

The API endpoints /hardware/audit/due and /hardware/audit/overdue are returning always all assets and not just those which are due or overdue for an audit, as documented.

The issue seems to persist since a while. I accidentally used Snipe-IT v6.4.1 in a test installation and reproduced it. But also 7.0.11 has the same issue.

I saw in the source that this an legacy API and the new APIs are /hardware/audits/due, /hardware/audits/overdue and /hardware/audits/due-or-overdue, which work as expected. However, the docs is still mentioning the old API.

Reproduction steps

  1. Ensure in Settings -> Notification that "Audit Interval" is defined.
  2. Create a new asset or edit an existing asset. Ensure that the attribute "Next Audit Date" is way in the future, after the configured audit interval
  3. Create yourself an API token
  4. curl -H 'Authorization: Bearer <api token>' https://<server>/api/v1/hardware/audit/due | jq (or any other tool of your choice). You can see that your asset, which should not be due for audit, is listed, among any other assets which may exists.

Expected behavior

The APIs /hardware/audit/due and /hardware/audit/overdue should only return assets which are actually due or overdue for audit. The result should be comparable to the APIs /hardware/audits/due and /hardware/audits/overdue.

Screenshots

No response

Snipe-IT Version

6.4.1, 7.0.11

Operating System

Debian 12, Docker

Web Server

Apache

PHP Version

8.1.2, 8.3.8

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

  • Is this a fresh install or an upgrade? Discovered on a existing system, confirmed in a fresh docker installation version 6.4.1 and 7.0.11
  • What method you used to install Snipe-IT: manual and docker
  • Indicate whether or not you've manually edited any data directly in the database: nope
Copy link

welcome bot commented Sep 24, 2024

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@samuelb samuelb changed the title /hardware/audit/{due,overdue} API returning all assets, not just those wher the audit is due /hardware/audit/{due,overdue} API returning all assets, not just those which are due for an audit Sep 24, 2024
@snipe
Copy link
Owner

snipe commented Sep 24, 2024

Can you not just use the new urls, /api/v1/hardware/audits/due and /api/v1/hardware/audits/overdue?

snipe added a commit that referenced this issue Sep 24, 2024
@snipe snipe closed this as completed in de57d71 Sep 25, 2024
@samuelb
Copy link
Author

samuelb commented Sep 25, 2024

Can you not just use the new urls, /api/v1/hardware/audits/due and /api/v1/hardware/audits/overdue?

Yes, sure, this is what I did at the end. But still the API (.../audit/...) didn't work as documented and that's why I reported it.

I can confirm it works now on the master branch. Thx for fixing it! 🤗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants