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

Fix code scanning alert no. 5: Reflected server-side cross-site scripting #1774

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

seeker25
Copy link
Collaborator

@seeker25 seeker25 commented Oct 9, 2024

Fixes https://github.com/bcgov/sbc-pay/security/code-scanning/5

To fix the problem, we need to ensure that the date parameter is properly sanitized before it is used to generate the pdf content. This can be done by validating the date parameter to ensure it conforms to an expected format (e.g., YYYY-MM-DD) before passing it to the RoutingSlipService.create_daily_reports method.

  1. Import the re module for regular expression matching.
  2. Add a validation step for the date parameter to ensure it matches the expected date format.
  3. If the date parameter is invalid, return an appropriate error response.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…ting

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@seeker25 seeker25 marked this pull request as ready for review October 9, 2024 17:14
@seeker25 seeker25 merged commit 04ff8d9 into main Oct 9, 2024
6 checks passed
@seeker25 seeker25 deleted the alert-autofix-5 branch October 24, 2024 19:43
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.

2 participants