T09 · Insecure Skill Coding Practices
- Location
clawflight.js:46- Finding
OAuth Bearer Token Stored in a Plaintext File Without Restrictive Permissions
- Content
View full analysis
Date.now() + 60000) { return cached.access_token; } } catch (e) { /* ignore */ } } // Fetch new token const response = await axios.post( `${AMADEUS_BASE_URL}/v1/security/oauth2/token`, new URLSearchParams({ grant_type: 'client_credentials', client_id: AMADEUS_CLIENT_ID, client_secret: AMADEUS_CLIENT_SECRET, }), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } } ); const token = { access_token: response.data.access_token, expires_at: Date.now() + (response.data.expires_in * 1000), }; writeFileSync(TOKEN_CACHE_FILE, JSON.stringify(token)); return token.access_token; } ``` The cache path is defined at line 27: ```js const TOKEN_CACHE_FILE = join(PROJECT_ROOT, 'data', '.amadeus-token.json'); ``` ### Technical Analysis After obtaining an OAuth access token from the fixed, official Amadeus HTTPS endpoint, the application stores the bearer token as plaintext JSON in the project-level `data` directory. The call to `writeFileSync` does not specify a restrictive file mode. For a newly created file, effective permissions therefore depend on the process umask and surrounding directory permissions. In a shared or incorrectly configured environment, other local accounts or processes may be able to read the token. A bearer token grants access based solely on possession. Any process that retrieves the cached value can replay it against the Amadeus API until it expires. Although caching reduces authentication requests, persistent token storag ...[truncated 2204 chars]- Remediation
View remediation
