Skip to content

Commit 1b2bfe9

Browse files
authored
Merge pull request #329 from crytic/prep-review-checklist
Preparing for a security review checklist
2 parents 7ac742b + 6c69596 commit 1b2bfe9

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- [Token Integration Checklist](./development-guidelines/token_integration.md)
99
- [Incident Response Recommendations](./development-guidelines/incident_response.md)
1010
- [Secure Development Workflow](./development-guidelines/workflow.md)
11+
- [Preparing for a Security Review](./development-guidelines/review_checklist.md)
1112
- [Learn EVM](./learn_evm/README.md)
1213
- [EVM Opcode Reference](./learn_evm/evm_opcodes.md)
1314
- [Transaction Tracing](./learn_evm/tracing.md)

development-guidelines/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ List of Best Practices for Smart Contract Development
55
- [Token Integration Checklist](./token_integration.md): Important aspects to consider when interacting with various tokens
66
- [Incident Response Recommendations](./incident_response.md): Guidelines on establishing an effective incident response plan
77
- [Secure Development Workflow](./workflow.md): A recommended high-level process to adhere to while writing code
8+
- [Preparing for a Security Review](./review_checklist.md): A checklist of things to consider when preparing for a security review
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# How to prepare for a security review
2+
3+
Get ready for your security review! Ensuring a few key elements are in place before the review starts can make the process significantly smoother for both sides.
4+
5+
## Set a goal for the review
6+
7+
This is the most important step of a security review, and paradoxically the one most often overlooked. You should have an idea of what kind of questions you want answered, such as:
8+
9+
- What’s the overall level of security for this product?
10+
- What are the areas that you are the most concerns about?
11+
- Take into considerations previous audits and issues, complex parts, and fragile components.
12+
- What is the worst case scenario for your project?
13+
14+
Knowing your biggest area of concern will help the assessment team tailor their approach to meet your needs.
15+
16+
## Resolve the easy issues
17+
18+
Handing the code off to the assessment team is a lot like releasing the product: the cleaner the code, the better everything will go. To that end:
19+
20+
- **Triage all results from static analysis tools**. Go after the low-hanging fruits and use:
21+
- [Slither](https://github.com/crytic/slither) for Solidity codebases
22+
- [dylint](https://github.com/trailofbits/dylint) for Rust codebases
23+
- [golangci](https://golangci-lint.run/) for Go codebases
24+
- [CodeQL and Semgrep](https://appsec.guide/) for Go/Rust/C++/... codebases
25+
- **Increase unit and feature test coverage**. Ideally this has been part of the development process, but everyone slips up, tests don’t get updated, or new features don’t quite match the old integrations tests. Now is the time to update the tests and run them all.
26+
- **Remove dead code, unused libraries, and other extraneous weight.** You may know which is unused but the consultants won’t and will waste time investigating it for potential issues. The same goes for that new feature that hasn’t seen progress in months, or that third-party library that doesn’t get used anymore.
27+
28+
## Ensure the code is accessible
29+
30+
Making the code accessible and clearly identified will avoid wasting ressources from the security engineers.
31+
32+
- **Provide a detailed list of files for review.**. This will avoid confusion if your codebase is large and some elements are not meant to be in scope.
33+
- **Create a clear set of build instructions, and confirm the setup by cloning and testing your repository on a fresh environment.** A code that cannot be built is a code more difficult to review.
34+
- **Freeze a stable commit hash, branch, or release prior to review.** Working on a moving target makes the review more difficult
35+
- **Identify boilerplates, dependencies and difference from forked code**. By highliting what code you wrote, you will help keeping the review focused
36+
37+
## Document, Document, Document
38+
39+
Streamline the revuew process of building a mental model of your codebase by providing comprehensive documentation.
40+
41+
- **Create flowcharts and sequence diagrams to depict primary workflows**. They will help identify the components and their relationships
42+
- **Write users stories**. Having users stories is a powerful tool to explain a project
43+
- **Outline the on-chain / off-chain assumptions**. This includes:
44+
- Data validation procedure
45+
- Oracles information
46+
- Bridges assumptions
47+
- **List actors and with their respective roles and privileges**. The complexity of a system grows with its number of actors.
48+
- **Incorporate external developer documentation that links directly to your code**. This will help to ensure the documentation is up to date with the code
49+
- **Add function documentation and inline comments for complex areas of your system**. Code documentation should include:
50+
- System and function level invariants
51+
- Parameter ranges (minimum and maximum values) used in your system.
52+
- Arithmetic formula: how they map to their specification, and their precision loss exceptations
53+
- **Compile a glossary for consistent terminology use.** You use your codebase every day and you are familar with the terminology - a new person looking at your code is not
54+
- **Consider creating short video walkthroughs for complex workflows or areas of concern**. Video walkthroughs is a great format to share your knowledge

0 commit comments

Comments
 (0)