Skip to content

Add server-side validation for frontend errors filtering #10104

Merged
aduth merged 4 commits intomainfrom
aduth-validate-frontend-error-params
Feb 21, 2024
Merged

Add server-side validation for frontend errors filtering #10104
aduth merged 4 commits intomainfrom
aduth-validate-frontend-error-params

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Feb 16, 2024

🛠 Summary of changes

Adds server-side validation to match the client-side error filtering performed to limit errors to those thrown within Login.gov scripts.

This is a follow-up to the suggestion at #10087 (comment)

📜 Testing Plan

Repeat Testing Plan from #10087

rspec spec/forms/frontend_error_form_spec.rb spec/services/frontend_error_logger_spec.rb

private

def validate_filename_extension
return if File.extname(filename.to_s) == '.js'
Copy link
Contributor

Choose a reason for hiding this comment

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

do we 100% always get the filename? my guess is we'd want to allow a nil filename too just in case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The spec implies that it must be a string, but that it could (at least by the defaults defined there) be empty. The behavior here matches the behavior on the client-side, which would ignore anything not explicitly .js. Whether we should want to log those, I'd have a mild curiosity what (if anything) would be logged, but generally think we're interested in errors known to be originating from our own scripts.

@aduth aduth merged commit dde6d08 into main Feb 21, 2024
@aduth aduth deleted the aduth-validate-frontend-error-params branch February 21, 2024 15:59
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