T09 · Insecure Skill Coding Practices
- Location
scripts/setup.js:18- Finding
Bearer API Credentials Can Be Transmitted over Plaintext HTTP
- Content
View full analysis
{ const url = new URL(apiUrl + '/integrations/me'); const isHttps = url.protocol === 'https:'; const lib = isHttps ? https : http; const options = { hostname: url.hostname, port: url.port || (isHttps ? 443 : 80), path: url.pathname, method: 'GET', headers: { 'Authorization': `Bearer ${apiKey}`, 'User-Agent': 'OurProject-OpenClaw-Skill/1.0' }, }; ``` ```js // API URL const apiUrl = await ask(`API URL [${DEFAULT_API_URL}]: `); const finalApiUrl = apiUrl.trim() || (existingConfig?.apiBaseUrl || DEFAULT_API_URL); // API Key const apiKey = await ask('API Key (starts with op_): '); if (!apiKey.trim()) { console.error('❌ API key is required. Get one from Integrations → API Keys.'); rl.close(); process.exit(1); } if (!apiKey.trim().startsWith('op_')) { console.error('❌ Invalid API key format. Must start with "op_"'); rl.close(); process.exit(1); } // Test connection console.log('\n🔍 Testing connection...'); try { const result = await testApiKey(finalApiUrl, apiKey.trim()); ``` ```js function makeRequest(method, endpoint, body = null) { const config = loadConfig(); return new Promise((resolve, reject) => { const baseUrl = config.apiBaseUrl || 'https://api.ourproject.app/api'; // Normalize: if endpoint already has /api/ prefix, strip it since baseUrl already includes /api const normalizedEndpoint = endpoint.startsWith('/api/') ? endpoint.slice(4) : endpoint; const fullEndpoint = normalizedEndpoint.startsWith('/') ? normalizedEndpoi ...[truncated 2716 chars]- Remediation
View remediation
