influxdata / influxdata/influxdb

InfluxDB 2(api/orgs): Filter by UserID with invalid ID returns current organization instead of an error

Open
#19,110 1 comment 0 reactions 0 assignees View on GitHub
area/2.x area/api kind/bug
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

__Steps to reproduce:__
```
>curl -H "Authorization: Token my-token" http://localhost:9999/api/v2/orgs?userID=aaaaaaaaaaaaaaaa
{
"links": {
"self": "/api/v2/orgs"
},
"orgs": []
}
>curl -H "Authorization: Token my-token" http://localhost:9999/api/v2/orgs?userID=aaaaaa
{
"links": {
"self": "/api/v2/orgs"
},
"orgs": [
{
"links": {
"buckets": "/api/v2/buckets?org=my-org",
"dashboards": "/api/v2/dashboards?org=my-org",
"labels": "/api/v2/orgs/061039e69dd07000/labels",
"logs": "/api/v2/orgs/061039e69dd07000/logs",
"members": "/api/v2/orgs/061039e69dd07000/members",
"owners": "/api/v2/orgs/061039e69dd07000/owners",
"secrets": "/api/v2/orgs/061039e69dd07000/secrets",
"self": "/api/v2/orgs/061039e69dd07000",
"tasks": "/api/v2/tasks?org=my-org"
},
"id": "061039e69dd07000",
"name": "my-org",
"description": "",
"createdAt": "2020-07-27T15:35:35.287608197Z",
"updatedAt": "2020-07-27T15:35:35.287608297Z"
}
]
}
```

__Expected behavior:__
GET request with invalid userID to /api/v2/orgs returns an error about invalid ID.

__Actual behavior:__
GET request with valid, but not existing, userID to /api/v2/orgs returns empty list.
GET request with invalid UserID to /api/v2/orgs returns current organization.

__Environment info:__

* InfluxDB version: Beta 15

Contributor guide

Open the contributing guide

Research direction

Start at the GET /api/v2/orgs endpoint and reproduce the two userID cases described in the issue. Trace how the endpoint parses the userID and handles an invalid ID versus a valid but nonexistent ID. Done means invalid IDs return an error, while valid nonexistent IDs still return an empty list.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.