Skip to content

Conversation

crypto-vincent
Copy link
Contributor

@crypto-vincent crypto-vincent commented Dec 2, 2024

Problem

This is a followup to the internal audit:
https://docs.google.com/document/d/1A-LPShMpH7gft7Y_zGBrV23Qx5BOpxBVdaVA8Q5TXKg/edit?tab=t.0

This particular PR aims to address the following item:

  • High 2: The system_program is unchecked in some IXs

Solution

Add a load_program in all instructions where it's missing

Greptile Summary

This PR implements security improvements by adding system program validation checks across processor files and fixes admin public key configuration for test/production environments.

  • Added load_program(system_program, system_program::id())? validation in all processor files to ensure system program authenticity before PDA/lamport operations
  • Fixed admin pubkey configuration in src/consts.rs to use correct keys: tEsT3eV6RFCWs1BZ7AXTzasHqTtMnMLCB2tjQ42TDXD for tests, 3FwNxjbCqdD7G6MkrAdwTd5Zf6R3tHoapam4Pv1X2KBB for production
  • Reordered system program validation in src/processor/finalize.rs to occur before dependent operations
  • Missing system program validation in process_close_ephemeral_balance() function needs to be addressed

💡 (5/5) You can turn off certain types of comments like style here!

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

@crypto-vincent crypto-vincent changed the title [Internal audit] action item: check system_program [Internal audit] High 2: check system_program Dec 2, 2024
@GabrielePicco GabrielePicco changed the title [Internal audit] High 2: check system_program fix: Add system_program checks Dec 2, 2024
@crypto-vincent crypto-vincent merged commit 9621a33 into main Dec 5, 2024
3 checks passed
@crypto-vincent crypto-vincent deleted the vbrunet/2024_12_02-system-check branch December 5, 2024 05:18
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.

2 participants