T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:10
- Finding
- Unpinned Third-Party SDK Receives API Credentials and User Data<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 10-34 **Vulnerability Type**: Supply-chain risk and excessive trust in a mutable dependency **Risk Level**: Medium ### Evidence ```bash npm install @ainative/next-sdk ``` ```typescript // app/api/chat/route.ts import { createServerClient } from '@ainative/next-sdk/server'; export async function POST(request: Request) { const { messages } = await request.json(); const client = createServerClient({ apiKey: process.env.AINATIVE_API_KEY!, }); // Non-streaming const result = await client.chat.completions.create({ model: 'claude-3-5-sonnet-20241022', messages, max_tokens: 1024, }); return Response.json(result); } ``` ### Technical Analysis The installation command does not pin an exact package version, even though the Skill metadata identifies version `1.0.1`. Consequently, a user following the instructions may install a later, unreviewed release. The imported package runs in the server environment and is explicitly entrusted with `AINATIVE_API_KEY` and client-supplied chat messages. The audited artifact does not contain the package implementation, a dependency lockfile, an integrity hash, an authoritative repository URL, or documentation identifying the network destination and data-handling policy. Therefore, the package's treatment of credentials and message content cannot be verified from this project. Sending an API credential and chat messages to a hosted AI provider is consistent with the declared functionality. The security issue is the combination of sensitive access with a mutable and unaudited dependency, which unnecessarily broadens the supply-chain trust boundary. ### Attack Path 1. An attacker compromises the npm package, its maintainer account, or a future package release. 2. A developer follows the unpinned `npm install @ainative/next-sdk` instruction. 3. npm resolves and installs the compromised release rather than the documented version. ...[truncated 702 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin the reviewed package version explicitly: ```bash npm install --save-exact @ainative/next-sdk@1.0.1 ``` 2. Commit and enforce a package-manager lockfile in CI and production. 3. Verify npm provenance, package signatures where available, and registry integrity metadata. 4. Document the authoritative source repository, publisher identity, network endpoint, privacy policy, and categories of data sent externally. 5. Audit package source and lifecycle scripts before deployment and after every upgrade. 6. Run the application with minimal environment variables, filesystem permissions, and outbound network access. 7. Restrict outbound traffic to documented provider endpoints where deployment infrastructure supports egress filtering. 8. Rotate the API key immediately if package compromise or unexpected outbound traffic is suspected. ]]>
