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

API: POST /locations parent_id validation fails silently #15341

Closed
2 tasks done
StarlessNights opened this issue Aug 20, 2024 · 0 comments
Closed
2 tasks done

API: POST /locations parent_id validation fails silently #15341

StarlessNights opened this issue Aug 20, 2024 · 0 comments

Comments

@StarlessNights
Copy link
Contributor

Debug mode

Describe the bug

When POSTing1 a new location through the api, an invalid parent_id parameter is ignored silently.

Reproduction steps

POST a new location with a nonexistent parent_id:

{
  "name": "New location",
  "parent_id": -5
}

The request will succeed, but the created location doesn't have parent set.

Expected behavior

The request should return a failure indicating that the parent_id was invalid. It already does this with invalid manager_id:

{
  "status": "error",
  "messages": {
    "manager_id": [
      "The selected manager id is invalid."
    ]
  },
  "payload": null
}

Screenshots

No response

Snipe-IT Version

7.0.10

Operating System

Ubuntu (Container)

Web Server

Apache

PHP Version

8.1

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

Container in Kubernetes.

Footnotes

  1. Likely this affects PUT and PATCH operations as well.

snipe added a commit that referenced this issue Aug 21, 2024
@snipe snipe closed this as completed in 4d03f1e Aug 21, 2024
FlorentDotMe pushed a commit to TelecomsSansFrontieres/snipe-it that referenced this issue Aug 21, 2024
Signed-off-by: snipe <snipe@snipe.net>
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

1 participant