Skip to content

🐛 Fix 42 incorrect Azure RBAC permissions in auto-generated manifest#7081

Open
vjeffrey wants to merge 2 commits intomainfrom
fix/azure-permissions-validation
Open

🐛 Fix 42 incorrect Azure RBAC permissions in auto-generated manifest#7081
vjeffrey wants to merge 2 commits intomainfrom
fix/azure-permissions-validation

Conversation

@vjeffrey
Copy link
Copy Markdown
Contributor

Summary

  • Fixed the Azure permission extraction generator to produce correct RBAC permission strings
  • 42 permissions were invalid: missing parent resource paths, wrong resource type names, incorrect ARM provider names
  • All fixes verified against Azure RBAC permissions reference

ARM provider name fixes:

Before After
Microsoft.Datafactory Microsoft.DataFactory
Microsoft.Cosmosforpostgresql Microsoft.DBforPostgreSQL

Resource path fixes (18 SQL, 2 Cache, 3 MySQL, 3 PostgreSQL, 3 Network):

SDK client constructors don't include parent resource paths. Examples:

Before (invalid) After (correct)
Microsoft.Sql/databases/read Microsoft.Sql/servers/databases/read
Microsoft.Sql/firewallRules/read Microsoft.Sql/servers/firewallRules/read
Microsoft.Cache/firewallRules/read Microsoft.Cache/redis/firewallRules/read
Microsoft.DBforMySQL/databases/read Microsoft.DBforMySQL/servers/databases/read

Resource type name fixes (12 permissions):

SDK client class names differ from ARM resource types:

Before (invalid) After (correct)
Microsoft.Network/interfaces/read Microsoft.Network/networkInterfaces/read
Microsoft.Network/securityGroups/read Microsoft.Network/networkSecurityGroups/read
Microsoft.Storage/accounts/read Microsoft.Storage/storageAccounts/read
Microsoft.Web/webApps/read Microsoft.Web/sites/read
Microsoft.Web/plans/read Microsoft.Web/serverfarms/read
Microsoft.Batch/account/read Microsoft.Batch/batchAccounts/read

Note: also includes GCP generator fixes from #7080.

Test plan

  • Verified each corrected permission against Azure RBAC permissions reference docs
  • Run make providers/build/azure to confirm build succeeds
  • Verify regeneration is idempotent: go run providers-sdk/v1/util/permissions/permissions.go providers/azure produces no diff

🤖 Generated with Claude Code

vjeffrey and others added 2 commits March 31, 2026 12:34
The permission extraction heuristics produced several invalid GCP IAM
permission strings. This fixes the generator and regenerates the manifest.

**Service name prefix fixes (gcpServiceNameMap):**
- cloudresourcemanager.* → resourcemanager.* (9 permissions)
- sqladmin.* → cloudsql.* (2 permissions)
- security.* → privateca.* (3 permissions)

**Method-to-permission override table (new):**
- accessapproval.accessApprovalSettings.get → accessapproval.settings.get
- binaryauthorization.systemPolicy.get → binaryauthorization.policy.get
- cloudkms.cryptoKey.get → cloudkms.cryptoKeys.get
- cloudkms.iamPolicy.get → cloudkms.cryptoKeys.getIamPolicy
- secretmanager.iamPolicy.get → secretmanager.secrets.getIamPolicy
- secretmanager.secretVersions.list → secretmanager.versions.list
- artifactregistry.iamPolicy.get → artifactregistry.repositories.getIamPolicy
- serviceusage.service.get → serviceusage.services.get

**Non-API method filtering (new skip list):**
- monitoring.conditionAbsent.get, monitoring.conditionThreshold.get,
  monitoring.conditionMatchedLog.get, monitoring.conditionMonitoringQueryLanguage.get
  (protobuf getters, not real API calls)

**Other generator fixes:**
- Strip "Iter" suffix from gRPC iterator methods (iam.rolesIter.list → iam.roles.list)
- Map REST "Aggregated" verb to "list" (dataflow.jobs.aggregated → dataflow.jobs.list)
- Skip bare gRPC Get() calls with no resource qualifier (compute.compute.get)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Azure permission extraction heuristics produced many invalid
permission strings. This fixes the generator and regenerates the manifest.

**ARM provider name fixes (azureServiceToARMMap):**
- Microsoft.Datafactory → Microsoft.DataFactory (casing)
- Microsoft.Cosmosforpostgresql → Microsoft.DBforPostgreSQL (wrong provider)

**Permission override table (new, 42 entries):**

Resource path fixes (SDK clients don't include parent paths):
- Microsoft.Sql/* → Microsoft.Sql/servers/* or servers/databases/*
  (18 permissions: databases, firewallRules, encryptionProtector, etc.)
- Microsoft.Cache/* → Microsoft.Cache/redis/*
  (firewallRules, patchSchedules)
- Microsoft.DBforMySQL/* → Microsoft.DBforMySQL/servers/*
  (configurations, databases, firewallRules)
- Microsoft.DBforPostgreSQL/* → Microsoft.DBforPostgreSQL/servers/*
  (configurations, databases, firewallRules)
- Microsoft.Network/subnets → virtualNetworks/subnets
- Microsoft.Network/flowLogs → networkWatchers/flowLogs
- Microsoft.Network/virtualNetworkPeerings → virtualNetworks/virtualNetworkPeerings

Resource type name fixes (SDK names differ from ARM types):
- Microsoft.Batch/account → batchAccounts, pool → batchAccounts/pools
- Microsoft.Network/interfaces → networkInterfaces
- Microsoft.Network/securityGroups → networkSecurityGroups
- Microsoft.Network/watchers → networkWatchers
- Microsoft.Network/virtualNetworkGatewayConnections → connections
- Microsoft.Storage/accounts → storageAccounts
- Microsoft.Storage/blobContainers → storageAccounts/blobServices/containers
- Microsoft.Web/environments → hostingEnvironments
- Microsoft.Web/plans → serverfarms
- Microsoft.Web/webApps → sites
- Microsoft.DBforPostgreSQL/clusters → serverGroupsv2

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@mondoo-code-review mondoo-code-review bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes incorrect Azure RBAC and GCP IAM permission strings in auto-generated manifests, preventing permission errors when creating custom roles from the manifest.

@github-actions
Copy link
Copy Markdown
Contributor

Test Results

5 747 tests  ±0   5 743 ✅ ±0   2m 21s ⏱️ +13s
  425 suites ±0       4 💤 ±0 
   33 files   ±0       0 ❌ ±0 

Results for commit 0e7cfe8. ± Comparison against base commit 66fba2b.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant