Skip to content

Commit 6c5cd94

Browse files
author
Vara Prasad Bandaru
committed
Update Readme to contain Anchor and Non Anchor columns
1 parent 065b528 commit 6c5cd94

File tree

16 files changed

+120
-29
lines changed

16 files changed

+120
-29
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ The lints are inspired by the [Sealevel Attacks]. (See also @pencilflip's [Twitt
88

99
The current lints are:
1010

11-
| Library | Description |
12-
| ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
13-
| [`arbitrary_cpi`](lints/arbitrary_cpi) | lint for [5-arbitrary-cpi](https://github.com/coral-xyz/sealevel-attacks/tree/master/programs/5-arbitrary-cpi) |
14-
| [`bump_seed_canonicalization`](lints/bump_seed_canonicalization) | lint for [6-bump-seed-canonicalization](https://github.com/coral-xyz/sealevel-attacks/tree/master/programs/7-bump-seed-canonicalization) |
15-
| [`insecure_account_close`](lints/insecure_account_close) | lint for [9-closing-accounts](https://github.com/coral-xyz/sealevel-attacks/tree/master/programs/9-closing-accounts) |
16-
| [`missing_owner_check`](lints/missing_owner_check) | lint for [2-owner-checks](https://github.com/coral-xyz/sealevel-attacks/tree/master/programs/2-owner-checks) |
17-
| [`missing_signer_check`](lints/missing_signer_check) | lint for [0-signer-authorization](https://github.com/coral-xyz/sealevel-attacks/tree/master/programs/0-signer-authorization) |
18-
| [`sysvar_get`](lints/sysvar_get) | Reports uses of `Sysvar::from_account_info` instead of `Sysvar::get` |
19-
| [`type_cosplay`](lints/type_cosplay) | lint for [3-type-cosplay](https://github.com/coral-xyz/sealevel-attacks/tree/master/programs/3-type-cosplay) |
11+
| Library | Description | Anchor | Non Anchor |
12+
| ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ------------------ |
13+
| [`arbitrary_cpi`](lints/arbitrary_cpi) | lint for [5-arbitrary-cpi](https://github.com/coral-xyz/sealevel-attacks/tree/master/programs/5-arbitrary-cpi) | :heavy_check_mark: | :heavy_check_mark: |
14+
| [`bump_seed_canonicalization`](lints/bump_seed_canonicalization) | lint for [6-bump-seed-canonicalization](https://github.com/coral-xyz/sealevel-attacks/tree/master/programs/7-bump-seed-canonicalization) | | :heavy_check_mark: |
15+
| [`insecure_account_close`](lints/insecure_account_close) | lint for [9-closing-accounts](https://github.com/coral-xyz/sealevel-attacks/tree/master/programs/9-closing-accounts) | :heavy_check_mark: | :heavy_check_mark: |
16+
| [`missing_owner_check`](lints/missing_owner_check) | lint for [2-owner-checks](https://github.com/coral-xyz/sealevel-attacks/tree/master/programs/2-owner-checks) | :heavy_check_mark: | :heavy_check_mark: |
17+
| [`missing_signer_check`](lints/missing_signer_check) | lint for [0-signer-authorization](https://github.com/coral-xyz/sealevel-attacks/tree/master/programs/0-signer-authorization) | :heavy_check_mark: | :heavy_check_mark: |
18+
| [`sysvar_get`](lints/sysvar_get) | Reports uses of `Sysvar::from_account_info` instead of `Sysvar::get` | :heavy_check_mark: | :heavy_check_mark: |
19+
| [`type_cosplay`](lints/type_cosplay) | lint for [3-type-cosplay](https://github.com/coral-xyz/sealevel-attacks/tree/master/programs/3-type-cosplay) | | :heavy_check_mark: |
2020

2121
## Usage
2222

lints/arbitrary_cpi/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ Finds uses of solana_program::program::invoke that do not check the program_id
66
**Why is this bad?**
77
A contract could call into an attacker-controlled contract instead of the intended one
88

9+
**Works on:**
10+
11+
- [x] Anchor
12+
- [x] Non Anchor
13+
914
**Known problems:**
1015
False positives, since the program_id check may be within some other function (does not
1116
trace through function calls)

lints/arbitrary_cpi/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ dylint_linting::declare_late_lint! {
2626
/// **Why is this bad?**
2727
/// A contract could call into an attacker-controlled contract instead of the intended one
2828
///
29+
/// **Works on:**
30+
///
31+
/// - [x] Anchor
32+
/// - [x] Non Anchor
33+
///
2934
/// **Known problems:**
3035
/// False positives, since the program_id check may be within some other function (does not
3136
/// trace through function calls)

lints/bump_seed_canonicalization/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ able to pick the bump_seed, since that would result in a different address.
1111

1212
See https://github.com/crytic/building-secure-contracts/tree/master/not-so-smart-contracts/solana/improper_pda_validation
1313

14+
**Works on:**
15+
16+
- [ ] Anchor
17+
- [x] Non Anchor
18+
1419
**Known problems:**
1520

1621
False positives, since the bump_seed check may be within some other function (does not

lints/bump_seed_canonicalization/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ dylint_linting::declare_late_lint! {
3636
///
3737
/// See https://github.com/crytic/building-secure-contracts/tree/master/not-so-smart-contracts/solana/improper_pda_validation
3838
///
39+
/// **Works on:**
40+
///
41+
/// - [ ] Anchor
42+
/// - [x] Non Anchor
43+
///
3944
/// **Known problems:**
4045
///
4146
/// False positives, since the bump_seed check may be within some other function (does not

lints/insecure_account_close/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ See: https://docs.solana.com/developing/programming-model/transactions#multiple-
1111

1212
> An example of where this could be a problem is if a token program, upon transferring the token out of an account, sets the account's lamports to zero, assuming it will be deleted by the runtime. If the program does not zero out the account's data, a malicious user could trail this instruction with another that transfers the tokens a second time.
1313
14+
**Works on:**
15+
16+
- [x] Anchor
17+
- [x] Non Anchor
18+
1419
**Known problems:**
1520

1621
None

lints/insecure_account_close/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ dylint_linting::declare_late_lint! {
2626
///
2727
/// > An example of where this could be a problem is if a token program, upon transferring the token out of an account, sets the account's lamports to zero, assuming it will be deleted by the runtime. If the program does not zero out the account's data, a malicious user could trail this instruction with another that transfers the tokens a second time.
2828
///
29+
/// **Works on:**
30+
///
31+
/// - [x] Anchor
32+
/// - [x] Non Anchor
33+
///
2934
/// **Known problems:**
3035
///
3136
/// None

lints/missing_owner_check/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ If no owner check is done on the account, then a malicious actor could pass in a
1919
account owned by some other program. The code may then perform some actions on the
2020
unauthorized account that is not owned by the SPL Token program.
2121

22+
**Works on:**
23+
24+
- [x] Anchor
25+
- [x] Non Anchor
26+
2227
**Known problems:**
2328

2429
Key checks can be strengthened. Currently, the lint only checks that the account's owner

lints/missing_owner_check/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ dylint_linting::impl_late_lint! {
4141
/// account owned by some other program. The code may then perform some actions on the
4242
/// unauthorized account that is not owned by the SPL Token program.
4343
///
44+
/// **Works on:**
45+
///
46+
/// - [x] Anchor
47+
/// - [x] Non Anchor
48+
///
4449
/// **Known problems:**
4550
///
4651
/// Key checks can be strengthened. Currently, the lint only checks that the account's owner

lints/missing_signer_check/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ then anyone can create the instruction, call the program and perform a privilege
1414
For example if the Token program does not check that the owner of the tokens is a signer in the transfer instruction then anyone can
1515
transfer the tokens and steal them.
1616

17+
**Works on:**
18+
19+
- [x] Anchor
20+
- [x] Non Anchor
21+
1722
**Known problems:**
1823
None.
1924

0 commit comments

Comments
 (0)