C4: the vault keeps the forge token with the scopes it was minted with
The file beside the token that kept its scopes went with C4, and with it the re-mint of a token carrying a scope beyond the tools' (write:admin). The value written through own-put now holds the token and its scopes; a token minted with other scopes, or a value naming none, is minted again unasked and the one it replaces deleted at the forge. The Go bundles read the token out of that value. The lost test is back as a row of the scope test in test/token.test.ts. Builds: design 47 H2 §808; H-A-439
This commit is contained in:
@@ -32,7 +32,9 @@ func vaultHolding(t *testing.T, account, token string) *forgehttp.VaultToken {
|
||||
if token == "" {
|
||||
return nil, fmt.Errorf("the vault holds no secret named %s", a["name"])
|
||||
}
|
||||
box, err := seal.Seal(token, a["public_key"].(string))
|
||||
// The value the minter writes: the token and the scopes it was minted with (H-A-439).
|
||||
value, _ := json.Marshal(map[string]any{"token": token, "scopes": []string{"write:repository", "write:issue", "read:user", "read:package"}})
|
||||
box, err := seal.Seal(string(value), a["public_key"].(string))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -216,7 +216,9 @@ func vaultHolding(t *testing.T, account string, held map[string]string) *forgeht
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("the vault holds no secret named %s", a["name"])
|
||||
}
|
||||
box, err := seal.Seal(token, a["public_key"].(string))
|
||||
// The value the minter writes: the token and the scopes it was minted with (H-A-439).
|
||||
value, _ := json.Marshal(map[string]any{"token": token, "scopes": []string{"write:repository", "write:issue", "read:user", "read:package"}})
|
||||
box, err := seal.Seal(string(value), a["public_key"].(string))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -143,7 +143,9 @@ func (p *player) handle(m wire) {
|
||||
p.answer(m.ID, nil, errors.New("the vault holds no secret named "+q.Name))
|
||||
break
|
||||
}
|
||||
box, err := seal.Seal(token, q.PublicKey)
|
||||
// The value the minter writes: the token and the scopes it was minted with (H-A-439).
|
||||
value, _ := json.Marshal(map[string]any{"token": token, "scopes": []string{"write:repository", "write:issue", "read:user", "read:package"}})
|
||||
box, err := seal.Seal(string(value), q.PublicKey)
|
||||
p.answer(m.ID, map[string]any{"name": q.Name, "generation": 1, "sealed": box}, err)
|
||||
case m.Method == "mesh/seat.publish":
|
||||
p.answer(m.ID, map[string]any{}, p.nc.Publish(a.Subject, a.Body))
|
||||
|
||||
Reference in New Issue
Block a user