Skip to content

Expand CSP filtering options #2037

Closed

Description

@rodolfoBee

Our CSP filter works on blocked_uri and source_file:

pub fn matches<It, S>(event: &Event, disallowed_sources: It) -> bool
where
It: IntoIterator<Item = S>,
S: AsRef<str>,
{
if event.ty.value() != Some(&EventType::Csp) {
return false;
}
// parse the sources for easy processing
let disallowed_sources: Vec<SchemeDomainPort> = disallowed_sources
.into_iter()
.map(|origin| -> SchemeDomainPort { origin.as_ref().into() })
.collect();
if let Some(csp) = event.csp.value() {
if matches_any_origin(csp.blocked_uri.as_str(), &disallowed_sources) {
return true;
}
if matches_any_origin(csp.source_file.as_str(), &disallowed_sources) {
return true;
}
}
false
}

A customer has requested to add document_uri to filter, which can improve the CSP filters UX. One option is to allow users to choose which CSP fields they want to use with the filters.

Originally requested in: https://getsentry.atlassian.net/browse/FEEDBACK-1070

Activity

  1. added
    enhancement
    on Apr 17, 2023
  2. jjbayer commented on Apr 19, 2023

    @jjbayer
    Member

    Makes sense to me, will add it to our backlog.

  3. self-assigned this
    on Apr 24, 2023
  4. linked a pull request that will close this issuefeat(filter): Add document_uri csp filter #2059on Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions