This file is indexed.

/usr/lib/python3/dist-packages/gnocchi/tests/functional/gabbits/archive.yaml is in python3-gnocchi 4.2.0-0ubuntu5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
#
# Test the Archive Policy API to achieve coverage of just the
# ArchivePoliciesController.
#

fixtures:
    - ConfigFixture

defaults:
  request_headers:
    # User foobar
    authorization: "basic Zm9vYmFyOg=="
    content-type: application/json

tests:

# Retrieve the empty list when there are no archive policies.
# NOTE(chdent): This demonstrates what used to be considered a
# security bug in JSON output:
# http://flask.pocoo.org/docs/0.10/security/#json-security
# The version described there is supposed to be fixed in most modern
# browsers but there is a new version of the problem which is only
# fixed in some:
# http://haacked.com/archive/2009/06/25/json-hijacking.aspx/
# The caveats point out that this is only an issue if your data is
# sensitive, which in this case...?
# However, the api-wg has made it recommendation that collections
# should be returned as an object with a named key with a value of
# a list as follows: {"archive_policies": [...]}
# This allows for extensibility such as future support for pagination.
# Do we care?

    - name: empty archive policy list
      GET: /v1/archive_policy
      response_headers:
          content-type: /application/json/
      response_strings:
          - "[]"

    - name: empty list text
      GET: /v1/archive_policy
      request_headers:
          accept: text/plain
      status: 406

    - name: empty list html
      GET: /v1/archive_policy
      request_headers:
          accept: text/html
      status: 406

# Fail to create an archive policy for various reasons.

    - name: wrong content type
      POST: /v1/archive_policy
      request_headers:
          content-type: text/plain
          # User admin
          authorization: "basic YWRtaW46"
      status: 415
      response_strings:
          - Unsupported Media Type

    - name: wrong method
      PUT: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      status: 405

    - name: wrong authZ
      POST: /v1/archive_policy
      data:
          name: medium
          definition:
              - granularity: 1 second
      status: 403

    - name: missing authZ
      POST: /v1/archive_policy
      request_headers:
        authorization: ""
      data:
          name: medium
          definition:
              - granularity: 1 second
      status: 401

    - name: bad request body
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          cowsay: moo
      status: 400
      response_strings:
          - "Invalid input: extra keys not allowed"

    - name: missing definition
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: medium
      status: 400
      response_strings:
          - "Invalid input: required key not provided"

    - name: empty definition
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: medium
          definition: []
      status: 400
      response_strings:
          - "Invalid input: length of value must be at least 1"

    - name: wrong value definition
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: somename
          definition: foobar
      status: 400
      response_strings:
          - "Invalid input: expected a list"

    - name: useless definition
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: medium
          definition:
              - cowsay: moo
      status: 400
      response_strings:
          - "Invalid input: extra keys not allowed"

# Create a valid archive policy.

    - name: create archive policy
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: medium
          definition:
              - granularity: 1 second
                points: 20
              - granularity: 2 second
      response_headers:
          location: $SCHEME://$NETLOC/v1/archive_policy/medium
      status: 201

# Retrieve it correctly and then poorly

    - name: get archive policy
      GET: $LOCATION
      response_headers:
          content-type: /application/json/
      response_json_paths:
          $.name: medium
          $.definition[0].granularity: "0:00:01"
          $.definition[0].points: 20
          $.definition[0].timespan: "0:00:20"
          $.definition[1].granularity: "0:00:02"
          $.definition[1].points: null
          $.definition[1].timespan: null

    - name: get wrong accept
      GET: $LAST_URL
      request_headers:
          accept: text/plain
      status: 406

