Skip to content

feat(js): add fetchProgramUpgradeAuthority - #127

Open
amilz wants to merge 2 commits into
solana-program:mainfrom
amilz:feat/program-upgrade-authority
Open

amilz wants to merge 2 commits into
solana-program:mainfrom
amilz:feat/program-upgrade-authority

Conversation

@amilz

@amilz amilz commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
  • Adds fetchProgramUpgradeAuthority, which reports who can replace a program's code: the same data solana program show prints under Authority and Last Deployed In Slot.
  • Loader v2 programs are reported as immutable. For loader v3 programs it returns the program data account's authority and deploy slot, plus authorityKind: keypair (on-curve), pda (off-curve, e.g. a multisig vault), or none.
  • Throws on missing, non-executable or non-v2/v3 accounts, the same way getProgramAuthority does.
const result = await fetchProgramUpgradeAuthority(rpc, programId);
// { loader: 'v3', authority, authorityKind: 'keypair' | 'pda' | 'none', lastDeployedSlot, program, programData }
// { loader: 'v2', authority: null, authorityKind: 'none', program }

Got the idea from @robre post

How to check who can change the code of a Solana program you use. Takes 30 seconds:

  1. Find the program ID (docs, explorer, or the transaction your wallet asks you to sign)
  2. Run: solana program show <PROGRAM_ID>
  3. Look at the Authority line
  • none: immutable. Nobody can change the code.
  • a normal wallet: one key can replace the program with anything. That key is the whole security model.
  • a Squads multisig vault: check the members, the threshold, and whether there's a timelock.

Also look at Last Deployed In Slot. Recent upgrades you didn't hear about? Ask why.

Drift in April was a reminder that admin keys get compromised. If one key can change the program holding your money, that's your risk too.

CC @Woody4618

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant