Skip to content

HTTPTargetConnection.Authentication.HeaderName not recognized during validation #35

@micovery

Description

@micovery

test.yaml

APIProxy:
  .revision: 2
  .name: test-api
  DisplayName: test-api
  Description: API with Google authentication and comprehensive security
  CreatedAt: 1698691200
  LastModifiedAt: 1698777600

Policies:
  - JSONThreatProtection:
      .name: JSONTP-JSON-Threat-Protection
      DisplayName: JSONTP-JSON-Threat-Protection
      ArrayElementCount: 100
      ContainerDepth: 10
      ObjectEntryCount: 50
      StringValueLength: 1000
      Source: request

  - ExtractVariables:
      .name: EV-Extract-Query-Info
      DisplayName: EV-Extract-Query-Info
      Source: request
      JSONPayload:
        - Variable:
            .name: graphql.operation
            JSONPath: $.query
        - Variable:
            .name: graphql.variables
            JSONPath: $.variables

  - AssignMessage:
      .name: AM-Add-Request-Headers
      DisplayName: AM-Add-Request-Headers
      Set:
        Headers:
          - Header:
              .name: X-Request-ID
              -Data: '{messageid}'
          - Header:
              .name: X-Client-IP
              -Data: '{client.ip}'
          - Header:
              .name: X-GraphQL-Operation
              -Data: '{graphql.operation}'

  - MessageLogging:
      .name: ML-Log-GraphQL-Request
      DisplayName: ML-Log-GraphQL-Request
      Syslog:
        Message: "GraphQL: {graphql.operation}"
        Host: logs.example.com
        Port: 514

  - DataCapture:
      .name: DC-Capture-Analytics
      -Data:
        - DisplayName: DC-Capture-Analytics
        - Capture:
            DataCollector: dc_client_ip
            Collect:
              .ref: client.ip
        - Capture:
            DataCollector: dc_request_verb
            Collect:
              .ref: request.verb
        - Capture:
            DataCollector: dc_request_uri
            Collect:
              .ref: request.uri
        - Capture:
            DataCollector: dc_graphql_operation
            Collect:
              .ref: graphql.operation

  - RaiseFault:
      .name: RF-Validation-Error-Fault
      DisplayName: RF-Validation-Error-Fault
      FaultResponse:
        Set:
          StatusCode: 400
          Payload:
            .contentType: application/json
            -Data: '{"error": "validation_failed", "message": "Request does not match schema"}'

  - RaiseFault:
      .name: RF-Threat-Detected-Fault
      DisplayName: RF-Threat-Detected-Fault
      FaultResponse:
        Set:
          StatusCode: 400
          Payload:
            .contentType: application/json
            -Data: '{"error": "threat_detected", "message": "Malicious payload detected"}'

ProxyEndpoints:
  - ProxyEndpoint:
      .name: default
      HTTPProxyConnection:
        BasePath: /graphql
      FaultRules:
        - FaultRule:
            .name: Validation-Failed
            Condition: fault.name = "SchemaValidationFailed"
            -Data:
              - Step:
                  Name: ML-Log-GraphQL-Request
              - Step:
                  Name: RF-Validation-Error-Fault
        - FaultRule:
            .name: Threat-Protection-Triggered
            Condition: fault.name = "ThreatDetected"
            Step:
              Name: RF-Threat-Detected-Fault
      DefaultFaultRule:
        .name: DefaultFaultRule
        AlwaysEnforce: true
        Step:
          Name: ML-Log-GraphQL-Request
      PreFlow:
        .name: PreFlow
        Request:
          - Step:
              Name: JSONTP-JSON-Threat-Protection
          - Step:
              Name: EV-Extract-Query-Info
          - Step:
              Name: AM-Add-Request-Headers
      Flows: []
      PostFlow:
        .name: PostFlow
        Response:
          Step:
            Name: DC-Capture-Analytics
      PostClientFlow:
        .name: PostClientFlow
        Response:
          Step:
            Name: ML-Log-GraphQL-Request
      RouteRule:
        .name: default
        TargetEndpoint: graphql-backend

TargetEndpoints:
  - TargetEndpoint:
      .name: graphql-backend
      PreFlow:
        .name: PreFlow
      Flows: []
      PostFlow:
        .name: PostFlow
      HTTPTargetConnection:
        URL: https://graphql.backend.example.com
        Path: /graphql
        Authentication:
          HeaderName:
            -Data: Authorization
          GoogleIDToken:
            Audience:
              -Data: https://graphql.backend.example.com
              .useTargetUrl: true
        SSLInfo:
          Enabled: true
          Enforce: true
          ClientAuthEnabled: false
        HealthMonitor:
          Enabled: true
          IntervalInSec: 60
          HTTPMonitor:
            Request:
              ConnectTimeoutInSec: 5
              SocketReadTimeoutInSec: 10
              Port: 443
              Verb: POST
              Path: /graphql
              IsSSL: true
              Payload: '{"query":"{ __typename }"}'
              Header:
                .name: Content-Type
                -Data: application/json
            SuccessResponse:
              ResponseCode: 200

apigee-go-gen transform yaml-to-apiproxy \
    --input "./test.yaml" \
    --output "./out/test-bundle.zip"

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions