Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add improper_instruction_introspection lint #103

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

S3v3ru5
Copy link
Contributor

@S3v3ru5 S3v3ru5 commented Jun 21, 2024

The lint checks for this issue in building-secure-contracts: https://github.com/crytic/building-secure-contracts/tree/master/not-so-smart-contracts/solana/improper_instruction_introspection

The lint is very trivial, it flags all calls to load_instruction_at_checked(...).

@S3v3ru5
Copy link
Contributor Author

S3v3ru5 commented Jun 21, 2024

This lint needs further work.

The lint might not work and should be considered incomplete. It was not possible to compile the lint, hence not tested, ran (Could not run even clippy on the lint). This is the error:

error[E0658]: use of unstable library feature 'offset_of'
   --> /Users/vara/.cargo/registry/src/index.crates.io-6f17d22bba15001f/solana-program-1.18.1/src/program.rs:542:20
    |
542 |         assert_eq!(offset_of!(AccountInfo, executable), 42);
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information
    = help: add `#![feature(offset_of)]` to the crate attributes to enable
    = note: this error originates in the macro `_memoffset__offset_of_impl` which comes from the expansion of the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)

Latest version of solana-program 1.18.7 gives the same error. I could not resolve the error.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Vara Prasad Bandaru seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

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