Security: no emergency governance key rotation rehearsal or named signer list in runbooks [SEC-D10] #408
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#408
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Checklist Item
SEC-D10: Model admin-key compromise as the most realistic high-impact attack for small TVL. Verify: governance custody/runbook review and emergency rotation rehearsal.
Summary
The security model documents that governance should be a multisig and the launch checklist requires multisig governance as a Phase 0 gate. However, no runbook includes an emergency key rotation script, a named signer list, a rotation ceremony procedure, or evidence that an emergency rotation has been rehearsed. The issue DEX-P2-026 ("Runbook: contract migration / admin key rotation") remains in the issue backlog as unimplemented.
What Was Checked
docs/runbooks/wasm-admin-migration.md"Admin rotation" section: one-liner -- "Use update_admin (where supported) only through governance process; verify new admin on-chain before revoking old keys"; no named signers, no rotation script, no rehearsal recorddocs/runbooks/launch-checklist.mdPhase 0: requires "Governance and treasury addresses are multisigs or DAO (not EOAs)"; requirement noted but no rotation rehearsal stepdocs/security-model.mdGovernance Keys: states governance address should be multisig; policy stated, no rehearsal documenteddocs/reviews/20260409T030009Z/ISSUE_BACKLOG.mdline 246: "DEX-P2-026 -- Runbook: contract migration / admin key rotation"; backlog only, not implementeddocs/tree searched for "emergency rotation", "rotation rehearsal", "signer list", "key rotation": no results outside the aboveExpected (per checklist)
A documented governance custody plan and evidence of an emergency rotation rehearsal. This includes: named signers or multisig threshold, a copy-pastable rotation command sequence, and a record that the rotation was tested on LocalTerra or staging.
Actual
The runbook has a policy statement (multisig required) and a one-line reminder to use
update_adminthrough governance, but no named signer list, no rotation command cookbook, and no rehearsal record. Admin key compromise is identified in SEC-D as the most realistic high-impact attack at small TVL, yet the rotation procedure is the least-documented emergency action in the repo.Evidence
docs/runbooks/wasm-admin-migration.mdlines 38-40: "Admin rotation" section is one bullet onlydocs/reviews/20260409T030009Z/ISSUE_BACKLOG.mdline 246: DEX-P2-026 in backlog, not implementeddocs/,scripts/, orMakefileSuggested Fix
Implement DEX-P2-026. Add a section to
docs/runbooks/wasm-admin-migration.md(or a newdocs/runbooks/governance-key-rotation.md) that includes:terrad tx wasm update-admincommand with placeholder addressesterrad tx wasm executecommand for factoryUpdateConfig { governance: new_addr }rotationVerification Checklist
docs/runbooks/wasm-admin-migration.mdor a dedicated rotation runbook contains copy-pastable rotation commandsLabels
security,pre-launchCc: @PlasticDigits
mentioned in issue #381
Pending multisig release.
mentioned in merge request !935
mentioned in issue #406
mentioned in issue #424
mentioned in commit
f1091f011fmentioned in merge request !978
mentioned in issue #398
mentioned in commit
afc5c92acbmentioned in merge request !979
Took SEC-D10 and built the rotation cookbook + a real LocalTerra rehearsal. MR !979 (stacked on !978/#398), commit
afc5c92a. Implements the backlog DEX-P2-026.New
docs/runbooks/governance-key-rotation.mdcovers the checklist:terrad tx wasm set-contract-admin) and the factorygovernancepointer ({"update_config":{"governance":...}}), single-key and multisig (generate-only -> sign --multisig -> multisign -> broadcast)contract_info.admin,config.governance)clear-contract-adminflagged as irreversibleHeads up: the issue's suggested
terrad tx wasm update-adminis outdated — terrad 4.0.1 usesset-contract-admin. The whole cookbook uses the correct subcommand; I caught it because I actually ran the rotation.Rehearsal: I ran a wasm contract-admin round-trip on LocalTerra — current admin -> a throwaway 2-of-3 multisig -> back to the original, with the return rotation signed by the multisig (the real "rotate away from the old multisig" case). It verifies the admin on chain at each step and restores the original, so it doesn't disturb the deploy (it never touches the
governancepointer).make verify-issue-408-> 5/5. Rehearsal record:terra1hrpna9v7vs3stzyd4z3xf00676kf78zpe2u5ksvljswn2vnjp3ysc6mpf5terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38vterra1jmmjdnp4r6e2spzuzatj7q05grr08yraq0gua6(2-of-3)5A39F4B7C8FE386741A8B018A49D88B65751F829AC379C2D3695C730B519FBFD301B55AB42EA197CB08A2A665F3EE625A4F217367AD1FA5AFC36A0D6252260C7That's the dev rehearsal (proves the signing flow + message shapes). The launch gate still wants the same rotation repeated from the planned production multisig on testnet/staging once the multisig exists — which is your "pending multisig release". I left the real signer identities/addresses/threshold as ceremony placeholders, didn't invent any.
DEX-P2-026 is marked shipped in the review backlog with a link to the runbook.
Stacked on !978 — merge that first, then this. Needs your review + merge. @PlasticDigits
mentioned in commit
d5f277e85dOur multisig address is set up to : terra1zlmv2xydxcusurtr6rl78wsvytdc6mfex6hep7
Implementation verification (#408 / SEC-D10)
Verified on
main(post-!979). No additional code/doc changes were required in this pass.Acceptance criteria
docs/runbooks/governance-key-rotation.md—set-contract-admin,update_config, multisig flow, post-rotation queriesdocs/runbooks/key-custody.md(SEC-B10); production multisigterra1zlmv2xydxcusurtr6rl78wsvytdc6mfex6hep7indocs/reference/governance-multisig.mdmake verify-issue-408step [5] — live round-trip on fresh LocalTerra deploydocs/reviews/20260409T030009Z/ISSUE_BACKLOG.md— marked shipped →governance-key-rotation.mdCommands run
LocalTerra rehearsal (from
make verify-issue-408):terra1hrpna9v7vs3stzyd4z3xf00676kf78zpe2u5ksvljswn2vnjp3ysc6mpf5terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38vterra1hs6jfpxltzcyask9e3zmkfugydvngh4dyer3szset-contract-admin(key → multisig):E5710AFECC973F1820226DD1485145E4E8CCDC97FA322E131C773EDE2C8B81B7set-contract-admin(multisig → original):4880E1E2A19CED52D67566B095324839E5C97A575E8F869B7CF613D561A60851Shipped artifacts (MR !979, merged)
docs/runbooks/governance-key-rotation.md— rotation cookbook + evidence templatescripts/rehearse-governance-key-rotation.sh— self-restoring LocalTerra rehearsalscripts/check_governance_key_rotation_docs.py,scripts/qa/verify-issue-408.shskills/AGENTS_GOVERNANCE_KEY_ROTATION.mdwasm-admin-migration.md,launch-checklist.md,key-custody.mdLaunch gate note
The automated LocalTerra rehearsal proves signing flow and message shapes. Production go/no-go still requires repeating rotation from the planned production multisig on testnet/staging once that ceremony is complete (per runbook §6 and PlasticDigits' multisig address comment).
Closing — all acceptance criteria satisfied on
main.