T09 · Insecure Skill Coding Practices
- Location
search.py:12- Finding
API Credential Exposed in Request URLs
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is a straightforward LegiScan bill-search helper, with a real but limited API-key handling risk.
Before installing, use a dedicated revocable LegiScan API key, avoid logging request URLs, and be aware that your configured key, state, and search keywords are sent to LegiScan. Scheduling it with cron is a user choice and should be done only at a frequency compatible with your API quota.
search.py:12API Credential Exposed in Request URLs
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
query_param = f'"{q}"' if ' ' in q and not q.startswith('"') else q
url = f"https://api.legiscan.com/?key={api_key}&op=getSearch&state={state}&query={query_param}"
try:
response = requests.get(url).json()
if response.get('status') == 'OK':
search_results = response.get('searchresult', {})
for key, bill in search_results.items():
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
def get_bill_details(api_key, bill_id):
url = f"https://api.legiscan.com/?key={api_key}&op=getBill&id={bill_id}"
try:
res = requests.get(url).json()
if res.get('status') == 'OK':
return res.get('bill')
except Exception as e:
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
for q in queries:
# Ensure query is properly quoted if it contains spaces
query_param = f'"{q}"' if ' ' in q and not q.startswith('"') else q
url = f"https://api.legiscan.com/?key={api_key}&op=getSearch&state={state}&query={query_param}"
try:
response = requests.get(url).json()
if response.get('status') == 'OK':
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
for q in queries:
# Ensure query is properly quoted if it contains spaces
query_param = f'"{q}"' if ' ' in q and not q.startswith('"') else q
url = f"https://api.legiscan.com/?key={api_key}&op=getSearch&state={state}&query={query_param}"
try:
response = requests.get(url).json()
if response.get('status') == 'OK':
No suspicious patterns detected.