fix: EA-1 refuse authorize of an already-recorded key (v0.1.3)
authorize never checked the target fingerprint against existing docs before save()'s upsert-by-_id, so authorizing the local machine's own public key under a new friendly name silently replaced the local authorizer record (can_authorize demoted to False) while printing a success banner. With a sole authorizer this bricks the CLI: authorize refuses (not permitted), init refuses (already initialized), and revoke of the local key refuses (refusing to revoke the local key) -- no in-CLI recovery. Mirror revoke's local-key guard and extend it to any existing _id, so a duplicate target is refused with a clear message instead of silently replacing the record. Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
@@ -13,26 +13,26 @@ authorization system and the key-document schema; the crypto primitives live in
|
||||
## Install
|
||||
|
||||
```
|
||||
envelope_authorizer @ git+ssh://git@git.rethinkstudios.io/rethink-public/envelope_authorizer.git@v0.1.2
|
||||
envelope_authorizer @ git+ssh://git@git.rethinkstudios.io/rethink-public/envelope_authorizer.git@v0.1.3
|
||||
```
|
||||
|
||||
Direct:
|
||||
|
||||
```bash
|
||||
pip install "envelope_authorizer @ git+ssh://git@git.rethinkstudios.io/rethink-public/envelope_authorizer.git@v0.1.2"
|
||||
pip install "envelope_authorizer @ git+ssh://git@git.rethinkstudios.io/rethink-public/envelope_authorizer.git@v0.1.3"
|
||||
```
|
||||
|
||||
The base install uses a local JSON file for storage (stdlib only). For shared
|
||||
dev→server storage, install the mongo extra:
|
||||
|
||||
```bash
|
||||
pip install "envelope_authorizer[mongo] @ git+ssh://git@git.rethinkstudios.io/rethink-public/envelope_authorizer.git@v0.1.2"
|
||||
pip install "envelope_authorizer[mongo] @ git+ssh://git@git.rethinkstudios.io/rethink-public/envelope_authorizer.git@v0.1.3"
|
||||
```
|
||||
|
||||
Installing pulls `envelope_crypto` (and `mongo` with the extra). After install,
|
||||
the `authorizer` command is on your PATH; `python -m envelope_authorizer` also works.
|
||||
|
||||
Drop the `@v0.1.2` suffix from the line above to install the latest unpinned.
|
||||
Drop the `@v0.1.3` suffix from the line above to install the latest unpinned.
|
||||
|
||||
## Trust model (read this)
|
||||
|
||||
@@ -129,7 +129,11 @@ initialized or the friendly name is taken.
|
||||
Boots the local DEK, verifies the local key is itself an authorizer, then wraps
|
||||
the same DEK to the target public key and stores a new key doc. Omit
|
||||
`--can-authorize` for servers (`allowed: False`); pass it only for trusted
|
||||
dev/home machines.
|
||||
dev/home machines. Refuses a target key whose fingerprint already has a record
|
||||
(most importantly the local key itself) — `save` upserts by `_id`, so
|
||||
authorizing an already-known key would silently replace its existing doc
|
||||
(capability flag and friendly name) under a success banner instead of adding a
|
||||
new key. Revoke the existing record first if you intend to re-authorize it.
|
||||
|
||||
```
|
||||
[✔] Authorized Jy7k2ey7... | friendly: server1 [can_authorize=False]
|
||||
|
||||
Reference in New Issue
Block a user