Review ID: c0f3c94a8102Generated: 2026-04-16T03:06:16.262Z
CHANGES REQUESTED
5
Total Findings
3
High
1
Medium
1
Low
36 of 108 Agents Deployed
DiamondPlatinumGoldSilverBronzeHR RoastyFree Baseline
Agent Tier: HR Roasty
evance1227/bestie-backend-v1 →
main @ 23788fc
AIAI Threat Analysis
REAL THREATS
Hardcoded Secrets & Credential Exposure
1 (CRITICAL): Hardcoded API key in test_commands.sh:5 - Direct secret exposure in source control.
15 (HIGH): Hardcoded database credentials in scripts/verify-prod.sh:1 - Production credentials in scripts.
17 (HIGH): API key passed via command line in test_commands.sh:13 - Secrets visible in process listings.
14 (HIGH): API key resolution via HTTP request in scripts/rowan_verify.sh:1 - Insecure credential transmission.
Insecure Session Management
4 (HIGH): Unauthorized mutation context variable never enforced in app/main.py:1035 - Missing authorization check allows privilege escalation.
8 (HIGH): Session cookie not invalidated on logout in app/public/feedback.py:110 - Session fixation risk.
Data Exposure & PII Leakage
13 (HIGH): Test user IDs in production test scripts (scripts/qa_render.sh:8) - PII in test code that may run in production.
24 (MEDIUM): Detailed error logging exposes user information in app/main.py:1354 - Information disclosure in logs.
36 (MEDIUM): Purchase data exposed in test output (scripts/qa_render.sh:47) - Sensitive financial data leakage.
37 (MEDIUM): Request IDs logged with user context (scripts/rowan_verify.sh:15) - Correlation of user activity.
Supply Chain & Dependency Risks
33 (MEDIUM): Deprecated dependency with known vulnerabilities in requirements.txt:32 - Potential exploit via library.
Data Retention & Audit Issues
18 (HIGH): No TTL on Redis debug data in worker.py:15 - Unbounded storage of potentially sensitive debug data.
38 (MEDIUM): No audit logging for sensitive data access in worker.py:13 - Lack of accountability for data access.
Missing Security Controls
16 (HIGH): Hardcoded database credentials in production script (scripts/verify-prod.sh:1) - Credential exposure risk.
ATTACK CHAINS
1. Credential Harvesting → Full System Compromise: Attackers finding hardcoded API keys (1, 17) or database credentials (15, 16) can directly access backend systems. Combined with missing audit logging (38), this provides stealthy persistence.
2. Session Hijacking → Privilege Escalation: The missing session invalidation (8) combined with the unauthorized mutation context (4) allows attackers to maintain access to elevated sessions and perform unauthorized operations.
3. PII Harvesting → Targeted Attacks: Exposed test user IDs (13) and purchase data (36) combined with request ID correlation (37) enables attackers to build detailed user profiles for social engineering or targeted attacks.
VERDICT
Critical Immediate Fixes Required:
1. Remove all hardcoded secrets (findings 1, 15, 16, 17) - Rotate exposed credentials immediately.
2. Implement proper authorization (4) - Add context validation before mutations.
3. Fix session management (8) - Implement proper session termination.
High Priority:
4. Secure credential transmission (14) - Use secure methods for API key resolution.
5. Implement data retention policies (18) - Add TTL to Redis debug data.
6. Remove PII from test scripts (13, 36, 37) - Use synthetic data in test environments.
Medium Priority:
7. Update vulnerable dependencies (33) - Patch or replace deprecated libraries.
8. Implement audit logging (38) - Log all sensitive data access.
9. Sanitize error messages (24) - Remove user PII from logs.
The most dangerous issues are the hardcoded credentials which provide direct attack vectors. The authorization bypass is particularly concerning as it could allow unauthorized data access even without credential theft.
5 raw scanner findings — 3 high · 1 medium · 1 low
Raw Scanner Output — 15 pre-cleanup findings
⚠ Pre-Cleanup Report
This is the raw, unprocessed output from all scanner agents before AI analysis. Do not use this to fix issues individually. Multiple agents attack from different angles and frequently report the same underlying vulnerability, resulting in significant duplication. Architectural issues also appear as many separate line-level findings when they require a single structural fix.

