rmi-backend/app/routers
opencode 1171a35d9f
Some checks failed
CI / build (pull_request) Failing after 2s
fix(rmi-backend): drop passlib — route backup codes through direct bcrypt
The reported symptom (AttributeError: module 'bcrypt' has no attribute
'__about__') was misleading. passlib 1.7.4 (the latest released version
— the project is unmaintained) actually traps that AttributeError with
a bare `except:` and continues. The real failure occurs later in
`passlib.handlers.bcrypt._finalize_backend_mixin`:

  detect_wrap_bug -> verify(secret, bug_hash)
    where secret = (b"0123456789"*26)[:255]   # 255-byte test secret

bcrypt 4.0+ removed silent 72-byte truncation and now raises
`ValueError: password cannot be longer than 72 bytes`, breaking the
backend probe and crashing every `pwd_context.hash()/verify()` call.

Three options were considered:

  A. Upgrade passlib — impossible, 1.7.4 is the latest PyPI release.
  B. Pin bcrypt<4.0  — conflicts with chromadb 1.1.1 (>=4.0.1 required),
     even though chromadb's bcrypt usage is optional and still works
     at runtime in practice.
  C. Shim bcrypt.__about__ — doesn't fix the actual truncation error.

Chosen: refactor app/auth.py to use bcrypt directly for backup-code
hashing too (the main `hash_password`/`verify_password` already did).
Drops the passlib dependency entirely, restoring bcrypt 5.x for chromadb
compatibility and eliminating the unmaintained passlib pin.

Verified:
  * hash_password / verify_password round-trip OK
  * _hash_backup_code / _verify_backup_code round-trip OK on
    freshly generated 8-digit backup codes
  * `pytest tests/unit` -> 717 passed, 32 warnings, 60 subtests passed
2026-07-06 16:17:47 +02:00
..
_expanded_aliases.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
_expanded_tools.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
ab_testing.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
address_profiler.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
admin_backend.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
admin_control.py merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
admin_extensions.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
admin_users_api.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
agents.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
ai_stream.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
airdrop_scanner.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
alchemy_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
alert_pipeline.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
alerts.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
analytics.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
api_versioning.py merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
arbitrage.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
auth_extensions.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
auto_healing.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
billing.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
bubble_maps_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
bulletin.py fix(rmi-backend): drop passlib — route backup codes through direct bcrypt 2026-07-06 16:17:47 +02:00
bulletin_board.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
cases_investigators_api.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
chain_comparability.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
chat.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
community_badges.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
community_forensics.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
contract_analyzer.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
criminal_clusters.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
cross_token_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
darkroom_airdrop.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
darkroom_multichain.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
darkroom_tokens.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
databus_extras.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
databus_gateway.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
death_clock.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
dev_portal.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
developer_tier.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
dify_tools.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
discovery_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
email_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
etherscan_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
facilitator_health.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
forensics_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
honeypot_map.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
human_catalog.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
impersonation_detector.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
intelligence_panel.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
intelligence_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
label_lookup.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
laundry_matcher.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
liquidity_watchdog.py merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
lp_health.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
market_intel_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
mbal_market.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
mcp_local_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
mcp_proxy.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
mcp_server.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
mev_advisory.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
mev_sniper.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
moderation.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
moralis_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
news.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
nft_detector.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
ollama_api.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
persistent_state.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
prediction_market_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
prediction_monitor.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
profile_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
protection.py merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
rebalance_bot.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
rug_recovery.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
rugcharts.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
scam_school.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
security_intel.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
sentiment.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
smart_calls.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
social_seed.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
status_page.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
stripe_integration.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
subscription_pricing_api.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
supabase_auth_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
supabase_oauth_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
supabase_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
tiers.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
token_cv.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
tool_changelog.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
tvl_verifier.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
unified_scanner_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
unified_wallet_scanner.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
vision_analysis.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
wallet_clustering_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
wallet_factory_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
wallet_manager_v2.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
webhook_pipeline.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
webhooks_router.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
whale_alerts.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_advanced_tools.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_alpha_revenue_tools.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_alpha_tools.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_analytics.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_bridge_health.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_catalog.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_contract_upgrade_monitor.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_cross_chain_whale.py merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
x402_dashboard.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_databus_fallback.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_databus_tools.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_deployer_history.py merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
x402_dex_pool_manipulation.py merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
x402_docs.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_docs_v2.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_enforcement.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_enrichment.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_forensic_tools.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_growth.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_insider_network.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_institutional_tools.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_launch_fairness.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_mcp_handler.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_middleware.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_premium_tools.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_settle_api.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_token_watch.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
x402_tools.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00