liseur-sync/internal/admin
Chmouel Boudjnah 0b35367200
Some checks are pending
build / binary (push) Waiting to run
build / container (push) Waiting to run
test / test (push) Waiting to run
test / lint-openapi (push) Waiting to run
fix: Store pairing codes as hash of MD5-derived key clients send
KOReader and Readest kosync clients never transmit the raw pairing
code: they compute `md5(password)` locally and send that digest as
both the registration password and the `x-auth-key` credential on
every subsequent request. The adapter was hashing the raw code for
storage and then hashing `md5(code)` for the device slot key, so
redemption could never match what a real client actually sent,
causing every pairing attempt to return 403.

- Introduced `KosyncUserKey` (MD5 derivation) and `KosyncPairingHash`
  (SHA-256 of the derived key) in the auth package so pairing codes
  are stored under the hash of what the client will actually present
- Removed the server-side `md5hex` helper that re-derived the key
  after registration; the received value is already the derived key
- Normalized the received key to lowercase before hashing to match
  canonical hex encoding
- Updated all pairing code creation sites (admin CLI, web UI,
  self-service) to use `KosyncPairingHash`
- Added `TestClientSendsMD5DerivedKeyNotTheCode` regression test
  verifying that the raw code is rejected and the derived key works
- Updated tests to send the derived key on the wire, matching real
  client behavior

Signed-off-by: Chmouel Boudjnah <chmouel@chmouel.com>
2026-08-29 09:54:01 +02:00
..
admin.go fix: Store pairing codes as hash of MD5-derived key clients send 2026-08-29 09:54:01 +02:00
admin_test.go fix(cli): Tell operators about the commands that exist 2026-08-15 20:21:53 +02:00
adminrole_test.go feat: Add web administration panel with account-level roles 2026-08-15 20:22:05 +02:00
folders.go feat: scope catalog access to explicit per-user folder grants 2026-08-22 10:43:41 +02:00
folders_test.go feat: scope catalog access to explicit per-user folder grants 2026-08-22 10:43:41 +02:00
tty.go feat: Implement initial reading position sync server backend 2026-08-10 16:19:12 +02:00
users.go feat: Add web administration panel with account-level roles 2026-08-15 20:22:05 +02:00