feat(engines): add usable_by for filtering valid service subtypes for resource access#143
feat(engines): add usable_by for filtering valid service subtypes for resource access#143
Conversation
📝 WalkthroughWalkthroughThis change introduces service access validation for Terraform resources. A Pre-merge checks❌ Failed checks (1 inconclusive)
✅ Passed checks (1 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
engines/terraform/resource_handler.go (1)
249-256: LGTM: Database access validation correctly enforcedThe validation follows the same pattern as buckets, ensuring consistent access control across resource types.
The validation logic is duplicated between bucket and database handlers (lines 155-162 and 249-256). Consider extracting to a helper function if similar validation is added for additional resource types:
func (td *TerraformDeployment) validateServiceResourceAccess( appSpec *app_spec_schema.Application, spec *ResourceBlueprint, serviceName, resourceName, resourceType string, ) error { serviceIntent, ok := appSpec.ServiceIntents[serviceName] if !ok { return fmt.Errorf("could not validate access to %s %s: service %s not found in application spec", resourceType, resourceName, serviceName) } return spec.ValidateServiceAccess(serviceIntent.GetSubType(), resourceName, resourceType) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
engines/terraform/platform.go(3 hunks)engines/terraform/platform_test.go(1 hunks)engines/terraform/resource_handler.go(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
engines/terraform/platform_test.go (1)
engines/terraform/platform.go (1)
ResourceBlueprint(369-375)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Security Scan
- GitHub Check: Build (windows-latest, amd64)
🔇 Additional comments (4)
engines/terraform/platform.go (2)
374-374: LGTM: Access control field addedThe
UsableByfield enables declarative service access restrictions on resources. Theomitemptytags ensure backward compatibility.
397-411: LGTM: Validation logic is correctThe method correctly implements backward-compatible validation:
- Empty/nil
UsableBypermits all service types- Clear error messages include both the denied subtype and allowed list
engines/terraform/platform_test.go (1)
9-98: LGTM: Comprehensive test coverageThe table-driven tests thoroughly validate:
- Backward compatibility (nil/empty
UsableBy)- Allow/deny logic for service subtypes
- Error message content and formatting
engines/terraform/resource_handler.go (1)
155-162: Approve bucket access validation; verify topic resource scopeThe bucket validation logic (lines 155–162) is correctly implemented. However,
TopicIntentsand a correspondingprocessTopicResourcesfunction do not appear in the codebase. Verify whether topic resources are in scope for this PR—if they are planned, they would need the same access validation pattern as buckets and databases.
|
🎉 This PR is included in version 0.6.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
No description provided.