aws.rest-resource

Filters

rest-integration

Filter rest resources based on a key value for the rest method integration of the api

example

policies:
  - name: api-method-integrations-with-type-aws
    resource: rest-resource
    filters:
      - type: rest-integration
        key: type
        value: AWS
properties:
  default:
    type: object
  key:
    type: string
  method:
    enum:
    - all
    - ANY
    - PUT
    - GET
    - POST
    - DELETE
    - OPTIONS
    - HEAD
    - PATCH
    type: string
  op:
    enum:
    - eq
    - equal
    - ne
    - not-equal
    - gt
    - greater-than
    - ge
    - gte
    - le
    - lte
    - lt
    - less-than
    - glob
    - regex
    - regex-case
    - in
    - ni
    - not-in
    - contains
    - difference
    - intersect
  type:
    enum:
    - rest-integration
  value:
    oneOf:
    - type: array
    - type: string
    - type: boolean
    - type: number
    - type: 'null'
  value_from:
    additionalProperties: 'False'
    properties:
      expr:
        oneOf:
        - type: integer
        - type: string
      format:
        enum:
        - csv
        - json
        - txt
        - csv2dict
      url:
        type: string
    required:
    - url
    type: object
  value_regex:
    type: string
  value_type:
    enum:
    - age
    - integer
    - expiration
    - normalize
    - size
    - cidr
    - cidr_size
    - swap
    - resource_count
    - expr
    - unique_size
    - date
required:
- type

rest-method

Filter rest resources based on a key value for the rest method of the api

example

policies:
  - name: api-without-key-required
    resource: rest-resource
    filters:
      - type: rest-method
        key: apiKeyRequired
        value: false
properties:
  default:
    type: object
  key:
    type: string
  method:
    enum:
    - all
    - ANY
    - PUT
    - GET
    - POST
    - DELETE
    - OPTIONS
    - HEAD
    - PATCH
    type: string
  op:
    enum:
    - eq
    - equal
    - ne
    - not-equal
    - gt
    - greater-than
    - ge
    - gte
    - le
    - lte
    - lt
    - less-than
    - glob
    - regex
    - regex-case
    - in
    - ni
    - not-in
    - contains
    - difference
    - intersect
  type:
    enum:
    - rest-method
  value:
    oneOf:
    - type: array
    - type: string
    - type: boolean
    - type: number
    - type: 'null'
  value_from:
    additionalProperties: 'False'
    properties:
      expr:
        oneOf:
        - type: integer
        - type: string
      format:
        enum:
        - csv
        - json
        - txt
        - csv2dict
      url:
        type: string
    required:
    - url
    type: object
  value_regex:
    type: string
  value_type:
    enum:
    - age
    - integer
    - expiration
    - normalize
    - size
    - cidr
    - cidr_size
    - swap
    - resource_count
    - expr
    - unique_size
    - date
required:
- type

Actions

delete-integration

Delete an api integration. Useful if the integration type is a security risk.

example

policies:
  - name: enforce-no-resource-integration-with-type-aws
    resource: rest-resource
    filters:
      - type: rest-integration
        key: type
        value: AWS
    actions:
      - type: delete-integration
properties:
  type:
    enum:
    - delete-integration
required:
- type

update-integration

Change or remove api integration properties based on key value

example

policies:
  - name: enforce-timeout-on-api-integration
    resource: rest-resource
    filters:
      - type: rest-integration
        key: timeoutInMillis
        value: 29000
    actions:
      - type: update-integration
        patch:
          - op: replace
            path: /timeoutInMillis
            value: "3000"
properties:
  patch:
    items:
      additonalProperties: false
      properties:
        from:
          type: string
        op:
          enum:
          - add
          - remove
          - update
          - copy
          - replace
          - test
        path:
          type: string
        value:
          type: string
      required:
      - op
      - path
      type: object
    type: array
  type:
    enum:
    - update-integration
required:
- patch
- type

update-method

Change or remove api method behaviors based on key value

example

policies:
  - name: enforce-iam-permissions-on-api
    resource: rest-resource
    filters:
      - type: rest-method
        key: authorizationType
        value: NONE
        op: eq
    actions:
      - type: update-method
        patch:
          - op: replace
            path: /authorizationType
            value: AWS_IAM
properties:
  patch:
    items:
      additonalProperties: false
      properties:
        from:
          type: string
        op:
          enum:
          - add
          - remove
          - update
          - copy
          - replace
          - test
        path:
          type: string
        value:
          type: string
      required:
      - op
      - path
      type: object
    type: array
  type:
    enum:
    - update-method
required:
- patch
- type