# Update archive policy

    - name: patch archive policy with bad definition
      PATCH: $LAST_URL
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          definition:
              - granularity: 1 second
                points: 50
                timespan: 1 hour
              - granularity: 2 second
      status: 400
      response_strings:
          - timespan ≠ granularity × points

    - name: patch archive policy with missing granularity
      PATCH: $LAST_URL
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          definition:
              - granularity: 1 second
                points: 50
      status: 400
      response_strings:
          - "Archive policy medium does not support change: Cannot add or drop granularities"

    - name: patch archive policy with non-matching granularity
      PATCH: $LAST_URL
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          definition:
              - granularity: 5 second
                points: 20
              - granularity: 2 second
      status: 400
      response_strings:
          - "Archive policy medium does not support change: 1.0 granularity interval was changed"

    - name: patch archive policy
      PATCH: $LAST_URL
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          definition:
              - granularity: 1 second
                points: 50
              - granularity: 2 second
      status: 200
      response_json_paths:
          $.name: medium
          $.definition[0].granularity: "0:00:01"
          $.definition[0].points: 50
          $.definition[0].timespan: "0:00:50"

    - name: get patched archive policy
      GET: $LAST_URL
      response_headers:
          content-type: /application/json/
      response_json_paths:
          $.name: medium
          $.definition[0].granularity: "0:00:01"
          $.definition[0].points: 50
          $.definition[0].timespan: "0:00:50"

# Unexpected methods

    - name: post single archive
      POST: $LAST_URL
      status: 405

    - name: put single archive
      PUT: $LAST_URL
      status: 405

# Create another one and then test duplication

    - name: create second policy
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: large
          definition:
              - granularity: 1 hour
      response_headers:
          location: $SCHEME://$NETLOC/v1/archive_policy/large
      status: 201

    - name: create duplicate policy
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: large
          definition:
              - granularity: 1 hour
      status: 409
      response_strings:
          - Archive policy large already exists

# Create a unicode named policy

    - name: post unicode policy name
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: ✔éñ☃
          definition:
              - granularity: 1 minute
                points: 20
      status: 201
      response_headers:
          location: $SCHEME://$NETLOC/v1/archive_policy/%E2%9C%94%C3%A9%C3%B1%E2%98%83
      response_json_paths:
          name: ✔éñ☃

    - name: retrieve unicode policy name
      GET: $LOCATION
      response_json_paths:
          name: ✔éñ☃

    - name: post small unicode policy name
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: æ
          definition:
              - granularity: 1 minute
                points: 20
      status: 201
      response_headers:
          location: $SCHEME://$NETLOC/v1/archive_policy/%C3%A6
      response_json_paths:
          name: æ

    - name: retrieve small unicode policy name
      GET: $LOCATION
      response_json_paths:
          name: æ

# List the collection

    - name: get archive policy list
      GET: /v1/archive_policy
      response_strings:
          - '"name": "medium"'
          - '"name": "large"'
      response_json_paths:
          $[?name = "large"].definition[?granularity = "1:00:00"].points: null
          $[?name = "medium"].definition[?granularity = "0:00:02"].points: null

# Delete one as non-admin

    - name: delete single archive non admin
      DELETE: /v1/archive_policy/medium
      status: 403

# Delete one

    - name: delete single archive
      DELETE: /v1/archive_policy/medium
      request_headers:
        # User admin
        authorization: "basic YWRtaW46"
      status: 204

# It really is gone

    - name: confirm delete
      GET: $LAST_URL
      status: 404

# Fail to delete one that does not exist

    - name: delete missing archive
      DELETE: /v1/archive_policy/grandiose
      request_headers:
        # User admin
        authorization: "basic YWRtaW46"
      status: 404
      response_strings:
          - Archive policy grandiose does not exist

    - name: delete archive utf8
      DELETE: /v1/archive_policy/%E2%9C%94%C3%A9%C3%B1%E2%98%83
      request_headers:
        # User admin
        authorization: "basic YWRtaW46"
      status: 204

    - name: delete missing archive utf8 again
      DELETE: /v1/archive_policy/%E2%9C%94%C3%A9%C3%B1%E2%98%83
      request_headers:
        # User admin
        authorization: "basic YWRtaW46"
      status: 404
      response_strings:
          - Archive policy ✔éñ☃ does not exist

# Add metric using the policy and then be unable to delete policy

    - name: create metric
      POST: /v1/metric
      data:
          archive_policy_name: large
      status: 201

    - name: delete in use policy
      DELETE: /v1/archive_policy/large
      request_headers:
        # User admin
        authorization: "basic YWRtaW46"
      status: 400
      response_strings:
          - Archive policy large is still in use

