Repository navigation
fix(upgrade): restrict check_and_record_upgrade to admin - #1449
drmfsltdoh wants to merge 6 commits into
Conversation
|
@drmfsltdoh Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
219f83b to
167d64b
Compare
Strips the payload this branch picked up (delete .vscode/extensions.json, delete .vscode/launch.json, delete .vscode/settings.json, delete .vscode/spellright.dict, delete .vscode/tasks.json, delete public/fonts/fa-solid.lkf). No functional change to the branch's own work.
|
@drmfsltdoh Our automated scan matched code from the PolinRider malware campaign, which steals developer credentials (GitHub, npm, wallets) and spreads through infected repositories:
What to do:
The PR will be re-scanned automatically and can be merged once it is clean. |
12385ee to
e3c60e8
Compare
|
This PR came from a machine infected with the PolinRider malware. We stripped the malware files, but the code itself also contains corrupted changes (random character mutations / sabotage), so it cannot be merged. Found: |
|
@drmfsltdoh Our automated scan matched code from the PolinRider malware campaign, which steals developer credentials (GitHub, npm, wallets) and spreads through infected repositories:
What to do:
The PR will be re-scanned automatically and can be merged once it is clean. |
e38d42b to
860518b
Compare
860518b to
71cb7e9
Compare
71cb7e9 to
43df9e1
Compare
43df9e1 to
ae37d0b
Compare
ae37d0b to
9d3e0c3
Compare
9d3e0c3 to
b63bf20
Compare
b63bf20 to
80b3908
Compare
80b3908 to
31cb572
Compare
31cb572 to
db4318f
Compare
db4318f to
fee232d
Compare
Overview
This PR restricts
check_and_record_upgradein thecallora-upgradelibrary to the stored admin, matching the hardening already applied toset_cooldown(#1226). Previously any signer could call it once per cooldown window, pushinglast_upg_tmforward and permanently locking the real admin out withCooldownNotElapsed. The fix adds the missingget_admincomparison, extends the instance TTL when recording, revives the 12 stale ignored tests against theUpgradeHarnesspattern, and documents how hosts should embed the library.Related Issue
Changes
🔒 Admin-only upgrade recording
contracts/upgrade/src/admin.rscheck_and_record_upgradenow checks, in order:caller.require_auth(), thenget_admin().ok_or(NotInitialized)?, thencaller == adminelseUnauthorized, then the cooldown — matchingset_cooldown.upgrade_started, thenupgrade_recorded, and only on success.🧪 Test revival
[MODIFY]
contracts/upgrade/src/test.rs#[ignore = "stale test..."]tests to theUpgradeHarnesspattern, callinginit_adminfirst, and removed the#[ignore]attributes.grep -n 'stale test' contracts/upgradenow returns nothing.[MODIFY]
contracts/upgrade/tests/auth_regression.rs📚 Docs
docs/UPGRADE.mdinit_adminfrom the host's constructor or init, and gate upgrades oncheck_and_record_upgrade.Removed duplicate tests
The following previously ignored tests were removed after porting because they are now covered by the harness-based tests:
test_set_cooldown_without_admin— covered by theNotInitializedcase in the ported suite.test_check_and_record_first_call— covered by the ported first-call success test.test_check_and_record_cooldown— covered by the ported cooldown test.Verification Results
grep -n 'stale test' contracts/upgradereturns nothingcargo test -p callora-upgradepassescargo fmt --all -- --checkandcargo test --workspacepass, CI greenadmin.rsat least 95%Unauthorized,last_upg_tmunchanged, no eventsOkwith two events in orderCooldownNotElapsed, no eventsOkNotInitializedupgrade_starteddataCloses #1416