Use the Copy Fix Workflow button above to get the AI-cleaned workflow — it deduplicates findings, removes false positives, and provides actionable steps. This raw output is provided for transparency and audit purposes only.
HIGHUnauthorized Mutation Context Variable Never Enforced
[redacted]/main.py:1035
[AGENTS: Gatekeeper]auth
**Perspective 1:** The _AUTHORIZED_MUTATION ContextVar is defined but never actually checked or used to protect any mutation operations. This suggests a missing authorization guard that could allow unauthorized writes. **Perspective 2:** The _maybe_run_watchlist_worker function is called from require_api_key but the worker itself may not have proper authorization checks before processing watchlist operations.
Suggested Fix
Add actual authorization checks using _AUTHORIZED_MUTATION.get() before allowing sensitive mutations, or remove the unused variable.
HIGHSession cookie not invalidated on logout
[redacted]/feedback.py:110
[AGENTS: Deadbolt]sessions
No logout endpoint exists that clears the did_uuid cookie. Users cannot explicitly terminate their session, leaving them vulnerable if they share devices or lose access to their account.
Suggested Fix
Add /public/session/logout endpoint that sets did_uuid cookie to empty string with max_age=0 and SameSite=lax to force cookie deletion.
HIGHTest user IDs in production test scripts
[redacted]/qa_render.sh:8
[AGENTS: Warden]pii-exposure
QA script generates user_id='qa_user_$(date +%s)' and uses it across multiple API endpoints. Test user data flows through production endpoints without isolation, potentially mixing test and production data.
Suggested Fix
Use dedicated test database or sandbox environment for QA scripts. Never route test traffic through production endpoints.
HIGHAPI Key Resolution via HTTP Request
[redacted]/rowan_verify.sh:1
[AGENTS: Supply]supply_chain
Script resolves INTERNAL_API_KEY by making HTTP requests to backend endpoints. This creates attack surface for credential leakage and adds unnecessary network dependency.
Suggested Fix
Remove API key resolution logic. Use pre-configured secrets or service account tokens instead
HIGHUser IDs generated and stored in test scripts
[redacted]/rowan_verify.sh:10
[AGENTS: Warden]pii-exposure
Script generates UUID user_id and passes to production API endpoints. User identifiers flow through chat, decisions, vault, and budget endpoints without consent or privacy controls.
Suggested Fix
Use test-only user IDs that are never persisted to production database. Implement test data isolation layer.
HIGHHardcoded Database Credentials in Production Script
[redacted]/verify-prod.sh:1
[AGENTS: Supply]supply_chain
Script references DATABASE_URL and SUPABASE_DB_URL without environment variable enforcement. Credentials may be exposed in version control or logs.
Suggested Fix
Add strict env var check: [ -z "$DATABASE_URL" ] && { echo 'STOP: DATABASE_URL required'; exit 1; }
HIGHAPI Key Passed via Command Line
[redacted]/test_commands.sh:13
[AGENTS: Phantom]api_security
API key exposed in shell script command line arguments. Process list (ps aux) could reveal this key.
Suggested Fix
Use environment variable BESTIE_API_KEY instead of passing key as argument.
HIGHNo TTL on Redis debug data
[redacted]/worker.py:15
[AGENTS: Warden]data-retention
Redis keys 'bestie:debug:{id}' and 'bestie:render:{id}' have TTL set (86400s, 3600s respectively), but no TTL on 'bestie:state:{id}' which persists state machine data indefinitely. User decision state data accumulates without expiration.
Suggested Fix
Add TTL to bestie:state:{id} keys (e.g., 90 days) or implement cleanup job for stale state data
MEDIUMDetailed Error Logging Exposes User Information
[redacted]/main.py:1354
[AGENTS: Gatekeeper]auth
The _chat_receipt_and_error_middleware logs user_id and request_id in error logs. If these logs are accessible to attackers, they could enumerate valid user IDs or track request patterns.
Suggested Fix
Remove user_id and request_id from error logs, or mask them before logging.
MEDIUMDeprecated Dependency with Known Vulnerabilities
[redacted]/requirements.txt:32
[AGENTS: Supply]supply_chain
psycopg2-binary is deprecated and unmaintained. Should use psycopg[binary,pool] instead. Deprecated packages may have unpatched vulnerabilities.
Suggested Fix
Remove psycopg2-binary line, ensure psycopg[binary,pool] is properly specified
MEDIUMPurchase data exposed in test output
[redacted]/qa_render.sh:47
[AGENTS: Warden]data-exposure
Test script outputs purchase_id and decision_id in plain text. These identifiers could be used to reconstruct user purchase history if accessed by unauthorized parties.
Suggested Fix
Mask or hash identifiers in test output. Use test-only data that cannot be correlated to real users.
MEDIUMRequest IDs logged with user context
[redacted]/rowan_verify.sh:15
[AGENTS: Warden]pii-exposure
X-Request-ID headers are logged alongside user_id in test verification. Request IDs could be correlated with user activity for tracking purposes.
Suggested Fix
Separate request ID logging from user context. Implement PII masking in logs.
MEDIUMNo audit logging for sensitive data access
[redacted]/worker.py:13
[AGENTS: Warden]audit-logging
Database connections via DATABASE_URL/SUPABASE_DB_URL with no audit trail for sensitive user data queries. User decision_items, decision_events, and post_purchase_feedback access is not logged.
Suggested Fix
Implement audit logging middleware that logs all queries accessing user_id, decision_item_id, or post_purchase_feedback tables
LOWNo data classification on test data
[redacted]/qa_render.sh:1
[AGENTS: Warden]data-classification
Test scripts do not classify data as TEST or PRODUCTION. Risk of test data being treated as production data or vice versa.
Suggested Fix
Add data classification headers and environment isolation markers.
CRITICALHardcoded API Key in Shell Script
[redacted]/test_commands.sh:5
[AGENTS: Phantom]api_security
API key exposed as environment variable in version-controlled shell script. If committed to repository, this key can be extracted by attackers.
Suggested Fix
Remove hardcoded key from test_commands.sh. Use environment variable injection at runtime only.

Summary

Consensus from 72 reviewer(s): Chaos, Razor, Pedant, Specter, Blacklist, Syringe, Sentinel, Vault, Gatekeeper, Sanitizer, Passkey, Deadbolt, Cipher, Entropy, Warden, Compliance, Phantom, Lockdown, Gateway, Siege, Tripwire, Trace, Harbor, Infiltrator, Supply, Vector, Prompt, Recon, Fuse, Provenance, Wallet, Mirage, Exploit, Weights, Tenant, Egress, Sentinel, Pedant, Specter, Chaos, Razor, Sanitizer, Blacklist, Syringe, Gatekeeper, Vault, Passkey, Deadbolt, Cipher, Compliance, Warden, Siege, Phantom, Lockdown, Entropy, Gateway, Trace, Supply, Harbor, Infiltrator, Tripwire, Fuse, Recon, Vector, Prompt, Provenance, Wallet, Mirage, Weights, Tenant, Exploit, Egress Total findings: 43 Severity breakdown: 2 critical, 18 high, 21 medium, 2 low

Note: Fixing issues can create a domino effect — resolving one finding often surfaces new ones that were previously hidden. Multiple scan-and-fix cycles may be needed until you’re satisfied no further issues remain. How deep you go is your call.