summaryrefslogtreecommitdiffstats
path: root/toolkit/components/cookiebanners/schema/CookieBannerRule.schema.json
blob: 48fc6744670ddfffce95d6344392e3deb3958092 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
{
  "type": "object",
  "definitions": {
    "cookie": {
      "type": "object",
      "required": ["name", "value"],
      "description": "JSON representation of a cookie to inject.",
      "properties": {
        "name": {
          "title": "Name / Key",
          "type": "string",
          "description": "The name of the cookie."
        },
        "value": {
          "title": "Value",
          "type": "string",
          "description": "The cookie value."
        },
        "host": {
          "title": "Host",
          "type": "string",
          "description": "Host to set cookie for. Defaults to .<domain> if unset."
        },
        "path": {
          "title": "Path",
          "type": "string",
          "description": "The path pertaining to the cookie."
        },
        "expiryRelative": {
          "title": "Relative Expiry Time",
          "type": "number",
          "description": "Expiry time of the cookie in seconds relative to the injection time. Defaults to pref value for cookiebanners.cookieInjector.defaultExpiryRelative."
        },
        "unsetValue": {
          "title": "Unset Value",
          "type": "string",
          "description": "If an existing cookie of the same name sets this value it may be overwritten by this rule."
        },
        "isSecure": {
          "title": "Secure Cookie",
          "type": "boolean",
          "description": "true if the cookie was transmitted over ssl, false otherwise."
        },
        "sameSite": {
          "title": "SameSite",
          "type": "number",
          "enum": [0, 1, 2],
          "description": "The SameSite attribute. See nsICookie.idl."
        },
        "isSession": {
          "title": "Session Cookie",
          "type": "boolean",
          "description": "true if the cookie is a session cookie."
        },
        "schemeMap": {
          "title": "Scheme Map",
          "type": "number",
          "description": "Bitmap of schemes."
        },
        "isHTTPOnly": {
          "title": "HTTP-Only",
          "type": "boolean",
          "description": "true if the cookie is an http only cookie."
        }
      }
    }
  },
  "title": "Cookie Banner Rule",
  "required": ["id", "domains"],
  "additionalProperties": false,
  "properties": {
    "id": {
      "title": "ID",
      "type": "string",
      "description": "Unique identifier of the rule."
    },
    "domains": {
      "title": "Domains",
      "type": ["array"],
      "items": {
        "type": "string"
      },
      "uniqueItems": true,
      "description": "List of domains of the sites the rule describes. Leave empty for global rules which should apply to every site."
    },
    "cookies": {
      "title": "Cookies",
      "description": "Cookie banner related cookies to be injected when the side loads.",
      "type": "object",
      "properties": {
        "optIn": {
          "title": "Opt-in cookies",
          "type": "array",
          "items": {
            "$ref": "#/definitions/cookie"
          },
          "description": "Cookies to be set to signal opt-in state."
        },
        "optOut": {
          "title": "Opt-out cookies",
          "type": "array",
          "items": {
            "$ref": "#/definitions/cookie"
          },
          "description": "Cookies to be set to signal opt-out state."
        }
      }
    },
    "click": {
      "title": "Click",
      "description": "Rules for detection of the cookie banner and simulated clicks.",
      "type": "object",
      "properties": {
        "presence": {
          "title": "Presence Selector",
          "type": "string",
          "description": "Query selector to detect cookie banner element."
        },
        "skipPresenceVisibilityCheck": {
          "title": "Skip Presence Visibility Check",
          "type": "boolean",
          "description": "Whether to skip checking if the banner is visible before clicking it."
        },
        "runContext": {
          "title": "Run Context",
          "type": "string",
          "enum": ["top", "child", "all"],
          "description": "Where the click rule should be executed. Defaults to only top window. top: Only in the top window; child: Only in child frames; all: Both top window and child frames."
        },
        "hide": {
          "title": "Hide Selector",
          "type": "string",
          "description": "Query selector for element to hide while handling cookie banner. Defaults to 'presence' selector."
        },
        "optOut": {
          "title": "Opt-out Selector",
          "type": "string",
          "description": "Query selector for opt-out / reject all button"
        },
        "optIn": {
          "title": "Opt-in Selector",
          "type": "string",
          "description": "Query selector for opt-in / accept all button"
        }
      },
      "dependencies": {
        "hide": ["presence"],
        "optOut": ["presence"],
        "optIn": ["presence"]
      }
    },
    "filter_expression": {
      "type": "string",
      "description": "This is NOT used by the cookie banner handling feature, but has special functionality in Remote Settings. See https://remote-settings.readthedocs.io/en/latest/target-filters.html#how"
    }
  },
  "description": "Rule containing instructions on how to handle a cookie banner on a specific site."
}