Skip to main content

relay_event_schema/protocol/
integrity.rs

1//! Contains definitions for the browser Integrity policy interface.
2
3use relay_protocol::{Annotated, Empty, FromValue, IntoValue, Object, Value};
4
5/// Generated Integrity policy.
6/// Can't name as "BodyRaw", like in nel.rs, due to name conflicts
7#[derive(Debug, Default, Clone, PartialEq, FromValue, IntoValue, Empty)]
8pub struct IntegrityBodyRaw {
9    #[metastructure(field = "documentURL")]
10    pub document_url: Annotated<String>,
11    #[metastructure(field = "blockedURL")]
12    pub blocked_url: Annotated<String>,
13    pub destination: Annotated<String>,
14    #[metastructure(field = "reportOnly")]
15    pub report_only: Annotated<bool>,
16    #[metastructure(additional_properties, pii = "maybe")]
17    pub other: Object<Value>,
18}
19
20/// Models the content of a Integrity report.
21#[derive(Debug, Default, Clone, PartialEq, FromValue, IntoValue, Empty)]
22pub struct IntegrityReportRaw {
23    /// The age of the report since it got collected and before it got sent.
24    pub age: Annotated<i64>,
25    /// The type of the report.
26    #[metastructure(field = "type")]
27    pub ty: Annotated<String>,
28    /// The URL of the document in which the error occurred.
29    #[metastructure(pii = "true")]
30    pub url: Annotated<String>,
31    /// The User-Agent HTTP header.
32    pub user_agent: Annotated<String>,
33    /// The body of the Integrity report.
34    pub body: Annotated<IntegrityBodyRaw>,
35    /// For forward compatibility.
36    #[metastructure(additional_properties, pii = "maybe")]
37    pub other: Object<Value>,
38}