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

chore(csp): Filter out unsupported report types #3295

Merged
merged 4 commits into from
Mar 21, 2024

Conversation

olksdr
Copy link
Contributor

@olksdr olksdr commented Mar 21, 2024

In case if the default report group defined and used for CSP reports (with Reporting Api), browser also will use that group for sending deprecation reports, which we do not support and should filter them out.

followup for #3293 #3277

#skip-changelog

@olksdr olksdr self-assigned this Mar 21, 2024
@olksdr olksdr requested a review from a team as a code owner March 21, 2024 06:01
@@ -72,6 +74,21 @@ impl SecurityReportParams {
}
}

/// Check if the report type is supported.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// Check if the report type is supported.
/// Checks if the report type is supported.

@@ -72,6 +74,21 @@ impl SecurityReportParams {
}
}

/// Check if the report type is supported.
///
/// Note: use only for the reports sent through the Reporting Api.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// Note: use only for the reports sent through the Reporting Api.
/// Note: use only for the reports sent through the Reporting API.

Self::create_security_item(&query, Bytes::from(item.to_owned().to_string()));
envelope.add_item(report_item);
let data = Bytes::from(item.to_owned().to_string());
if is_supported_type(&data) {
Copy link
Member

Choose a reason for hiding this comment

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

Instead of parsing the data here, couldn't we filter out the unsupported type in the envelope processor (after or during the parsing step)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I first thought to do it in processor, but then , I've got an idea to discard those items as earlier as possible and later we won't do extra work. But yeah, I will move this back to processor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in a0e3a4a

@olksdr olksdr requested review from jjbayer and a team March 21, 2024 09:04
@olksdr olksdr enabled auto-merge (squash) March 21, 2024 10:20
@olksdr olksdr merged commit ceab913 into master Mar 21, 2024
20 checks passed
@olksdr olksdr deleted the chore/introduce-unsupported-csp-reports branch March 21, 2024 10:30
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