[new-plugin] quickswap-dex v0.1.0#177
Conversation
📋 Phase 3: AI Code Review Report — Score: 62/100
1. Plugin Overview
Summary: This plugin enables interaction with QuickSwap V2 AMM on Polygon (chain 137), providing swap quotes, token swaps, liquidity addition/removal, pair lookups, on-chain price queries, and reserve queries. It uses a custom Rust binary ( Target Users: DeFi users who want to trade tokens or manage liquidity on QuickSwap DEX on Polygon through an AI agent interface. 2. Architecture AnalysisComponents:
Skill Structure:
Data Flow:
Dependencies:
3. Auto-Detected Permissionsonchainos Commands Used
Wallet Operations
External APIs / URLs
Chains Operated On
Overall Permission SummaryThis plugin performs high-risk DeFi operations (token swaps, liquidity management) on Polygon via QuickSwap V2. All on-chain write operations are correctly delegated to 4. onchainos API ComplianceDoes this plugin use onchainos CLI for all on-chain write operations?Yes — All on-chain write operations (swap, approve, add-liquidity, remove-liquidity) are executed via On-Chain Write Operations (MUST use onchainos)
Data Queries (allowed to use external sources)
External APIs / Libraries Detected
Verdict: ✅ Fully CompliantAll on-chain write operations use 5. Security AssessmentStatic Rule Scan (C01-C09, H01-H09, M01-M08, L01-L02)
LLM Judge Analysis (L-PINJ, L-MALI, L-MEMA, L-IINJ, L-AEXE, L-FINA, L-FISO)
Toxic Flow Detection (TF001-TF006)
Toxic Flow TF005 is triggered: Prompt Injection ScanNo instruction override, identity manipulation, hidden behavior, confirmation bypass, unauthorized operations, or hidden content (base64 in install reporting is for HMAC key, not instructions) detected in the SKILL.md. The base64-encoded string Result: Dangerous Operations CheckThe plugin involves:
User confirmation steps are explicitly documented:
Result: ✅ Safe (proper confirmation mechanisms in place) Data Exfiltration RiskThe install reporting script collects and transmits:
This data is sent to:
Both endpoints are declared in Result: Overall Security Rating: 🔴 High RiskJustification: TF005 toxic flow triggered (C01 curl|sh + H05 financial operations). Additionally: base64-encoded obfuscated key (C03), unpinned dependency installs (M01), plugin binary downloaded without checksum verification, and device fingerprinting telemetry. 6. Source Code Security (if source code is included)Source code is not included in the submission (only a source_repo reference and commit hash). The binary is pre-built and downloaded from GitHub releases. Language & Build Config
Dependency AnalysisCannot analyze — source code not included. The binary is downloaded from Code Safety Audit
Does SKILL.md accurately describe what the source code does?Cannot verify — source code not included. The SKILL.md documents command behavior, but the actual binary behavior cannot be audited without source. Verdict:
|
| Dimension | Score | Notes |
|---|---|---|
| Completeness (pre-flight, commands, error handling) | 18/25 | Good command documentation with parameters, examples, and troubleshooting table. Missing: no balance check before swap/add-liquidity, no security scan integration |
| Clarity (descriptions, no ambiguity) | 20/25 | Clear command descriptions, amount unit documentation, token symbol table. Minor: routing logic could be more explicit for multi-hop |
| Security Awareness (confirmations, slippage, limits) | 15/25 | Good: dry-run before execution, user confirmation required, 0.5% slippage default, data trust boundary. Bad: curl|sh install, no checksum on binary download, obfuscated key, no pre-swap security scan |
| Skill Routing (defers correctly, no overreach) | 10/15 | Correctly delegates all writes to onchainos. "Do NOT use for" section is clear. Could better integrate with okx-security for pre-swap token scanning |
| Formatting (markdown, tables, code blocks) | 9/10 | Well-structured with tables, code blocks, clear sections. Minor formatting inconsistencies |
Strengths
- Proper onchainos delegation: All on-chain writes go through
onchainos wallet contract-call— no self-implemented signing - User confirmation flow: Every write command has dry-run → confirm → execute pattern
- Data trust boundary: Explicitly declares all CLI output as untrusted external content
- Comprehensive command documentation: Clear parameters, examples, and error handling for all 7 commands
Issues Found
-
🔴 Critical: TF005 Toxic Flow —
curl | sh+ financial operations. The pre-flight section downloads and executes a remote script (curl -fsSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh), and the plugin performs financial operations (swaps, liquidity). Per security rules, this constitutes a complete attack chain. Must pin version and verify checksum before execution. -
🔴 Critical: Plugin binary downloaded without checksum verification. The binary install section downloads from
https://github.com/MigOKG/plugin-store/releases/with no SHA256 verification. A compromised binary could steal funds. The source org (MigOKG) differs from the declared author org (skylavis-sky). -
🔴 Critical: Base64-encoded obfuscated HMAC key (C03). The install report script contains
echo 'OE9nNWFRUFdfSVJkektrMExOV2RNeTIzV2JibXo3ZWNTbExJUDFIWnVoZw==' | base64 -d— an obfuscated key used for HMAC signing of device fingerprints. This evades static audit review. -
🟡 Important: Unpinned dependency installs (M01).
npx skills add okx/onchainos-skills --yes --globalandnpx skills add MigOKG/plugin-store --skill plugin-store --yes --globalhave no version pinning, enabling supply chain attacks. -
🟡 Important: Device fingerprinting telemetry. The install report script creates a device ID from
hostname:OS:arch:HOME, HMAC-signs it with the obfuscated key, and sends it to two external endpoints. While declared inapi_calls, this should be more transparent to users. -
🟡 Important: No pre-swap security scanning. Unlike the official okx-dex-swap skill, this plugin does not integrate with
onchainos security token-scanortx-scanbefore executing swaps. Users could swap into honeypot tokens. -
🟡 Important: No balance check before write operations. The plugin does not verify sufficient token balance before swap or add-liquidity, which could result in wasted gas on failed transactions.
-
🔵 Minor: Missing field-level output isolation (M08). While the trust boundary declaration is present, output commands (quote, get-price) don't enumerate specific safe fields for display.
-
🔵 Minor: The
--yes --globalflags onnpx skills addsuppress confirmation prompts, which could be surprising to users.
8. Recommendations
-
[CRITICAL] Remove
curl | shpattern: Replace with version-pinned installer download + SHA256 checksum verification before execution. Example:curl -fsSL "https://raw.githubusercontent.com/okx/onchainos-skills/v2.2.6/install.sh" -o /tmp/install.sh echo "<expected_sha256> /tmp/install.sh" | sha256sum -c sh /tmp/install.sh
-
[CRITICAL] Add checksum verification for plugin binary: Download checksums alongside the binary and verify before
chmod +x:curl -fsSL "https://github.com/.../quickswap-dex-${TARGET}.sha256" -o /tmp/quickswap-dex.sha256 sha256sum -c /tmp/quickswap-dex.sha256 -
[CRITICAL] Remove or replace obfuscated base64 key: The HMAC key should not be hardcoded and obfuscated in the install script. Either remove the HMAC signing entirely (use a simpler anonymous analytics approach) or document the key's purpose transparently.
-
[HIGH] Pin dependency versions: Change to
npx skills@x.y.z add okx/onchainos-skills@v2.2.6 --yes --globalwith specific versions. -
[HIGH] Add pre-swap security scanning: Integrate
onchainos security token-scanbefore swap execution, similar to the official okx-dex-swap skill. -
[HIGH] Add balance verification: Before swap and add-liquidity, check wallet balance via
onchainos wallet balanceoronchainos portfolio all-balances. -
[MEDIUM] Clarify binary provenance: The source repo is
skylavis-sky/onchainos-pluginsbut the binary is hosted underMigOKG/plugin-store. Document this relationship or host binaries from the same org. -
[MEDIUM] Make telemetry opt-in: Device fingerprinting should require explicit user consent, not be auto-injected.
9. Reviewer Summary
One-line verdict: Plugin correctly delegates all on-chain writes to onchainos CLI but has critical security issues in its install pipeline: curl | sh without pinning, binary download without checksum verification, and an obfuscated HMAC key — combined with financial operations, this triggers the TF005 toxic flow (CRITICAL).
Merge recommendation: 🔍 Needs changes before merge
The following items must be addressed:
- Remove or secure the
curl | shinstall pattern with version pinning and checksum verification - Add SHA256 checksum verification for the plugin binary download
- Remove the obfuscated base64-encoded HMAC key from the install script
- Pin all dependency install versions (
npx skills add ... @version) - Clarify the relationship between source repo org (
skylavis-sky) and binary host org (MigOKG)
Generated by Claude AI via Anthropic API — review the full report before approving.
Phase 4: Summary + Pre-flight for
|
| Command | Description |
|---|---|
quote |
Get expected swap output (read-only) |
swap |
Execute token swaps with confirmation |
add-liquidity |
Add liquidity to pools |
remove-liquidity |
Remove liquidity from pools |
get-pair |
Look up pair contract addresses |
get-price |
Get on-chain token prices |
get-reserves |
Get current pool reserves |
Triggers
Activate when users want to swap tokens on QuickSwap, manage liquidity positions, or query Polygon DEX prices. Trigger phrases include "swap on quickswap", "quickswap liquidity", "quickswap polygon", and "quickswap price".
Auto-injected Pre-flight
## Pre-flight Dependencies (auto-injected by Plugin Store CI)
> Run once per session before first use. These checks ensure required tools are installed.
### Install onchainos CLI + Skills (auto-injected)
```bash
# 1. Install onchainos CLI
onchainos --version 2>/dev/null || curl -fsSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh
# 2. Install onchainos skills (enables AI agent to use onchainos commands)
npx skills add okx/onchainos-skills --yes --global
# 3. Install plugin-store skills (enables plugin discovery and management)
npx skills add MigOKG/plugin-store --skill plugin-store --yes --globalInstall quickswap-dex binary (auto-injected)
if ! command -v quickswap-dex >/dev/null 2>&1; then
OS=$(uname -s | tr A-Z a-z)
ARCH=$(uname -m)
case "${OS}_${ARCH}" in
darwin_arm64) TARGET="aarch64-apple-darwin" ;;
darwin_x86_64) TARGET="x86_64-apple-darwin" ;;
linux_x86_64) TARGET="x86_64-unknown-linux-gnu" ;;
linux_aarch64) TARGET="aarch64-unknown-linux-gnu" ;;
esac
curl -fsSL "https://github.com/MigOKG/plugin-store/releases/download/plugins/quickswap-dex@0.1.0/quickswap-dex-${TARGET}" -o ~/.local/bin/quickswap-dex
chmod +x ~/.local/bin/quickswap-dex
fiReport install (auto-injected, runs once)
REPORT_FLAG="$HOME/.plugin-store/reported/quickswap-dex"
if [ ! -f "$REPORT_FLAG" ]; then
mkdir -p "$HOME/.plugin-store/reported"
# Device fingerprint → SHA256 → 32-char device ID
DEV_RAW="$(hostname):$(uname -s):$(uname -m):$HOME"
DEV_ID=$(echo -n "$DEV_RAW" | shasum -a 256 | head -c 32)
# HMAC signature (obfuscated key, same as CLI binary)
_K=$(echo 'OE9nNWFRUFdfSVJkektrMExOV2RNeTIzV2JibXo3ZWNTbExJUDFIWnVoZw==' | base64 -d 2>/dev/null || echo 'OE9nNWFRUFdfSVJkektrMExOV2RNeTIzV2JibXo3ZWNTbExJUDFIWnVoZw==' | openssl base64 -d)
HMAC_SIG=$(echo -n "${_K}${DEV_ID}" | shasum -a 256 | head -c 8)
DIV_ID="${DEV_ID}${HMAC_SIG}"
unset _K
# Report to Vercel stats
curl -s -X POST "https://plugin-store-dun.vercel.app/install" \
-H "Content-Type: application/json" \
-d '{"name":"quickswap-dex","version":"0.1.0"}' >/dev/null 2>&1 || true
# Report to OKX API (with HMAC-signed device token)
curl -s -X POST "https://www.okx.com/priapi/v1/wallet/plugins/download/report" \
-H "Content-Type: application/json" \
-d '{"pluginName":"quickswap-dex","divId":"'"$DIV_ID"'"}' >/dev/null 2>&1 || true
touch "$REPORT_FLAG"
fi
</details>
---
*Generated by Plugin Store CI after maintainer approval.*
✅ Phase 1: Structure Validation — PASSED→ Proceeding to Phase 2: Build Verification |
🔨 Phase 2: Build Verification — ❌ FAILED
Build failed. Check the workflow logs. Source integrity: commit SHA |
a8d1760 to
76de6d5
Compare
ed8ac5c to
032b740
Compare
New Plugin Submission: quickswap-dex v0.1.0
Plugin: Swap tokens and manage liquidity on QuickSwap (Polygon)
Author: skylavis-sky
Category: defi-protocol
Source