Skip to content

Commit 361c16d

Browse files
jklukasartines1
andauthored
Add xfocsp-error-report schema (#581)
* Bug 1647825 - Add a schema for the new ping 'xfocsp-error=report'. * Bug 1654558 Add xfocsp-error-report schema Closes #570 This pulls in the commit from that PR and duplicates it in a new namespace. We will be rerouting these pings in the pipeline so that they can have stricter access controls. There is a test case added here so that CI will fail if these two schemas get out of sync. Co-authored-by: Tim Huang <tihuang@mozilla.com>
1 parent 8b05ee6 commit 361c16d

File tree

6 files changed

+266
-0
lines changed

6 files changed

+266
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"description": "Schema for xfocsp-error-report pings as documented at https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/telemetry/data/xfocsp-error-report-ping.html",
4+
"properties": {
5+
"payload": {
6+
"maxProperties": 7,
7+
"minProperties": 7,
8+
"properties": {
9+
"csp_header": {
10+
"description": "The CSP: frame-ancestors value in the response HTTP header.",
11+
"type": "string"
12+
},
13+
"error_type": {
14+
"description": "The type of what error triggers this ping.",
15+
"enum": [
16+
"xfo",
17+
"csp"
18+
],
19+
"type": "string"
20+
},
21+
"frame_hostname": {
22+
"description": "The hostname of the frame which triggers the error.",
23+
"type": "string"
24+
},
25+
"frame_uri": {
26+
"description": "The uri of the frame which triggers the error. This excludes the query strings.",
27+
"type": "string"
28+
},
29+
"top_hostname": {
30+
"description": "The hostname of the top-level page which loads the frame.",
31+
"type": "string"
32+
},
33+
"top_uri": {
34+
"description": "The uri of the top-level page which loads the frame. This excludes the query strings.",
35+
"type": "string"
36+
},
37+
"xfo_header": {
38+
"description": "The X-Frame-Options value in the response HTTP header.",
39+
"type": "string"
40+
}
41+
},
42+
"required": [
43+
"error_type",
44+
"xfo_header",
45+
"csp_header",
46+
"frame_hostname",
47+
"top_hostname",
48+
"frame_uri",
49+
"top_uri"
50+
],
51+
"type": "object"
52+
}
53+
},
54+
"required": [
55+
"payload"
56+
],
57+
"title": "xfocsp-error-report",
58+
"type": "object"
59+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"description": "Schema for xfocsp-error-report pings as documented at https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/telemetry/data/xfocsp-error-report-ping.html",
4+
"properties": {
5+
"payload": {
6+
"maxProperties": 7,
7+
"minProperties": 7,
8+
"properties": {
9+
"csp_header": {
10+
"description": "The CSP: frame-ancestors value in the response HTTP header.",
11+
"type": "string"
12+
},
13+
"error_type": {
14+
"description": "The type of what error triggers this ping.",
15+
"enum": [
16+
"xfo",
17+
"csp"
18+
],
19+
"type": "string"
20+
},
21+
"frame_hostname": {
22+
"description": "The hostname of the frame which triggers the error.",
23+
"type": "string"
24+
},
25+
"frame_uri": {
26+
"description": "The uri of the frame which triggers the error. This excludes the query strings.",
27+
"type": "string"
28+
},
29+
"top_hostname": {
30+
"description": "The hostname of the top-level page which loads the frame.",
31+
"type": "string"
32+
},
33+
"top_uri": {
34+
"description": "The uri of the top-level page which loads the frame. This excludes the query strings.",
35+
"type": "string"
36+
},
37+
"xfo_header": {
38+
"description": "The X-Frame-Options value in the response HTTP header.",
39+
"type": "string"
40+
}
41+
},
42+
"required": [
43+
"error_type",
44+
"xfo_header",
45+
"csp_header",
46+
"frame_hostname",
47+
"top_hostname",
48+
"frame_uri",
49+
"top_uri"
50+
],
51+
"type": "object"
52+
}
53+
},
54+
"required": [
55+
"payload"
56+
],
57+
"title": "xfocsp-error-report",
58+
"type": "object"
59+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"type": "object",
4+
"title": "xfocsp-error-report",
5+
"description": "Schema for xfocsp-error-report pings as documented at https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/telemetry/data/xfocsp-error-report-ping.html",
6+
"properties": {
7+
"payload": {
8+
"type": "object",
9+
"minProperties": 7,
10+
"maxProperties": 7,
11+
"properties": {
12+
"error_type": {
13+
"description": "The type of what error triggers this ping.",
14+
"type": "string",
15+
"enum": ["xfo", "csp"]
16+
},
17+
"xfo_header": {
18+
"description": "The X-Frame-Options value in the response HTTP header.",
19+
"type": "string"
20+
},
21+
"csp_header": {
22+
"description": "The CSP: frame-ancestors value in the response HTTP header.",
23+
"type": "string"
24+
},
25+
"frame_hostname": {
26+
"description": "The hostname of the frame which triggers the error.",
27+
"type": "string"
28+
},
29+
"top_hostname": {
30+
"description": "The hostname of the top-level page which loads the frame.",
31+
"type": "string"
32+
},
33+
"frame_uri": {
34+
"description": "The uri of the frame which triggers the error. This excludes the query strings.",
35+
"type": "string"
36+
},
37+
"top_uri": {
38+
"description": "The uri of the top-level page which loads the frame. This excludes the query strings.",
39+
"type": "string"
40+
}
41+
},
42+
"required": [
43+
"error_type",
44+
"xfo_header",
45+
"csp_header",
46+
"frame_hostname",
47+
"top_hostname",
48+
"frame_uri",
49+
"top_uri"
50+
]
51+
}
52+
},
53+
"required": [
54+
"payload"
55+
]
56+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"type": "object",
4+
"title": "xfocsp-error-report",
5+
"description": "Schema for xfocsp-error-report pings as documented at https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/telemetry/data/xfocsp-error-report-ping.html",
6+
"properties": {
7+
"payload": {
8+
"type": "object",
9+
"minProperties": 7,
10+
"maxProperties": 7,
11+
"properties": {
12+
"error_type": {
13+
"description": "The type of what error triggers this ping.",
14+
"type": "string",
15+
"enum": ["xfo", "csp"]
16+
},
17+
"xfo_header": {
18+
"description": "The X-Frame-Options value in the response HTTP header.",
19+
"type": "string"
20+
},
21+
"csp_header": {
22+
"description": "The CSP: frame-ancestors value in the response HTTP header.",
23+
"type": "string"
24+
},
25+
"frame_hostname": {
26+
"description": "The hostname of the frame which triggers the error.",
27+
"type": "string"
28+
},
29+
"top_hostname": {
30+
"description": "The hostname of the top-level page which loads the frame.",
31+
"type": "string"
32+
},
33+
"frame_uri": {
34+
"description": "The uri of the frame which triggers the error. This excludes the query strings.",
35+
"type": "string"
36+
},
37+
"top_uri": {
38+
"description": "The uri of the top-level page which loads the frame. This excludes the query strings.",
39+
"type": "string"
40+
}
41+
},
42+
"required": [
43+
"error_type",
44+
"xfo_header",
45+
"csp_header",
46+
"frame_hostname",
47+
"top_hostname",
48+
"frame_uri",
49+
"top_uri"
50+
]
51+
}
52+
},
53+
"required": [
54+
"payload"
55+
]
56+
}

