Skip to content

downloaded policyTemplateInstances include Value of Environment Variable instead of Reference #1154

Open
@ewillman

Description

@ewillman

Describe the bug
When api policies reference an Environment Variable, the apiproperties.json file downloaded by pac connector download includes the actual value of the Environment Variable, instead of a Reference to the variable. If you then re-upload this file, the resulting connector no longer has environment variable references in configured policies.

To Reproduce
Steps to reproduce the behavior:

  1. Create an Environment Variable
  2. Edit a Custom Connector and on the "Definition" tab, choose "new policy" at the very bottom
  3. Add a policy that uses the "Set HTTP Header" template
  4. In the "Header value" field, reference the environment variable you created in step 1 in the format @environmentVariables("xyz_logicalnameofthe vairable")
  5. Save and validate the connector
  6. execute pac connector download for the specified connector, then open the downloaded apiproperties.json file
  7. notice in the policyTemplateInstances that the value is the value of the environment variable, not the reference you provided in the user interface
    Expected behavior
    downloaded properties should retain variable references

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 11
  • VSCode 1.96.4
  • CLI Version: 1.40.4+g8ef3243

Additional context
This is especially problematic because this behavior is occurring for both "regular" Environment Variables, as well as keyvault-connected Environment Variables, so that downloading a connector that has an api policy that references a keyvault-connector Environment Variable effectively ends up dumping the otherwise encrypted secret to plain text.

This particular bug was discovered while putting together the most concise steps for reproducing bug 1152

Metadata

Metadata

Assignees

No one assigned

    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