T09 · Insecure Skill Coding Practices
- Location
engine/router.ts:16- Finding
Unverified Mock Data Presented as Actionable Shopping Advice
- Content
View full analysis
Vulnerability Details
File Location:
engine/router.ts, lines 16-63
Vulnerability Type: Unverified fixed data presented as current pricing and purchasing intelligence
Risk Level: MediumCode Evidence
typescript export async function runDecisionEngine( request: ShoppingRequest ): Promise<DecisionReport> { const platforms: Platform[] = request.platforms || ["taobao", "pdd", "jd", "yhd", "vip"]; return buildMockReport(request, platforms); } function buildMockReport(request: ShoppingRequest, platforms: Platform[]): DecisionReport { const product = request.product || "Unknown product"; return { recommendedPlatform: "pdd", recommendedPrice: 89,typescript timingAdvice: { verdict: "buy_now", }, comparison: platforms.map((p) => ({ platform: p, price: p === "pdd" ? 89 : p === "jd" ? 109 : p === "taobao" ? 95 : p === "yhd" ? 92 : 88, quality: p === "jd" ? "high" : p === "taobao" ? "medium" : "medium", shipping: p === "jd" ? "fast" : p === "yhd" ? "fast" : p === "pdd" ? "slow" : "medium", afterSales: p === "jd" ? "strong" : p === "taobao" ? "medium" : "weak", authenticity: p === "jd" ? "safe" : p === "pdd" ? "risky" : "medium", score: p === "pdd" ? 85 : p === "jd" ? 82 : p === "taobao" ? 75 : 70, })),The resulting data is formatted as an ordinary recommendation without a mock-data warning:
javascript export function formatReport(report) { let out = ""; if (report.recommendedPrice) out += `Reference price: ¥${report.recommendedPrice}\n`; report.reasons.forEach((r) => (out += `- ${r}\n`)); out += `${report.timingAdvice.reason}\n`; report.alternatives.forEach((a) => { out += `- **${a.platform}** (${a.score}) ${a.price ? `¥${a.price}` : ""}: ${a.keyReason}\n`; }); return out; }Technical Analysis
The decision engine does not query any platform adapter, retrieve current prices, inspect sellers, or obtain historical pricing data. Instead, every request ...[truncated 2207 chars]
- Remediation
View remediation
Remediation Suggestions
- Prevent the Skill from issuing actionable purchase recommendations until verified platform data is available.
- Add a prominent runtime warning to every stub report stating that all prices, scores, promotions, seller assessments, and timing advice are synthetic test data.
- Remove claims about current prices, official subsidies, historical lows, authenticity, and seller protections unless they are supported by retrieved evidence.
- Query actual platform adapters and include the source platform, retrieval timestamp, seller identity, and product URL for every recommendation.
- Enforce the caller's platform allowlist. The recommended platform must be selected only from
request.platforms. - Validate and apply budget, quantity, priorities, urgency, scenario,
mustHave, andmustAvoidconstraints before constructing a recommendation. - Return
compare_firstor an explicit insufficient-data result when live data cannot be obtained. - Separate mock and production modes through an explicit configuration flag, and prevent production deployments from enabling mock recommendations.
- Add tests confirming that:
- Excluded platforms cannot be recommended.
- Prices are not emitted without a verified source.
- Stub output always contains a clear warning.
- Unsupported historical-price claims are rejected.
- User constraints materially affect the result.
