type.inbound
and any(body.links,
// Look for buildingengines URLs
.href_url.domain.domain == "app.buildingengines.com"
and strings.icontains(.href_url.query_params, '_redirectTo=')
// Make sure it's not redirecting back to buildingengines.com
and not regex.icontains(.href_url.query_params,
'_redirectTo=(?:https?(?:%3a|:))?(?:%2f|\/){2}[^&]*buildingengines\.com(?:\&|\/|$|%2f)'
)
)
// Exclude legitimate Building Engines domains as senders
and not sender.email.domain.root_domain == "buildingengines.com"
// negate highly trusted sender domains unless they fail DMARC authentication
and not (
sender.email.domain.root_domain in $high_trust_sender_root_domains
and coalesce(headers.auth_summary.dmarc.pass, false)
)
Playground
Test against your own EMLs or sample data.