Back to skill

Security audit

Magic Link Bridge

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent Supabase magic-link helper, but users should treat generated links as sensitive login secrets and harden URL cleanup/logging.

Install only if you are comfortable handling Supabase magic links as sensitive login credentials. Keep the service-role key strictly server-side, use HTTPS, shorten token lifetimes where possible, avoid logging full URLs, strip auth parameters before analytics or other scripts run, and localize the included alert text for your users.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/portal-bridge.js:20
Finding
One-Time Authentication Token Exposed in URL Query String<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:39, 53-55`; `scripts/portal-bridge.js:20, 31-46` **Vulnerability Type**: Authentication token exposure through query-string URLs **Risk Level**: Medium ### Vulnerable Code The Skill explicitly recommends placing the Supabase one-time authentication credential in a URL query parameter: ```text https://site/portal/?token_hash=<hashed_token>&type=magiclink ``` ```js const u = new URL('https://site/portal/'); u.searchParams.set('token_hash', gen.hashed_token); u.searchParams.set('type', gen.verification_type || 'magiclink'); const magicLink = u.toString(); ``` The portal reads the token from the query string and does not remove it until the asynchronous verification request has settled: ```js var q = new URLSearchParams(window.location.search); // (3) error first — short-circuit and don't try to verify anything. var err = q.get('error_description') || q.get('error') || q.get('error_code'); if (err) { setTimeout(function () { alert('הקישור פג או כבר נוצל. בקש מהסוכן לשלוח קישור חדש.\n\n(' + decodeURIComponent(err) + ')'); }, 300); history.replaceState(null, '', window.location.pathname); return; } // (1) token_hash flow — explicit verifyOtp. var tokenHash = q.get('token_hash'); var type = q.get('type'); if (tokenHash && type) { sb.auth.verifyOtp({ token_hash: tokenHash, type: type }) .then(function (res) { if (res.error) { console.warn('verifyOtp failed:', res.error.message); setTimeout(function () { alert('הקישור פג או כבר נוצל. בקש מהסוכן לשלוח קישור חדש.'); }, 300); } }) .finally(function () { // Strip the one-time token from the URL so a refresh doesn't replay. history.replaceState(null, '', window.location.pathname); }); } ``` ### Technical Analysis Although named `token_hash`, this value is a bearer-like one-time credential accepted by Supabase's `verifyOtp` operation. Possession ...[truncated 2951 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Copy `token_hash` and `type` into local variables and immediately remove authentication parameters from the visible URL before beginning asynchronous verification: ```js var q = new URLSearchParams(window.location.search); var tokenHash = q.get('token_hash'); var type = q.get('type'); if (tokenHash && type) { history.replaceState(null, '', window.location.pathname); sb.auth.verifyOtp({ token_hash: tokenHash, type: type }).then(function (res) { if (res.error) { console.warn('verifyOtp failed:', res.error.message); } }); } ``` 2. Execute the bridge inline in the document head before analytics, tag managers, monitoring agents, images, or other third-party resources can inspect or receive the original URL. 3. Configure a restrictive response header on the portal and redirect entry points: ```http Referrer-Policy: no-referrer ``` 4. Configure reverse proxies, hosting platforms, analytics products, and application logs to redact `token_hash`, `code`, `access_token`, and similar authentication parameters. 5. Avoid loading unnecessary resources on the token-consumption entry page. A minimal interstitial route can clean the URL and verify the token before loading the full portal. 6. Keep tokens short-lived and single-use, monitor failed or duplicate consumption attempts, and invalidate outstanding links when suspicious use is detected. 7. Keep `SUPABASE_SERVICE_ROLE_KEY` exclusively in server-side secret storage. Validate or allow-list `SUPABASE_URL` so the service-role credential cannot be sent to an unintended host through configuration tampering. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (3)

Tp4

High
Category
MCP Tool Poisoning
Confidence
88% confidence
Finding
The description says the skill generates Supabase magic links that target a custom subpath and works around redirect rewriting by Supabase. The supplied code does not generate links or interact with Supabase configuration at all. Instead, it is a safety-net browser redirect placed on the homepage that forwards users to /portal/ when auth-related query/hash parameters are present. While this behavior is related to the same user problem domain and supports the broader flow, the primary purpose and capability differ materially from the declared description.

Missing User Warnings

Medium
Confidence
86% confidence
Finding
The skill recommends distributing magic links containing token material via WhatsApp, SMS, or email without clearly warning that possession of the link may allow account access until the token is redeemed or expires. Users or implementers may forward, log, preview, or expose these URLs through messaging apps, browser history, analytics, or support tooling, increasing the chance of unintended account takeover.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The file contains user-visible alert text only in Hebrew, which imposes a specific language on users without any opt-in or fallback. Under the policy, locale or language must not be forced unless the skill clearly offers a choice or is explicitly justified as region-specific.

Static analysis

Detected: suspicious.exposed_secret_literal

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
SKILL.md:45