elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.48k stars 8.04k forks source link

Enhance the existing CSP violation reporting pipeline to include more fields and support other policy violation reports #175113

Open azasypkin opened 5 months ago

azasypkin commented 5 months ago

Summary

In the scope of https://github.com/elastic/kibana/issues/162974 and https://github.com/elastic/kibana/issues/153584, we successfully adapted the event-based telemetry (EBT) framework for the collection of CSP violation reports. Now that we know it works well for this use case, we can consider moving further and enhancing this reporting pipeline to cover other types of policy violation reports (e.g., Permission Policy violation reports). Additionally, we need to add more fields to the violation reports to make monitoring and investigation more efficient, so that the final document/report might look like this:

{
  // Common fields
  "type": "csp-violation" | "permissions-policy-violation",
  "timestamp": number,
  "url": string,
  "user_agent": string,
  "disposition": "enforce" | "report",
  "sourceFile": string,
  "lineNumber": number,
  "columnNumber": number,
  "version/kibanaVersion/service.version": string (but `version` data type), 
  "orgId"?: string, <-- NEW (if possible)
  "deploymentId"?: string,
  "serverless.projectId"?: string,
  "hasCustomPlugins": boolean, <-- NEW (if possible, TBD)

  // CSP violation-specific fields
  "blockedURL": string,
  "referrer": string,
  "documentURL": string,
  "effectiveDirective": string,
  "originalPolicy": string,
  "statusCode": number,

  // Permission policy violation-specific fields
  "featureId": string, 
}

In addition to new fields, we also need to add the ingest pipeline with the following processors to make data more filterable/searchable:

Tasks

elasticmachine commented 5 months ago

Pinging @elastic/kibana-security (Team:Security)