T09 · Insecure Skill Coding Practices
- Location
scripts/twitter_oauth_client.py:306- Finding
API Key Disclosed Through Command Output
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill does what it says at a high level, but it exposes the configured API key in normal command output and can redirect posting traffic to arbitrary HTTP(S) relay URLs.
Review before installing. Only use this with an AIsa key you are willing to expose to command output/logs, avoid confidential monitoring terms unless the provider is approved, and do not set TWITTER_RELAY_BASE_URL unless you fully trust the destination. The publisher should remove API key fields from outputs, restrict relay URLs to trusted HTTPS hosts, and make quote/reply posting behavior explicit before this is treated as routine-risk.
scripts/twitter_oauth_client.py:306API Key Disclosed Through Command Output
scripts/twitter_oauth_client.py:42Configurable Relay Allows Credential and Media Exfiltration Over Arbitrary HTTP(S) Destinations
The code substantially matches the read/search portion of the description: it supports profiles, timelines/tweets, mentions, followers, tweet search, trends, lists, communities, and Spaces. However, the description also claims the skill can publish posts after the user completes OAuth in the browser. In this code chunk, there is no post/create-tweet endpoint, no OAuth initiation/redirect/callback handling, and no browser-based auth flow despite importing webbrowser. Authentication is via an AISA_API_KEY bearer token, not user OAuth. Therefore the description overstates material capabilities that are not present in the supplied code.
The description materially overstates the skill's capabilities. In the provided code, the only network endpoints used are /twitter/auth_twitter and /twitter/post_twitter, plus a local status command. The code can obtain an authorization URL, optionally open it in a browser, and publish posts with optional media, quote/reply chaining, and chunking to fit Twitter length rules. There is no code for fetching profiles, timelines, mentions, followers, search results, trends, lists, communities, or Spaces. Because the declared primary purpose includes broad read/search functionality that is absent from the implementation, this is a clear description-behavior mismatch.
The instruction to default to --type quote for publishing conflicts with earlier guidance that normal standalone posts should not include quote/reply relationship fields. In a posting skill, this can cause unintended quoting behavior, accidental inclusion of external tweet context, and publication of content in a different visibility/context than the user requested.
The code embeds the API key into ordinary post-operation responses, causing plain-text credential disclosure during normal use. In an agent-integrated environment this is especially dangerous because outputs may be visible to users, plugins, telemetry pipelines, or logs not intended to handle secrets.
The authorization command prints the API key alongside the authorization URL and raw response, disclosing a sensitive credential during a routine setup flow. This can leak the relay secret to shell history capture, CI logs, notebook outputs, or upstream agent traces.
The status command exposes the configured relay credential in cleartext even though the command's purpose is operational diagnostics, not secret inspection. This creates a straightforward disclosure path for anyone able to invoke the skill or read its output, enabling unauthorized use of the external relay service.
The status command explicitly prints the configured API key in cleartext, creating a direct credential disclosure primitive. Because this skill is for Twitter/X operations rather than secret management, the exposure is unjustified and increases the blast radius if the command is invoked by an untrusted user or captured by logs.
The skill declares access to environment variables and makes many outbound network requests, but it does not define explicit tool scope such as allowed tools or permissions. That increases the blast radius if the skill is invoked in a broader agent environment, because access to secrets and external transmission are possible without a clear least-privilege boundary.
The skill sends user-supplied Twitter queries, usernames, IDs, and potentially monitoring targets to a third-party API service, but the description does not clearly disclose that external data sharing occurs. In a social listening context, those queries may reveal sensitive business interests, investigations, or user intent, so lack of disclosure can cause privacy and compliance issues.
This skill is explicitly designed to transmit data and an API bearer token to an external service at api.aisa.one. That is expected functionality, but it is still security-relevant because any user-supplied query, monitored account, or identifier is disclosed to a third party, and the external dependency becomes part of the trust boundary.
# Get user info
curl "https://api.aisa.one/apis/v1/twitter/user/info?userName=elonmusk" \
-H "Authorization: Bearer $AISA_API_KEY"
# Get user profile about (account country, verification, username changes)
This endpoint sends profile lookup parameters and the bearer token to a third-party API. In context, the skill is meant to do this, but the risk remains that user requests and credentials cross organizational boundaries without explicit least-privilege and disclosure controls.
-H "Authorization: Bearer $AISA_API_KEY"
# Get user profile about (account country, verification, username changes)
curl "https://api.aisa.one/apis/v1/twitter/user_about?userName=elonmusk" \
-H "Authorization: Bearer $AISA_API_KEY"
# Batch get user info by IDs
Batch user ID lookups transmit potentially large target sets to an external service, which can expose investigations, watchlists, or internal research priorities. Because authorization is via bearer token, mishandling request logging or telemetry could also leak credentials.
-H "Authorization: Bearer $AISA_API_KEY"
# Batch get user info by IDs
curl "https://api.aisa.one/apis/v1/twitter/user/batch_info_by_ids?userIds=44196397,123456" \
-H "Authorization: Bearer $AISA_API_KEY"
# Get user's latest tweets
Timeline retrieval sends monitored account selections and authentication data to a third-party API. In a competitive intelligence or monitoring use case, the chosen accounts themselves may be sensitive business information.
-H "Authorization: Bearer $AISA_API_KEY"
# Get user's latest tweets
curl "https://api.aisa.one/apis/v1/twitter/user/last_tweets?userName=elonmusk" \
-H "Authorization: Bearer $AISA_API_KEY"
# Get user mentions
Mention queries reveal which users or brands are being monitored and send that data to the external provider. The behavior is expected for the skill's purpose, but it creates privacy and business-intelligence exposure if not disclosed and controlled.
-H "Authorization: Bearer $AISA_API_KEY"
# Get user mentions
curl "https://api.aisa.one/apis/v1/twitter/user/mentions?userName=elonmusk" \
-H "Authorization: Bearer $AISA_API_KEY"
# Get user followers
Follower lookups send tracked handles and the bearer credential to the external service. This can expose relationship analysis targets and create dependency on a third-party processor for user interest graphs.
-H "Authorization: Bearer $AISA_API_KEY"
# Get user followers
curl "https://api.aisa.one/apis/v1/twitter/user/followers?userName=elonmusk" \
-H "Authorization: Bearer $AISA_API_KEY"
# Get user followings
Following-list lookups disclose monitored accounts and analysis intent to the API provider. While normal for this skill, the transfer is still security-relevant because it expands the trust boundary beyond the local agent runtime.
-H "Authorization: Bearer $AISA_API_KEY"
# Get user followings
curl "https://api.aisa.one/apis/v1/twitter/user/followings?userName=elonmusk" \
-H "Authorization: Bearer $AISA_API_KEY"
# Get user verified followers (requires user_id, not userName)
Verified follower queries send user identifiers to a third-party API along with authentication. Bulk or repeated use could reveal target-selection logic or internal screening criteria.
-H "Authorization: Bearer $AISA_API_KEY"
# Get user verified followers (requires user_id, not userName)
curl "https://api.aisa.one/apis/v1/twitter/user/verifiedFollowers?user_id=44196397" \
-H "Authorization: Bearer $AISA_API_KEY"
# Check follow relationship between two users
Relationship checks between users can reveal internal hypotheses or investigative interests when sent to the external provider. The external service also receives the bearer token used to authorize access.
-H "Authorization: Bearer $AISA_API_KEY"
# Check follow relationship between two users
curl "https://api.aisa.one/apis/v1/twitter/user/check_follow_relationship?source_user_name=elonmusk&target_user_name=BillGates" \
-H "Authorization: Bearer $AISA_API_KEY"
# Search users by keyword
Keyword-based user searches transmit potentially sensitive search terms to the provider, which may disclose business strategies or investigative topics. This is expected behavior but requires transparent consent and privacy controls.
-H "Authorization: Bearer $AISA_API_KEY"
curl "https://api.aisa.one/apis/v1/twitter/user/search?query=AI+researcher"
-H "Authorization: Bearer $AISA_API_KEY"
Advanced tweet search sends free-form query text to a third-party endpoint, which may expose sensitive research topics, customer issues, or internal initiatives. Because the search is authenticated with a bearer key, careless logging creates additional credential exposure risk.
# Advanced tweet search (queryType is required: Latest or Top)
curl "https://api.aisa.one/apis/v1/twitter/tweet/advanced_search?query=AI+agents&queryType=Latest" \
-H "Authorization: Bearer $AISA_API_KEY"
# Search top tweets
Top-tweet search has the same security characteristics as other search endpoints: external disclosure of queries and reliance on third-party processing. In context, social listening can make the content of search terms especially sensitive.
-H "Authorization: Bearer $AISA_API_KEY"
# Search top tweets
curl "https://api.aisa.one/apis/v1/twitter/tweet/advanced_search?query=AI+agents&queryType=Top" \
-H "Authorization: Bearer $AISA_API_KEY"
# Get tweets by IDs (comma-separated)
Tweet ID lookups transmit selected tweet targets and credentials to the provider. Even public tweet IDs can reveal what content the user is analyzing or tracking.
-H "Authorization: Bearer $AISA_API_KEY"
# Get tweets by IDs (comma-separated)
curl "https://api.aisa.one/apis/v1/twitter/tweets?tweet_ids=1895096451033985024" \
-H "Authorization: Bearer $AISA_API_KEY"
# Get tweet replies
Reply retrieval sends conversation targets to the provider and may reveal what threads are under investigation. The behavior is expected but still expands the data-sharing surface to an external dependency.
-H "Authorization: Bearer $AISA_API_KEY"
# Get tweet replies
curl "https://api.aisa.one/apis/v1/twitter/tweet/replies?tweetId=1895096451033985024" \
-H "Authorization: Bearer $AISA_API_KEY"
# Get tweet quotes
Quote lookup shares targeted tweet IDs and usage metadata with the external API. In aggregate, such requests can reveal monitoring priorities or brand-response workflows.
-H "Authorization: Bearer $AISA_API_KEY"
# Get tweet quotes
curl "https://api.aisa.one/apis/v1/twitter/tweet/quotes?tweetId=1895096451033985024" \
-H "Authorization: Bearer $AISA_API_KEY"
# Get tweet retweeters
Retweeter analysis sends the tweet target and authentication token to a third-party processor. This can expose audience-analysis interests and should be treated as sensitive operational metadata.
-H "Authorization: Bearer $AISA_API_KEY"
# Get tweet retweeters
curl "https://api.aisa.one/apis/v1/twitter/tweet/retweeters?tweetId=1895096451033985024" \
-H "Authorization: Bearer $AISA_API_KEY"
# Get tweet thread context (full conversation thread)
No suspicious patterns detected.