Skip to content

Conversation

@DJensen94
Copy link
Contributor

limit date range for vulnScanningsync

🗣 Description

Update the recently added date pickers on the VS scan to ensure a user cannot pick more days of data than the MAX_SCAN_DAYS parameter then the frontend will reject the input and the backend will result in a 400 error.

This PR also simplifies the date pickers so it does not include future dates and defaults to the default date selection.

💭 Motivation and context

This change is to ensure the users do not select more data than the scan can handle. It also simplifies users data selection, simplifying the choices to ensure they don't pick dates in the future that don't make sense for the scan type.

🧪 Testing

Tested locally

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All future TODOs are captured in issues, which are referenced in code comments.
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All relevant repo and/or project documentation has been updated to reflect the changes in this PR.
  • Tests have been added and/or modified to cover the changes in this PR.
  • All new and existing tests pass.

fix type on variable import
Copy link
Collaborator

@cduhn17 cduhn17 left a comment

Choose a reason for hiding this comment

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

See comments

)

# NEW: MAX_SCAN_DAYS-day validation
date_diff = parsed_end - parsed_start
Copy link
Collaborator

Choose a reason for hiding this comment

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

Logging: On both attempts and successes, log user id, request id, scan id, and any rejected fields as structured JSON. This will help now and in future Opentelemetry efforts so we have metrics to get

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in the following commit: f52b1f2

Add detailed logging to date validation
Copy link
Collaborator

@rapidray12 rapidray12 left a comment

Choose a reason for hiding this comment

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

Sanity checking of the date. Perfect.

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