Skip to content

bug: aws policy elbv2_redirect_http_to_https.sql should match on lowercase "redirect"  #13433

@obormot

Description

@obormot

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

plugins/source/aws/policies/queries/elb/elbv2_redirect_http_to_https.sql:

   protocol = 'HTTP' and (
        da->>'Type' != 'REDIRECT' or da->'RedirectConfig'->>'Protocol' != 'HTTPS')
    then 'fail'

this code tries to match on uppercase "REDIRECT", while in my case I found the keyword as returned by AWS is lowercase.
e.g. running select default_actions from aws_elbv2_listeners limit 1; gives this:

[
  {
    "Type": "redirect",
    "Order": 1,
    "ForwardConfig": null,
    "RedirectConfig": {
      "Host": "#{host}",
      "Path": "/#{path}",
      "Port": "443",
      "Query": "#{query}",
      "Protocol": "HTTPS",
      "StatusCode": "HTTP_301"
    },
    "TargetGroupArn": null,
    "FixedResponseConfig": null,
    "AuthenticateOidcConfig": null,
    "AuthenticateCognitoConfig": null
  }
]

Expected Behavior

the correct code in elbv2_redirect_http_to_https.sql should be

   protocol = 'HTTP' and (
        da->>'Type' != 'redirect' or da->'RedirectConfig'->>'Protocol' != 'HTTPS')
    then 'fail'

OR

   protocol = 'HTTP' and (
        UPPER(da->>'Type') != 'REDIRECT' or da->'RedirectConfig'->>'Protocol' != 'HTTPS')
    then 'fail'

CloudQuery (redacted) config

N/A

Steps To Reproduce

N/A

CloudQuery (redacted) logs

N/A

CloudQuery version

I don't know

Additional Context

No response

Pull request (optional)

  • I can submit a pull request

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions