forked from gtm-templates-simo-ahava/preflight-request
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.tpl
383 lines (347 loc) · 28.5 KB
/
template.tpl
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
___TERMS_OF_SERVICE___
By creating or modifying this file you agree to Google Tag Manager's Community
Template Gallery Developer Terms of Service available at
https://developers.google.com/tag-manager/gallery-tos (or such other URL as
Google may provide), as modified from time to time.
___INFO___
{
"type": "CLIENT",
"id": "cvt_temp_public_id",
"version": 1,
"securityGroups": [],
"__wm": "VGVtcGxhdGUtQXV0aG9yX1ByZWZsaWdodC1SZXF1ZXN0LVNpbW8tQWhhdmE\u003d",
"categories": [
"UTILITY"
],
"displayName": "Preflight Request",
"brand": {
"id": "brand_dummy",
"displayName": "",
"thumbnail": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVoAAAFgCAIAAAB10ibqAAAAAXNSR0IArs4c6QAAAGxlWElmTU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAIdpAAQAAAABAAAATgAAAAAAAACQAAAAAQAAAJAAAAABAAKgAgAEAAAAAQAAAVqgAwAEAAAAAQAAAWAAAAAA7Mmn0gAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAAgppVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOnRpZmY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vdGlmZi8xLjAvIj4KICAgICAgICAgPGV4aWY6UGl4ZWxYRGltZW5zaW9uPjM0NjwvZXhpZjpQaXhlbFhEaW1lbnNpb24+CiAgICAgICAgIDxleGlmOlBpeGVsWURpbWVuc2lvbj4zNTI8L2V4aWY6UGl4ZWxZRGltZW5zaW9uPgogICAgICAgICA8dGlmZjpSZXNvbHV0aW9uVW5pdD4yPC90aWZmOlJlc29sdXRpb25Vbml0PgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG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Ff0Ufb77AAAAAElFTkSuQmCC"
},
"description": "Use this Client to respond to preflight (OPTIONS) requests with the appropriate Access-Control-* headers. Must be published - will not work in Debug mode.",
"containerContexts": [
"SERVER"
]
}
___TEMPLATE_PARAMETERS___
[
{
"type": "TEXT",
"name": "approvedOrigin",
"displayName": "Allowed request origin",
"simpleValueType": true,
"valueValidators": [
{
"type": "NON_EMPTY"
},
{
"type": "REGEX",
"args": [
"^(http(s)?://[^/]+|auto)$"
]
}
],
"help": "Enter the origin from where you want to approve requests.Set the value to \u003cstrong\u003eauto\u003c/strong\u003e in case you want to (attempt to) approve the request from any origin.",
"defaultValue": "https://www.my.origin",
"alwaysInSummary": true
},
{
"type": "TEXT",
"name": "approvedMethods",
"displayName": "Allowed request methods",
"simpleValueType": true,
"help": "Enter a comma-separated list of methods to approve the preflight request for, or set to * to approve all methods.",
"defaultValue": "GET,POST",
"valueValidators": [
{
"type": "NON_EMPTY"
}
],
"alwaysInSummary": true
},
{
"type": "TEXT",
"name": "approvedHeaders",
"displayName": "Allowed request headers",
"simpleValueType": true,
"defaultValue": "content-type",
"help": "Enter a comma-separated list of request headers to approve the preflight request for.",
"valueValidators": [
{
"type": "NON_EMPTY"
},
{
"type": "REGEX",
"args": [
"^[^*]+$"
],
"errorMessage": "Asterisk (*) is not a valid value here. You must list the headers your request includes."
}
],
"alwaysInSummary": true
}
]
___SANDBOXED_JS_FOR_SERVER___
const claimRequest = require('claimRequest');
const getRequestHeader = require('getRequestHeader');
const getRequestMethod = require('getRequestMethod');
const returnResponse = require('returnResponse');
const setResponseHeader = require('setResponseHeader');
const setResponseStatus = require('setResponseStatus');
// If not a preflight request, return
if (getRequestMethod() !== 'OPTIONS') return;
claimRequest();
// If origins is wildcarded, set the header to the request's origin
if (data.approvedOrigin === 'auto') {
setResponseHeader('Access-Control-Allow-Origin', getRequestHeader('origin'));
} else {
// Otherwise add an access header for each listed origin
setResponseHeader('Access-Control-Allow-Origin', data.approvedOrigin);
}
setResponseHeader('Access-Control-Allow-Methods', data.approvedMethods);
setResponseHeader('Access-Control-Allow-Headers', data.approvedHeaders);
// The XHR needs .withCredentials set to true for the request to show up in Debug mode
setResponseHeader('Access-Control-Allow-Credentials', 'true');
setResponseStatus(200);
returnResponse();
___SERVER_PERMISSIONS___
[
{
"instance": {
"key": {
"publicId": "read_request",
"versionId": "1"
},
"param": [
{
"key": "headerWhitelist",
"value": {
"type": 2,
"listItem": [
{
"type": 3,
"mapKey": [
{
"type": 1,
"string": "headerName"
}
],
"mapValue": [
{
"type": 1,
"string": "origin"
}
]
},
{
"type": 3,
"mapKey": [
{
"type": 1,
"string": "headerName"
}
],
"mapValue": [
{
"type": 1,
"string": "method"
}
]
}
]
}
},
{
"key": "headersAllowed",
"value": {
"type": 8,
"boolean": true
}
},
{
"key": "requestAccess",
"value": {
"type": 1,
"string": "specific"
}
},
{
"key": "headerAccess",
"value": {
"type": 1,
"string": "specific"
}
},
{
"key": "queryParameterAccess",
"value": {
"type": 1,
"string": "any"
}
}
]
},
"clientAnnotations": {
"isEditedByUser": true
},
"isRequired": true
},
{
"instance": {
"key": {
"publicId": "access_response",
"versionId": "1"
},
"param": [
{
"key": "writeResponseAccess",
"value": {
"type": 1,
"string": "specific"
}
},
{
"key": "writeHeaderAccess",
"value": {
"type": 1,
"string": "specific"
}
},
{
"key": "writeStatusAllowed",
"value": {
"type": 8,
"boolean": true
}
},
{
"key": "writeHeadersAllowed",
"value": {
"type": 8,
"boolean": true
}
},
{
"key": "writeHeaderWhitelist",
"value": {
"type": 2,
"listItem": [
{
"type": 3,
"mapKey": [
{
"type": 1,
"string": "headerName"
}
],
"mapValue": [
{
"type": 1,
"string": "access-control-allow-origin"
}
]
},
{
"type": 3,
"mapKey": [
{
"type": 1,
"string": "headerName"
}
],
"mapValue": [
{
"type": 1,
"string": "access-control-allow-methods"
}
]
},
{
"type": 3,
"mapKey": [
{
"type": 1,
"string": "headerName"
}
],
"mapValue": [
{
"type": 1,
"string": "access-control-allow-headers"
}
]
},
{
"type": 3,
"mapKey": [
{
"type": 1,
"string": "headerName"
}
],
"mapValue": [
{
"type": 1,
"string": "access-control-allow-credentials"
}
]
}
]
}
}
]
},
"clientAnnotations": {
"isEditedByUser": true
},
"isRequired": true
},
{
"instance": {
"key": {
"publicId": "return_response",
"versionId": "1"
},
"param": []
},
"isRequired": true
}
]
___TESTS___
scenarios:
- name: Do not run if request is not OPTIONS
code: |
mock('getRequestMethod', () => 'POST');
// Call runCode to run the template's code.
runCode(mockData);
assertApi('claimRequest').wasNotCalled();
- name: Returns successful response with basic settings
code: |
// Call runCode to run the template's code.
runCode(mockData);
assertApi('claimRequest').wasCalled();
assertApi('setResponseHeader').wasCalledWith('Access-Control-Allow-Origin', 'https://www.domain.com');
assertApi('setResponseHeader').wasCalledWith('Access-Control-Allow-Methods', 'GET,POST');
assertApi('setResponseHeader').wasCalledWith('Access-Control-Allow-Headers', 'content-type');
assertApi('setResponseHeader').wasCalledWith('Access-Control-Allow-Credentials', 'true');
assertApi('setResponseStatus').wasCalledWith(200);
assertApi('returnResponse').wasCalled();
- name: Return successful response with * origin
code: |-
mock('getRequestHeader', h => {
if (h === 'origin') return 'https://www.otherdomain.com';
});
mockData.approvedOrigin = 'auto';
// Call runCode to run the template's code.
runCode(mockData);
assertApi('setResponseHeader').wasCalledWith('Access-Control-Allow-Origin', 'https://www.otherdomain.com');
setup: |-
const mockData = {
approvedOrigin: 'https://www.domain.com',
approvedMethods: 'GET,POST',
approvedHeaders: 'content-type'
};
mock('getRequestMethod', () => 'OPTIONS');
___NOTES___
Created on 02/09/2020, 14:42:43