# Attempt to create illogical policies

    - name: create illogical policy
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: complex
          definition:
              - granularity: 1 second
                points: 60
                timespan: "0:01:01"
      status: 400
      response_strings:
          - timespan ≠ granularity × points

    - name: create invalid granularity policy
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: complex
          definition:
              - granularity: 0
                points: 60
      status: 400
      response_strings:
          - "Invalid input: Timespan must be positive for dictionary value"

    - name: create invalid points policy
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: complex
          definition:
              - granularity: 10
                points: 0
      status: 400
      response_strings:
          - "Invalid input: value must be at least 1 for dictionary value "

    - name: create identical granularities policy
      POST: /v1/archive_policy
      request_headers:
        # User admin
        authorization: "basic YWRtaW46"
      data:
          name: complex
          definition:
              - granularity: 1 second
                points: 60
              - granularity: 1 second
                points: 120
      status: 400
      response_strings:
          - "More than one archive policy uses granularity `1.0'"

    - name: policy invalid unit
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: 227d0e1f-4295-4e4b-8515-c296c47d71d3
          definition:
              - granularity: 1 second
                timespan: "1 shenanigan"
      status: 400

    - name: policy invalid aggregation method
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: invalid-agg-method
          aggregation_methods:
            - wtf
          definition:
              - granularity: 1 second
                timespan: 1 hour
      status: 400

    - name: create policy when granularity is larger than timespan
      POST: /v1/archive_policy
      request_headers:
        # User admin
        authorization: "basic YWRtaW46"
      data:
          name: should-have-failed
          definition:
              - granularity: 2 hour
                timespan: 1 hour
      status: 400

# Non admin user attempt

    - name: fail to create policy non-admin
      POST: /v1/archive_policy
      data:
          name: f1d150d9-02ad-4fe7-8872-c64b2bcaaa97
          definition:
              - granularity: 1 minute
                points: 20
      status: 403
      response_strings:
          - Access was denied to this resource

# Back windows

    - name: policy with back window
      POST: /v1/archive_policy
      request_headers:
        # User admin
        authorization: "basic YWRtaW46"
      data:
          name: 7720a99d-cd3b-4aa4-8a6f-935bf0d46ded
          back_window: 1
          definition:
              - granularity: 10s
                points: 20
      status: 201
      response_json_paths:
          $.back_window: 1
          $.definition[0].timespan: "0:03:20"

    - name: policy no back window
      desc: and default seconds on int granularity
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: 22f2b99f-e629-4170-adc4-09b65635e056
          back_window: 0
          definition:
              - granularity: 10
                points: 20
      status: 201
      response_json_paths:
          $.back_window: 0
          $.definition[0].points: 20
          $.definition[0].timespan: "0:03:20"

# Timespan, points, granularity input tests

    - name: policy float granularity
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: 595228db-ea29-4415-9d5b-ecb5366abb1b
          definition:
              - timespan: 1 hour
                points: 1000
      status: 201
      response_json_paths:
          $.definition[0].points: 1000
          $.definition[0].granularity: "0:00:03.600000"
          $.definition[0].timespan: "1:00:00"

    - name: policy float timespan
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: 6bc72791-a27e-4417-a589-afc6d2067a38
          definition:
              - timespan: 1 hour
                granularity: 7s
      status: 201
      response_json_paths:
          $.definition[0].points: 514
          $.definition[0].granularity: "0:00:07"
          $.definition[0].timespan: "0:59:58"

    - name: policy rated
      POST: /v1/archive_policy
      request_headers:
          # User admin
          authorization: "basic YWRtaW46"
      data:
          name: 595228db-ea29-4415-9d5b-ecb5366abb1c
          aggregation_methods:
            - rate:mean
            - rate:last
          definition:
              - timespan: 1 hour
                points: 1000
      status: 201
      response_json_paths:
          $.aggregation_methods.`sorted`:
            - rate:last
            - rate:mean
          $.definition[0].points: 1000
          $.definition[0].granularity: "0:00:03.600000"
          $.definition[0].timespan: "1:00:00"