Hardcoded API Keys (Lines 71-75)
Author: nitish-yaddalaCreated Nov 6, 2024Updated Nov 6, 2024
https://github.com/jofpin/trape/blob/6baae245691997742a51979767254d7da580eadd/core/trape.py#L71
Security Concern: Hardcoded API keys (like gmaps and googl) pose a potential security risk, especially in public repositories.
Suggestion: Remove the hardcoded keys and use environment variables as a secure alternative. This change will make the code safer and prevent accidental exposure of sensitive information.
Code Suggestion:
self.gmaps = config_trape.get('gmaps_api_key', os.getenv("GMAPS_API_KEY", ""))
self.googl = config_trape.get('gshortener_api_key', os.getenv("GOOGL_API_KEY", ""))Benefit: Using environment variables avoids the exposure of sensitive keys in the codebase and allows better configuration management across different environments.
Source: jofpin/trape