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

Bind query parameters #219

Closed
rojikada opened this issue Mar 27, 2021 · 1 comment · Fixed by #220
Closed

Bind query parameters #219

rojikada opened this issue Mar 27, 2021 · 1 comment · Fixed by #220
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@rojikada
Copy link

rojikada commented Mar 27, 2021

Proposal:
Add a way to bind parameters to any query (i.e. query_api.query_data_frame)

Current behavior:
If I want to make an flux query i.e.:
query_api.query_data_frame(f'from(bucket: \"{self.query_bucket}\") |> range(start: {self.dt_to_influx(dt_from)}, stop: {self.dt_to_influx(dt_to)}) |> filter(fn: (r) => r["_measurement"] == "{<user_input_signals_string>}") |> filter(fn: (r) => r["_field"] == "value") |> aggregateWindow(every: {sampling}s, fn: median, createEmpty: true) |> yield(name: "median")')
It is unsafe by the OWASP standard as I'd have to bind the parameters.

Desired behavior:
I'd like the quer_data_frame function to have an bind_parameters/params optional input, where I could put an dictionary for those inputs, with their types.

Alternatives considered:
I could filter the strings, but it is considered unsafe by the OWASP. I found, there is a "sanitize_for_serialization" method in the api_client.call_api code, but _query_api.post_query in query_api ommits this same as function query_data_frame_stream used by query_data_frame.

Use case:
I must have safe code as it is part of critical structure.

@bednar bednar added the enhancement New feature or request label Mar 29, 2021
@bednar
Copy link
Contributor

bednar commented Mar 29, 2021

Hi @rojikada,

thanks for suggestion. It is on our radar, but currently we don't have exact time schedule for that. Stay tuned.

Regards

@rhajek rhajek self-assigned this Mar 29, 2021
rhajek added a commit that referenced this issue Apr 1, 2021
rhajek added a commit that referenced this issue Apr 1, 2021
@rhajek rhajek mentioned this issue Apr 1, 2021
6 tasks
rhajek added a commit that referenced this issue Apr 1, 2021
rhajek added a commit that referenced this issue Apr 6, 2021
@bednar bednar added this to the 1.17.0 milestone Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants