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

[BUG] Fix handling of multi-line descriptions for policy definition and assignment exports #2973

Closed
BernieWhite opened this issue Jul 6, 2024 · 0 comments · Fixed by #2975
Assignees
Labels
bug Something isn't working feature: policy-as-rules Issues that related to exporting policy as rules.
Milestone

Comments

@BernieWhite
Copy link
Collaborator

Existing rule

No response

Description of the issue

When multi-line descriptions are used the synopsis is broken over multiple lines, creating invalid JSON.

Error messages

No response

Reproduction

/providers/Microsoft.Authorization/policyDefinitions/82bf5b87-728b-4a74-ba4d-6123845cf542

which generates.

{
  // Synopsis: Microsoft Defender for Azure Cosmos DB is an Azure-native layer of security that detects attempts to exploit databases in your Azure Cosmos DB accounts.
  Defender for Azure Cosmos DB detects potential SQL injections, known bad actors based on Microsoft Threat Intelligence, suspicious access patterns, and potential exploitations of your database through compromised identities or malicious insiders.
  "apiVersion":"github.com/microsoft/PSRule/v1","kind":"Rule","metadata":{"name":"Azure.Policy.76c22119afc9","displayName":"Configure Microsoft Defender for Azure Cosmos DB to be enabled","tags":{"Azure.Policy/category":"Security Center"},"annotations":{"Azure.Policy/id":"/providers/Microsoft.Authorization/policyDefinitions/82bf5b87-728b-4a74-ba4d-6123845cf542","Azure.Policy/version":"1.0.0"}},"spec":{"recommend":"Microsoft Defender for Azure Cosmos DB is an Azure-native layer of security that detects attempts to exploit databases in your Azure Cosmos DB accounts.\r\nDefender for Azure Cosmos DB detects potential SQL injections, known bad actors based on Microsoft Threat Intelligence, suspicious access patterns, and potential exploitations of your database through compromised identities or malicious insiders.","type":["Microsoft.Resources/subscriptions"],"with":["PSRule.Rules.Azure\\Azure.Policy.All"],"where":{"allOf":[]},"condition":{"field":"resources","allOf":[{"field":"properties.pricingTier","equals":"Standard"}],"where":{"allOf":[{"type":".","equals":"Microsoft.Security/pricings"},{"name":".","equals":"CosmosDbs"}]}}}
}

Version of PSRule

2.9.0

Version of PSRule for Azure

1.37.0

Additional context

No response

@BernieWhite BernieWhite added bug Something isn't working feature: policy-as-rules Issues that related to exporting policy as rules. labels Jul 6, 2024
@BernieWhite BernieWhite self-assigned this Jul 6, 2024
@BernieWhite BernieWhite added this to the v1.38.0 milestone Jul 6, 2024
BernieWhite added a commit to BernieWhite/PSRule.Rules.Azure that referenced this issue Jul 6, 2024
This was referenced Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature: policy-as-rules Issues that related to exporting policy as rules.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant