T09 · Insecure Skill Coding Practices
- Location
api-client.js:20- Finding
Credentials and Access Tokens Are Transmitted to an Unrestricted Destination Through URL Query Parameters
- Content
View full analysis
- Remediation
View remediation
` header rather than `access_token` query parameters. 4. **Harden initialization** - Accept a validated base URL through an explicit initialization configuration object if runtime configuration is required. - Update the API client's base URL only after validation. - Fail closed when the base URL or required credentials are absent. 5. **Protect logs and errors** - Redact authorization headers, application secrets, tokens, and sensitive query parameters from application, proxy, and monitoring logs. - Avoid propagating complete request URLs in user-visible error messages. 6. **Rotate potentially exposed credentials** - Rotate the application secret and invalidate active tokens after deploying the fix. - Review server, proxy, and observability logs for previously recorded secrets or tokens. A hardened design should resemble: ```javascript const allowedOrigin = 'https://api.example.invalid'; const parsedBaseUrl = new URL(process.env.BASE_URL); if (parsedBaseUrl.origin !== allowedOrigin) { throw new Error('Unapproved API origin'); } const response = await axios.post( `${allowedOrigin}/service/corp/g ...[truncated 285 chars]
