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

Issue 6901: set invalid request status if request parsing fails #573

Merged
merged 2 commits into from
Sep 16, 2024

Conversation

rudrakhp
Copy link
Contributor

@rudrakhp rudrakhp force-pushed the handle_bad_requests branch from 8693ff6 to cce020e Compare July 31, 2024 09:55
@rudrakhp rudrakhp marked this pull request as ready for review July 31, 2024 10:19
@rudrakhp rudrakhp force-pushed the handle_bad_requests branch from cce020e to db4889b Compare July 31, 2024 20:19
@rudrakhp rudrakhp marked this pull request as draft July 31, 2024 20:28
@rudrakhp rudrakhp force-pushed the handle_bad_requests branch from db4889b to c429525 Compare August 6, 2024 20:29
@rudrakhp rudrakhp marked this pull request as ready for review August 6, 2024 20:32
ashutosh-narkar
ashutosh-narkar previously approved these changes Aug 6, 2024
@ashutosh-narkar
Copy link
Member

@rudrakhp please squash your commits and we can get this in. Also have you tested this end-to-end?

@rudrakhp rudrakhp force-pushed the handle_bad_requests branch from b476322 to 3e2efe9 Compare August 7, 2024 14:48
@rudrakhp rudrakhp force-pushed the handle_bad_requests branch 2 times, most recently from ece3b4e to 143b712 Compare August 7, 2024 15:24
@rudrakhp
Copy link
Contributor Author

rudrakhp commented Aug 7, 2024

@rudrakhp please squash your commits and we can get this in. Also have you tested this end-to-end?

I added a case for invalid URL in the e2e test suite, but somehow it's getting a 404 before 400 bad request. @ashutosh-narkar if you are aware of this do let me know, otherwise will come back to this tomorrow.

@rudrakhp rudrakhp force-pushed the handle_bad_requests branch from 143b712 to b131114 Compare August 7, 2024 16:07
@ashutosh-narkar
Copy link
Member

I added a case for invalid URL in the e2e test suite, but somehow it's getting a 404 before 400 bad request. @ashutosh-narkar if you are aware of this do let me know, otherwise will come back to this tomorrow.

Is the request even reaching OPA?

@ashutosh-narkar
Copy link
Member

@rudrakhp did you get a chance to look into the test failures. This would be a good one to get in.

@rudrakhp
Copy link
Contributor Author

@rudrakhp did you get a chance to look into the test failures. This would be a good one to get in.

@ashutosh-narkar was out on vacation, will get something out in the next couple of days.

@rudrakhp rudrakhp force-pushed the handle_bad_requests branch 3 times, most recently from 010abc1 to 88839fd Compare September 11, 2024 19:28
@rudrakhp
Copy link
Contributor Author

@ashutosh-narkar looks like the place where I was adding the test was for testing istio setup with the plugin enabled but requests were not going via OPA. I don't see any E2E suite where I can add this test, let me know if there is any. I think unit tests should suffice to test this behaviour as we rely on go-control-plane anyways. WDYT?

@ashutosh-narkar
Copy link
Member

@rudrakhp this looks good. If you could just update the commit message with a note explaining the change that would be great. We can then get this in. Thanks for the contribution.

If request parsing fails, instead of an error send a denied HTTP response with status 400 Bad Request.

Signed-off-by: Rudrakh Panigrahi <rudrakh97@gmail.com>
@rudrakhp
Copy link
Contributor Author

@ashutosh-narkar updated commit message

@ashutosh-narkar ashutosh-narkar merged commit f16fcd7 into open-policy-agent:main Sep 16, 2024
8 checks passed
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

Successfully merging this pull request may close these issues.

Handle incorrect user input in OPA envoy plugin
2 participants