T09 · Insecure Skill Coding Practices
Error
- Location
- lib/wallet.ts:23
- Finding
- Hard-Coded Oracle API Credential<![CDATA[ ## Vulnerability Details **File Location**: `lib/wallet.ts:23-34` **Vulnerability Type**: Hard-coded secret **Risk Level**: High ### Vulnerable Code ```ts const providers = createNodeProviders({ network: config.network, dataDir: config.walletDataDir, tokensDir: config.walletTokensDir, oracle: { trustBasePath, apiKey: process.env.UNICITY_API_KEY ?? 'sk_06365a9c44654841a366068bcfc68986', }, transport: { debug: true, }, }); ``` ### Technical Analysis The source code embeds a live-looking API credential as the default value when `UNICITY_API_KEY` is not configured. Any person who can download or inspect the project can recover and reuse this credential independently of the skill. Because all installations fall back to the same key, activity cannot be reliably attributed to an individual installation. Rotation is also difficult because revoking the shared key can disrupt every deployment that relies on the fallback. ### Attack Path 1. An attacker downloads or otherwise obtains the project source. 2. The attacker inspects `lib/wallet.ts` and copies the embedded API key. 3. The attacker identifies the oracle service used by the Sphere SDK. 4. The attacker submits requests directly to that service using the exposed credential. 5. The attacker consumes shared quota or exercises any service privileges assigned to that key. ### Impact Assessment The exposed credential may permit unauthorized use of the associated oracle service, consumption of shared quota, disruption through quota exhaustion, and loss of request attribution. The exact privilege scope depends on the server-side permissions assigned to the key; the audited source does not establish that it grants broader system access. ]]>
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke and rotate the exposed credential immediately. 2. Remove the hard-coded fallback and fail closed when `UNICITY_API_KEY` is absent. 3. Provision a unique, narrowly scoped credential for each user or deployment. 4. Store credentials in a secret manager or protected runtime environment rather than source control. 5. Apply service-side rate limits, least-privilege scopes, expiration, and usage monitoring. 6. Review historical activity associated with the exposed key for unauthorized access. 7. Add automated secret scanning to version-control and release pipelines. ]]>
