Check that the program was granted access to program_id (#13890)

This commit is contained in:
Jack May
2020-12-01 07:35:07 -08:00
committed by GitHub
parent 57dd60f671
commit 733fcbaa6c
9 changed files with 3539 additions and 0 deletions

View File

@@ -1336,6 +1336,20 @@ fn verify_instruction<'a>(
}
}
// validate the caller has access to the program account
let _ = callers_keyed_accounts
.iter()
.find_map(|keyed_account| {
if &instruction.program_id == keyed_account.unsigned_key() {
Some(keyed_account)
} else {
None
}
})
.ok_or(SyscallError::InstructionError(
InstructionError::MissingAccount,
))?;
Ok(())
}