tests/test_duplicate_schemas.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def test_validation_pass_python(schemas):
2+
# Ensure the xfocsp-error-report is consistent between namespaces;
3+
# it is sent under the telemetry namespace, but the pipeline reroutes it
4+
# to a separate namespace so that we can restrict access in BigQuery.
5+
# Any changes to the schema must be reflected in both namespaces.
6+
# See https://bugzilla.mozilla.org/show_bug.cgi?id=1651005
7+
assert (
8+
schemas["telemetry.xfocsp-error-report.4"]
9+
== schemas["telemetry.xfocsp-error-report.4"]
10+
)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"type": "xfocsp-error-report",
3+
"id": "0cb9115c-471b-164b-9630-9fb75567eca8",
4+
"creationDate": "2020-07-10T11:42:30.579Z",
5+
"version": 4,
6+
"application": {
7+
"architecture": "x86-64",
8+
"buildId": "20200710134107",
9+
"name": "Firefox",
10+
"version": "80.0a1",
11+
"displayVersion": "80.0a1",
12+
"vendor": "Mozilla",
13+
"platformVersion": "80.0a1",
14+
"xpcomAbi": "x86_64-gcc3",
15+
"channel": "default"
16+
},
17+
"payload": {
18+
"error_type": "xfo",
19+
"xfo_header": "deny",
20+
"csp_header": "",
21+
"frame_hostname": "example.com",
22+
"top_hostname": "example.com",
23+
"frame_uri": "http://example.com/browser/dom/security/test/general/file_framing_error_pages.sjs",
24+
"top_uri": "http//example.com/browser/dom/security/test/general/file_framing_error_pages_xfo.html"
25+
}
26+
}

0 commit comments

Comments
 (0)