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

[feature] Add safeguards against raw queries in global-query #316

Conversation

els0r
Copy link
Owner

@els0r els0r commented May 15, 2024

Will not run a query iff:

  • the query args contain a raw query
  • no condition is provided

The error response will look as follows:

{
  "$schema": "http://localhost:8146/schemas/ErrorModel.json",
  "title": "Unprocessable Entity",
  "status": 422,
  "detail": "query safeguards violation",
  "errors": [
    {
      "message": "unbounded query. Hint: narrow down attributes",
      "location": "body.query",
      "value": "raw"
    },
    {
      "message": "unbounded query. Hint: supply condition to filter results",
      "location": "body.condition",
      "value": ""
    }
  ]
}

Other

Drive-by fix for OpenAPI generation of global-query in build pipeline.

@els0r els0r linked an issue May 15, 2024 that may be closed by this pull request
@els0r els0r marked this pull request as ready for review May 15, 2024 08:56
@els0r els0r requested a review from fako1024 May 15, 2024 08:56
Copy link
Collaborator

@fako1024 fako1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL at the comments, especially the one regarding code clutter...

cmd/global-query/pkg/distributed/query.go Outdated Show resolved Hide resolved
cmd/global-query/pkg/distributed/query.go Outdated Show resolved Hide resolved
cmd/global-query/pkg/distributed/query.go Outdated Show resolved Hide resolved
@els0r els0r merged commit 33b56f7 into main May 15, 2024
5 checks passed
@els0r els0r deleted the 315-global-query-add-safeguards-for-running-raw-queries-without-a-condition branch May 15, 2024 09:58
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.

global-query: add safeguards for running raw queries without a condition
2 participants