T09 · Insecure Skill Coding Practices
- Location
oneinch_client.py:117- Finding
Chain Identifier Is Discarded When Generating Quotes and Swap Transactions
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This appears to be a legitimate 1inch DEX helper, but it needs review because it prepares financial transaction data while mishandling chain selection and token approval checks.
Review this before installing or using it with real funds. Treat it as a transaction-data helper only: do not sign returned swap or approval transactions unless your wallet or separate code verifies the chain, router contract, token addresses, amount, spender, slippage, and calldata. Be aware that your 1inch API key, wallet address, token selections, and trade amounts are sent to 1inch.
oneinch_client.py:117Chain Identifier Is Discarded When Generating Quotes and Swap Transactions
oneinch_swap.py:114Approval Check Always Recommends Token Approval Without Inspecting Existing Allowance
The skill explicitly advertises token swap functionality, which can lead to irreversible on-chain transactions and financial loss, but it does not warn users about these consequences. In a crypto-trading context, omission of transactional risk messaging can mislead users into treating swap operations as low-risk data queries rather than actions that may spend assets, incur gas fees, and be impossible to reverse.
The swap usage example shows passing a wallet address and receiving transaction data without warning that this data may be used to execute an asset transfer on-chain. This is dangerous because users or downstream agents may copy the example into automated workflows and unintentionally generate or submit transactions that expose addresses, spend funds, and incur irreversible losses if parameters are wrong or maliciously altered.
This Python file contains its module description entirely in Chinese and continues that choice throughout docstrings and printed user-facing output. Per the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly justified, which is not present here.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
class OneInchClient:
"""1inch API 客户端"""
BASE_URL = "https://api.1inch.dev/swap/v5.2"
def __init__(self, api_key: str):
"""
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
class OneInchClient:
"""1inch API 客户端"""
BASE_URL = "https://api.1inch.dev/swap/v5.2"
def __init__(self, api_key: str):
"""
The module and method documentation are presented in Chinese throughout, which imposes a specific language on users without any visible opt-in or explanation that the skill is intended only for a Chinese-language environment. This matches the policy category for language or locale constraints expressed in natural language.
This code performs a network request to the 1inch swap endpoint using parameters that include the user's wallet address, token selections, and amount. Although the docstring describes functionality, it does not clearly warn that invoking this method sends user trading data off-host to an external service.
The method is named and documented as checking whether token approval is needed, but it always returns needs_approval=True without verifying current allowance on-chain. This can cause unnecessary approval transactions and may train downstream consumers to approve blindly, increasing the chance of excessive token allowances being granted to a spender.
All user-facing natural-language documentation in this file is in Chinese, and the skill does not indicate that the language is optional, user-selectable, or required for a region-specific purpose. Per the policy, forcing a specific language without user opt-in can constitute a locale/language policy violation.
The docstring for swap() documents a return structure containing a top-level 'tx' object, but the actual code builds swap_data with the key 'transaction' instead. This is an active contradiction in the API contract documentation, not merely an omission, and could mislead callers about how to use the returned transaction payload.