Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Referencing a secure param in a regular (non-secure) param is not flagged #15835

Closed
anthony-c-martin opened this issue Dec 11, 2024 · 2 comments · Fixed by #16251
Closed

Referencing a secure param in a regular (non-secure) param is not flagged #15835

anthony-c-martin opened this issue Dec 11, 2024 · 2 comments · Fixed by #16251
Assignees
Milestone

Comments

@anthony-c-martin
Copy link
Member

anthony-c-martin commented Dec 11, 2024

The following scenarios should be blocked:

Scenario 1:

  • main.bicep:
    @secure()
    param secureParam string
    
    param insecureParam string = secureParam

Scenario 2:
[EDIT] Broken out into separate issue (#16253) because I think this'll need a new linter rule.

@jeskew
Copy link
Member

jeskew commented Dec 12, 2024

Maybe a separate issue, but we should in general be flagging whenever a sensitive value is assigned to a non-sensitive slot or vice versa. For example, the following template raises no diagnostics but should raise two:

@secure()
param secret string

param nonSensitive string

resource e 'Microsoft.CostManagement/exports@2024-08-01' = {
  name: secret    // <-- Should flag assignment of sensitive data to non-sensitive slot
  properties: {
    definition: {
      timeframe: 'BillingMonthToDate'
      type: 'Usage'
    }
    deliveryInfo: {
      destination: {
        container: 'containerName'
        sasToken: nonSensitive   // <-- Should flag assignment of non-sensitive data to sensitive slot
      }
    }
  }
}

We should be able to do this based on existing type validation flags. I'm not sure if we accurately track "taint," though (i.e., is a variable whose value is based on a secure parameter itself be flagged as secure?).

@anthony-c-martin
Copy link
Member Author

@jeskew good idea. I've created a separate issue for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants