lux icon indicating copy to clipboard operation
lux copied to clipboard

feat: proxy password security - encryption at rest and elevation-gated peek

Open miguelAngelo1999 opened this issue 6 months ago • 1 comments

Summary

This PR adds two layers of security for proxy passwords in Lux.

1. Encryption at rest (lux_core)

Proxy passwords in config.json are now encrypted using AES-GCM with a machine-derived key (Windows MachineGuid + SHA-256). The core decrypts on read and encrypts on write transparently — existing connections are unaffected.

The GET /proxies list endpoint now strips passwords from the response, so the web dashboard can no longer expose them.

2. Elevation-gated password peek (Flutter)

A new Show Password option is added to each proxy action menu. Clicking it:

  • On a newly created proxy (same session): shows the password immediately, once
  • On an existing proxy: prompts for the user Windows login password via LogonUser API

The password is fetched via a new GET /proxies/{id} endpoint which returns the decrypted password.

Flutter changes

  • lib/const/const.dart - add peekPassword to ProxyItemAction enum
  • lib/core/core_config.dart - add ProxyDetail model
  • lib/core/core_manager.dart - add getProxyDetail(), increase ping timeout 15s to 30s
  • lib/widget/proxy_item_action_menu.dart - add Show Password menu item
  • lib/widget/app_body.dart - handle peekPassword action
  • lib/widget/password_peek_dialog.dart - new: credential dialog + password reveal UI
  • lib/util/elevation_helper.dart - new: Windows LogonUser credential verification
  • lib/util/config_encryptor.dart - new: helper to read proxy password from config
  • lib/l10n/ - new i18n strings (en + zh)
  • windows/CMakeLists.txt - add cppwinrt/ATL paths for ARM64 build compatibility

lux_core changes (igoogolx/itun2socks - companion PR needed)

  • internal/configuration/crypto.go - new: AES-GCM encrypt/decrypt
  • internal/configuration/file.go - encrypt on Write(), decrypt on Read()
  • api/routes/proxy.go - add GET /{proxyId} endpoint, strip passwords from list

Notes

  • Requires companion PR to igoogolx/itun2socks for the core changes
  • windows/CMakeLists.txt change only affects ARM64 host builds, no-op on x64
  • checksum.dart updated for the patched lux_core binary

miguelAngelo1999 avatar May 27 '26 21:05 miguelAngelo1999

can you share a test build so that I can see if it works well?

JeromeNelsonC avatar May 28 '26 13:05 JeromeNelsonC