prowler-cloud/prowler/prowler-api
- community
Checking that the SKILL.md file is still in the repository.
Prowler API patterns: RLS, RBAC, providers, Celery tasks. Trigger: When working in api/ on models/serializers/viewsets/filters/tasks involving tenant isolation (RLS), RBAC, or provider lifecycle.
Install
npx vskill@latest install prowler-cloud/prowler/prowler-apiSKILL.md
When to Use
Use this skill for Prowler-specific patterns:
- Row-Level Security (RLS) / tenant isolation
- RBAC permissions and role checks
- Provider lifecycle and validation
- Celery tasks with tenant context
- Multi-database architecture (4-database setup)
For generic DRF patterns (ViewSets, Serializers, Filters, JSON:API), use django-drf skill.
Critical Rules
- ALWAYS use
rls_transaction(tenant_id)when querying outside ViewSet context - ALWAYS use
get_role()before checking permissions (returns FIRST role only) - ALWAYS use
@set_tenantthen@handle_provider_deletiondecorator order - ALWAYS use explicit through models for M2M relationships (required for RLS)
- NEVER access
Provider.objectswithout RLS context in Celery tasks - NEVER bypass RLS by using raw SQL or
connection.cursor() - NEVER use Django's default M2M - RLS requires through models with
tenant_id
Note:rls_transaction()accepts both UUID objects and strings - it converts internally viastr(value).
Architecture Overview
4-Database Architecture
| Database | Alias | Purpose | RLS | |
|---|---|---|---|---|
default | prowler_user | Standard API queries | Yes | |
admin | admin | Migrations, auth bypass | No | |
replica | prowler_user | Read-only queries | Yes | |
admin_replica | admin | Admin read replica | No |
RLS Transaction Flow
Implementation Checklist
When implementing Prowler-specific API features:
| # | Pattern | Reference | Key Points | |
|---|---|---|---|---|
| 1 | RLS Models | api/rls.py | Inherit RowLevelSecurityProtectedModel, add constraint | |
| 2 | RLS Transactions | api/db_utils.py | Use rls_transaction(tenant_id) context manager | |
| 3 | RBAC Permissions | api/rbac/permissions.py | get_role(), get_providers(), Permissions enum | |
| 4 | Provider Validation | api/models.py | validate_<provider>_uid() methods on Provider model | |
| 5 | Celery Tasks | tasks/tasks.py, api/decorators.py, config/celery.py | Task definitions, decorators (@set_tenant, @handle_provider_deletion), RLSTask base | |
| 6 | RLS Serializers | api/v1/serializers.py | Inherit RLSSerializer to auto-inject tenant_id | |
| 7 | Through Models | api/models.py | ALL M2M must use explicit through with tenant_id |
Full file paths: See references/file-locations.md
Decision Trees
Which Base Model?
Which Manager?
Which Database?
Celery Task Decorator Order?
RLS Model Pattern
M2M Relationships (MUST use through models)
Async Task Response Pattern (202 Accepted)
For long-running operations, return 202 with task reference:
Providers (11 Supported)
| Provider | UID Format | Example | |
|---|---|---|---|
| AWS | 12 digits | 123456789012 | |
| Azure | UUID v4 | a1b2c3d4-e5f6-... | |
| GCP | 6-30 chars, lowercase, letter start | my-gcp-project | |
| M365 | Valid domain | contoso.onmicrosoft.com | |
| Kubernetes | 2-251 chars | arn:aws:eks:... | |
| GitHub | 1-39 chars | my-org | |
| IaC | Git URL | https://github.com/user/repo.git | |
| Oracle Cloud | OCID format | ocid1.tenancy.oc1.. | |
| MongoDB Atlas | 24-char hex | 507f1f77bcf86cd799439011 | |
| Alibaba Cloud | 16 digits | 1234567890123456 |
Adding new provider: Add to ProviderChoices enum + create validate_<provider>_uid() staticmethod.
RBAC Permissions
| Permission | Controls | |
|---|---|---|
MANAGE_USERS | User CRUD, role assignments | |
MANAGE_ACCOUNT | Tenant settings | |
MANAGE_BILLING | Billing/subscription | |
MANAGE_PROVIDERS | Provider CRUD | |
MANAGE_INTEGRATIONS | Integration config | |
MANAGE_SCANS | Scan execution | |
UNLIMITED_VISIBILITY | See all providers (bypasses provider_groups) |
RBAC Visibility Pattern
Celery Queues
| Queue | Purpose | |
|---|---|---|
scans | Prowler scan execution | |
overview | Dashboard aggregations (severity, attack surface) | |
compliance | Compliance report generation | |
integrations | External integrations (Jira, S3, Security Hub) | |
deletion | Provider/tenant deletion (async) | |
backfill | Historical data backfill operations | |
scan-reports | Output generation (CSV, JSON, HTML, PDF) |
Task Composition (Canvas)
Use Celery's Canvas primitives for complex workflows:
| Primitive | Use For | |
|---|---|---|
chain() | Sequential execution: A → B → C | |
group() | Parallel execution: A, B, C simultaneously | |
| Combined | Chain with nested groups for complex workflows |
Note: Use.si()(signature immutable) to prevent result passing. Use.s()if you need to pass results.
Examples: See assets/celery_patterns.py for chain, group, and combined patterns.
Beat Scheduling (Periodic Tasks)
| Operation | Key Points | |
|---|---|---|
| Create schedule | IntervalSchedule.objects.get_or_create(every=24, period=HOURS) | |
| Create periodic task | Use task name (not function), kwargs=json.dumps(...) | |
| Delete scheduled task | PeriodicTask.objects.filter(name=...).delete() | |
| Avoid race conditions | Use countdown=5 to wait for DB commit |
Examples: See assets/celery_patterns.py for schedule_provider_scan pattern.
Advanced Task Patterns
@set_tenant Behavior
| Mode | tenant_id in kwargs | tenant_id passed to function | |
|---|---|---|---|
@set_tenant (default) | Popped (removed) | NO - function doesn't receive it | |
@set_tenant(keep_tenant=True) | Read but kept | YES - function receives it |
Key Patterns
| Pattern | Description | |
|---|---|---|
bind=True | Access self.request.id, self.request.retries | |
get_task_logger(__name__) | Proper logging in Celery tasks | |
SoftTimeLimitExceeded | Catch to save progress before hard kill | |
countdown=30 | Defer execution by N seconds | |
eta=datetime(...) | Execute at specific time |
Examples: See assets/celery_patterns.py for all advanced patterns.
Celery Configuration
| Setting | Value | Purpose | |
|---|---|---|---|
BROKER_VISIBILITY_TIMEOUT | 86400 (24h) | Prevent re-queue for long tasks | |
CELERY_RESULT_BACKEND | django-db | Store results in PostgreSQL | |
CELERY_TASK_TRACK_STARTED | True | Track when tasks start | |
soft_time_limit | Task-specific | Raises SoftTimeLimitExceeded | |
time_limit | Task-specific | Hard kill (SIGKILL) |
Full config: See assets/celery_patterns.py and actual files atconfig/celery.py,config/settings/celery.py.
UUIDv7 for Partitioned Tables
Finding and ResourceFindingMapping use UUIDv7 for time-based partitioning:
Why UUIDv7? Time-ordered UUIDs enable PostgreSQL to prune partitions during range queries.
Batch Operations with RLS
Security Patterns
Full examples: See assets/security_patterns.py
Tenant Isolation Summary
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/prowler-api/SKILL.md
Popularity
- Repository stars
- 13,380
- Repository forks
- 2,049
- 7-day trend score
- 48
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 22 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/prowler-cloud/prowler/prowler-api)