C4: the forge module's tokens live in the vault, one process mints at a time
Two processes that minted at once left the forge two tokens by one name, and a token kept in a file in the runtime state is a plain state. Both accounts' tokens (mesh-tools, mesh-packages) are now the module's own secrets in the vault, written through the seat mesh-vault's own-put and read through its get, sealed to the reading process's key. A refused or expired (token-ttl) token is minted again only by the holder of the lease mint in the state token-lease (mint-lease); each mint is named <account>-<generation>, and the token it replaces is deleted by id only after own-put landed. The Go bundles read their tokens through get at start and at secret-changed; the MESH_GITEA_*_TOKEN_FILE words go. forge_token_lease reads the lease and each token's age, never the token. Builds: design 47 H2 §808, §822; H-A-407, H-A-422, H-A-426, H-A-430 (1)
This commit is contained in:
@@ -245,6 +245,20 @@
|
||||
"trusted": false,
|
||||
"runtime": true,
|
||||
"default": "10m"
|
||||
},
|
||||
"token-ttl": {
|
||||
"type": "string",
|
||||
"description": "How old the forge module's token of an account may grow, as a duration such as 24h (design 47 H2 \u00a7808): a token the vault has kept longer than this, by its changed-at, is minted again, one process at a time, and the one it replaces is deleted at the forge.",
|
||||
"trusted": false,
|
||||
"runtime": true,
|
||||
"default": "24h"
|
||||
},
|
||||
"mint-lease": {
|
||||
"type": "string",
|
||||
"description": "How long one process of the forge module may hold the lease to mint a token, as a duration such as 60s (design 47 H2 \u00a7808): the lease key mint in the state token-lease lives this long, so a process that died holding it is replaced after it, and a process that finds it taken waits at most this long.",
|
||||
"trusted": false,
|
||||
"runtime": true,
|
||||
"default": "60s"
|
||||
}
|
||||
},
|
||||
"facts": {
|
||||
@@ -527,9 +541,7 @@
|
||||
"env": {
|
||||
"MESH_GITEA_URL": "http://127.0.0.1:${port:3000}",
|
||||
"MESH_GITEA_TOOLS_USER": "mesh-tools",
|
||||
"MESH_GITEA_TOKEN_FILE": "${dir:runtime-state}/token",
|
||||
"MESH_GITEA_PACKAGES_USER": "mesh-packages",
|
||||
"MESH_GITEA_PACKAGES_TOKEN_FILE": "${dir:runtime-state}/packages-token",
|
||||
"MESH_NPM_OWNER": "novox"
|
||||
}
|
||||
},
|
||||
@@ -546,7 +558,6 @@
|
||||
"env": {
|
||||
"MESH_GITEA_URL": "http://127.0.0.1:${port:3000}",
|
||||
"MESH_GITEA_TOOLS_USER": "mesh-tools",
|
||||
"MESH_GITEA_TOKEN_FILE": "${dir:runtime-state}/token",
|
||||
"MESH_GITEA_PATCH_DIR": "${dir:forge-patches}"
|
||||
}
|
||||
},
|
||||
@@ -664,6 +675,11 @@
|
||||
"name": "taken",
|
||||
"key-ttl": true,
|
||||
"max-mib": 8
|
||||
},
|
||||
{
|
||||
"name": "token-lease",
|
||||
"key-ttl": true,
|
||||
"max-mib": 1
|
||||
}
|
||||
],
|
||||
"reads": [
|
||||
@@ -678,7 +694,9 @@
|
||||
"seat:mesh-catalog.revision",
|
||||
"seat:mesh-catalog.registrations",
|
||||
"seat:mesh-hand-acts.hand-act",
|
||||
"seat:mesh-builds.reserved"
|
||||
"seat:mesh-builds.reserved",
|
||||
"seat:mesh-vault.own-put",
|
||||
"seat:mesh-vault.get"
|
||||
],
|
||||
"consumes": [
|
||||
"mesh-catalog.catalog-revision",
|
||||
@@ -688,7 +706,8 @@
|
||||
"git.pull-updated",
|
||||
"git.pull-closed",
|
||||
"git.pull-merged",
|
||||
"mesh-conditions.findings-asked"
|
||||
"mesh-conditions.findings-asked",
|
||||
"mesh-vault.secret-changed"
|
||||
],
|
||||
"streams": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user