T09 · Insecure Skill Coding Practices
- Location
scripts/airtap_common.py:57- Finding
Bearer Token and Sensitive API Payloads Can Be Redirected to an Arbitrary Endpoint
- Content
View full analysis
str: return os.environ.get("AIRTAP_BASE_URL", DEFAULT_BASE_URL) ``` ```python def get_auth_headers() -> Dict[str, str]: token = os.environ.get(TOKEN_ENV_VAR) if not token: raise ValueError( f"Missing auth token. Run --add-token or add {TOKEN_ENV_VAR} to .env before running this command." ) return { "Authorization": f"Bearer {token}", "Content-Type": "application/json", PILOT_CLIENT_TYPE_HEADER_NAME: SKILL_CLIENT_TYPE, PILOT_CLIENT_NAME_HEADER_NAME: get_skill_client_name(), } ``` ```python def request_api( logger: logging.Logger, method: str, path: str, *, payload: Optional[Dict[str, Any]] = None, ) -> Dict[str, Any]: logger.info( "Airtap API request method=%s path=%s payload=%s", method, path, json.dumps(summarize_payload(payload), sort_keys=True), ) start_time = time.monotonic() try: response = requests.request( method, f"{get_base_url()}{path}", headers=get_auth_headers(), json=payload, timeout=DEFAULT_TIMEOUT_SECS, ) ``` ### Technical Analysis The API base URL is taken directly from `AIRTAP_BASE_URL` without validating its scheme, hostname, port, or origin. Every API request then attaches the Airtap personal access token as a bearer credential. The Skill loads `scripts/.env` with `override=True`, meaning a value in that file can override an otherwise safe shell environment value. An attacker who can influence the local Skill configuration can therefore redirect authenticated requests from `airtap.ai` to an attacker-controlled serv ...[truncated 1322 chars]- Remediation
View remediation
