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

[bug] CSI volume endpoint returns 200 OK when payload is nonsensical #8026

Closed
jrasell opened this issue May 20, 2020 · 3 comments · Fixed by #8027
Closed

[bug] CSI volume endpoint returns 200 OK when payload is nonsensical #8026

jrasell opened this issue May 20, 2020 · 3 comments · Fixed by #8027
Labels
theme/api HTTP API and SDK issues type/bug
Milestone

Comments

@jrasell
Copy link
Member

jrasell commented May 20, 2020

Nomad version

Master commit 06f0f3a41563ac2cc557d8e68546ad6003b121ca

Operating system and Environment details

Reproduced on MacOS

Issue

It is possible for an operator to submit a register request to the CSI volume endpoint with a payload that is invalid and receive a 200 OK response. The register request successfully makes its ways via RPC and into raft. It misses any of Nomad's internal validation checks because the args.Volumes field is nil.

I believe inline with what I have seen in other agent endpoints, the decoded object should go through some basic validation before sending via RPC. Different endpoints approach validation in different ways:

Reproduction steps

  • run Nomad in dev mode: nomad agent -dev
  • using the payload below perform an API request: curl -v --request PUT --data @payload.json http://localhost:4646/v1/volume/csi/helloworld
  • perform the curl request again and notice the X-Nomad-Index header integer has been incremented

example payload:

{"Foo": "bar"}

Nomad logs

I added a test log message to display the output of the rafApply function call which also shows the raft index being update on subsequent calls as detailed in the reproduction steps.

2020-05-20T11:50:58.625+0200 [DEBUG] nomad.csi_volume: ---------------------->: resp=<nil> index=10
2020-05-20T11:51:03.179+0200 [DEBUG] nomad.csi_volume: ---------------------->: resp=<nil> index=11
@jrasell jrasell added type/bug theme/api HTTP API and SDK issues CSI labels May 20, 2020
@tgross
Copy link
Member

tgross commented May 20, 2020

Thanks for reporting this, @jrasell. Easy enough to fix, but we should take a pass through the other endpoints to make sure we haven't dropped the ball on this elsewhere.

@tgross tgross added this to the 0.11.3 milestone May 20, 2020
@jrasell
Copy link
Member Author

jrasell commented May 20, 2020

Agreed @tgross and I have it on my list to do a quick pass when I have some more available time.

@github-actions
Copy link

github-actions bot commented Nov 7, 2022

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
theme/api HTTP API and SDK issues type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants