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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pay-api/src/pay_api/resources/v1/fas/routing_slip.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Resource for Account payments endpoints."""
import re
from http import HTTPStatus

from flask import Blueprint, Response, current_app, jsonify, request
Expand Down Expand Up @@ -86,6 +87,10 @@ def post_routing_slip_report(date: str):
"""Create routing slip report."""
current_app.logger.info("<post_routing_slip_report")

# Validate the date parameter to ensure it matches the expected format (YYYY-MM-DD)
if not re.match(r"^\d{4}-\d{2}-\d{2}$", date):
return error_to_response(Error.INVALID_REQUEST, invalid_params=["date"])

pdf, file_name = RoutingSlipService.create_daily_reports(date)

response = Response(pdf, 201)
Expand Down
10 changes: 5 additions & 5 deletions pay-api/src/pay_api/utils/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,11 @@ class EFTShortnameStatus(Enum):
class EFTShortnameRefundStatus(Enum):
"""EFT Short name refund statuses."""

APPROVED = 'APPROVED'
PENDING_APPROVAL = 'PENDING_APPROVAL'
DECLINED = 'DECLINED'
COMPLETED = 'COMPLETED'
ERRORED = 'ERRORED'
APPROVED = "APPROVED"
PENDING_APPROVAL = "PENDING_APPROVAL"
DECLINED = "DECLINED"
COMPLETED = "COMPLETED"
ERRORED = "ERRORED"


class EFTPaymentActions(Enum):
Expand Down
Loading