Skip to content

Named value transitive dependency not being extracted when used only in backend credentials header #315

Description

@JProvAnt

Command that triggered the bug

apiops extract

Expected behavior

When extracting transitive dependencies from an API a Named Value that is referenced in a Backend credential header should also be extracted.

Example backend:

{
  "id": "redacted",
  "type": "Microsoft.ApiManagement/service/backends",
  "name": "function-backend",
  "properties": {
    "title": null,
    "description": "function app backend",
    "type": "Single",
    "url": "https://function-test.azurewebsites.net/api",
    "protocol": "http",
    "credentials": {
      "query": {},
      "header": {
        "x-functions-key": [
          "{{function-test-key}}"
        ]
      }
    },
    "tls": {
      "validateCertificateChain": false,
      "validateCertificateName": false
    }
  }
}

The Named value function-test-key is not being extracted.

Actual behavior

When running apiops-extract the Backend is being extracted as a transitive dependency, but the Named value function-test-key is not being extracted which is used as header in the backend.

To test this if we add:

<set-variable name="testVar" value="{{ function-test-key }}" />

to the API policy, the Named value will then be automatically extracted as expected.

However it should also extract the Named value even if the only reference is in the Backend credentials.

apiops CLI version

1.0.4

Environment details

Azure devops

CI/CD environment

None

Is this bug blocking you?

None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

type:bugSomething broken

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions