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

Prevent Persisted Queries from saving if arguments are used without variables #224

Open
jasonbahl opened this issue Jun 20, 2023 · 0 comments
Labels
effort: med Less than a week type: enhancement Improvements to existing functionality

Comments

@jasonbahl
Copy link
Collaborator

We should prevent persisted queries from being saved if the query uses arguments but does not define variables for the arguments.

This will prevent situations where string concatenation is used instead of variables and a plethora of queries are stored instead of a singular query with variables.

We had 1 user use string concatenation that lead to 72,000 queries being stored.

i.e.

const POST_ID = $something_dynamic_from_url_or_something;

const query = `query { 
  post( id: ${POST_ID} idType: DATABASE_ID) { 
     id 
     title
     date 
   }
}`

This would create a different persisted query for every ID used because of the string interpolation.

We should prevent this query from being saved as a persisted query and a clear error message should be returned explaining why the persisted query cannot be saved.

@markkelnar markkelnar self-assigned this Aug 10, 2023
@jasonbahl jasonbahl added type: enhancement Improvements to existing functionality effort: med Less than a week labels Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: med Less than a week type: enhancement Improvements to existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants