T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- SKILL.md:14
- Finding
- Excessive Supabase Service-Role Credential Requirement<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 14-21 **Vulnerability Type**: Excessive privileged credential exposure **Risk Level**: High ### Vulnerable Code ```yaml env: - name: SUPABASE_URL description: Supabase project URL for gamification data storage required: true - name: SUPABASE_SERVICE_KEY description: Supabase service role key for database access required: true ``` The documented architecture also states: ```text User → ClawdBot Gateway → ClawdBot API Server → Supabase (Postgres) (Railway) (user_gamification, xp_transactions tables) ``` ### Technical Analysis The skill requires a Supabase service-role key even though it is described as a prompt interface that communicates with a separate ClawdBot API server. Under this architecture, privileged database access should occur only within the trusted backend. Supabase service-role keys generally provide highly privileged database access and can bypass Row Level Security policies. Requiring this key in the skill or Agent environment violates least-privilege and secret-isolation principles. It unnecessarily makes a backend credential available within a broader runtime that may also process untrusted prompts or load unrelated tools and skills. No direct credential-reading or exfiltration code was present in the audited project. The vulnerability is the unnecessary placement requirement for a privileged credential, which creates an exploitable exposure boundary if another runtime component can inspect environment variables. ### Attack Path 1. An operator installs the skill and supplies the required `SUPABASE_SERVICE_KEY`. 2. The service-role key becomes available in the Agent or skill execution environment. 3. A compromised tool, malicious skill, prompt-injection-driven component, diagnostic process, or insecure logging mechanism accesses or discloses the environment variable. 4. The attacker uses the extracted servi ...[truncated 823 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove `SUPABASE_SERVICE_KEY` from the skill's required environment variables. 2. Store the service-role key exclusively in the ClawdBot API server's managed secret store. 3. Ensure the client skill communicates only with authenticated, narrowly scoped backend API endpoints. 4. Use short-lived, user-scoped credentials where direct Supabase access is unavoidable, and enforce Row Level Security for all user-accessible tables. 5. Apply server-side authentication and authorization checks to every gamification endpoint, especially XP awards, badge awards, habit completion, and leaderboard access. 6. Prevent secrets from appearing in prompts, logs, error messages, telemetry, subprocess environments, or client configuration files. 7. Rotate any service-role key that has previously been distributed to an Agent or client runtime. 8. Audit Supabase access logs and database changes for unauthorized activity associated with previously exposed keys. ]]>
