T09 · Insecure Skill Coding Practices
- Location
scripts/teable_base.py:18- Finding
Bearer Token Disclosure and SSRF Through Insufficient Endpoint Validation
- Content
View full analysis
str: """ Validate URL to prevent SSRF and credential exfiltration. Args: url: URL to validate Returns: Validated URL Raises: ValueError: If URL is invalid or potentially malicious """ if not url: return url try: parsed = urlparse(url) if parsed.scheme.lower() not in ALLOWED_SCHEMES: raise ValueError( f"Invalid URL scheme: '{parsed.scheme}'. " f"Only {ALLOWED_SCHEMES} are allowed." ) if not parsed.netloc: raise ValueError(f"Invalid URL: missing domain in '{url}'") if parsed.scheme.lower() == "http": print( "WARNING: Using HTTP instead of HTTPS. " "Your API key will be transmitted in plaintext!", file=sys.stderr ) return url.rstrip("/") except Exception as e: raise ValueError(f"Invalid TEABLE_URL '{url}': {e}") ``` The validated URL is then combined with the API path and used in a session that always contains the bearer token: ```python raw_url = base_url or os.getenv("TEABLE_URL") or DEFAULT_BASE_URL self.base_url = validate_url(raw_url) self.api_key = api_key or ...[truncated 3791 chars]- Remediation
View remediation
