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

sanitize title and provider input string #1504

Merged
merged 2 commits into from
Sep 30, 2024

Conversation

akihikokuroda
Copy link
Collaborator

Summary

This PR adding the code that sanitizes the title and provider input string

Details and comments

Copy link
Collaborator

@psschwei psschwei left a comment

Choose a reason for hiding this comment

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

If we don't already, should we also sanitize inputs in the client?
(if yes, then let's do in a follow-up PR)

Copy link
Member

@Tansito Tansito left a comment

Choose a reason for hiding this comment

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

@akihikokuroda is it possible to check for limit and offset values in jobs-list too?

https://github.com/Qiskit/qiskit-serverless/blob/main/gateway/api/views.py#L479

@akihikokuroda
Copy link
Collaborator Author

@Tansito I'm not sure if the PageNumberPagination handles by itself. Does DAST detect issue about it? If so, we can deal with it in a separate PR.

@Tansito Tansito self-requested a review September 30, 2024 13:11
@akihikokuroda
Copy link
Collaborator Author

@psschwei No, we don't. The query strings are almost passthrough to the gateway.

if name:
sanitized_name = ""
for c in name:
if c.isalnum() or c in ["_", "-", ":", "@", "/"]:
Copy link
Member

Choose a reason for hiding this comment

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

If this PR is only for title and provider we should only accept: ["_", "-"], WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe "/" in case we can receive: "provider/title" string, but I think we are not checking this here, right Aki?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is checking the "/" here. So we can accept "-", "_" and "/".

@Tansito Tansito self-requested a review September 30, 2024 14:06
@Tansito
Copy link
Member

Tansito commented Sep 30, 2024

Let's try it! Thanks Aki 🎉

@akihikokuroda akihikokuroda merged commit eed51de into Qiskit:main Sep 30, 2024
10 checks passed
@akihikokuroda akihikokuroda deleted the sanitize branch September 30, 2024 14:11
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.

3 participants