Introduction
We express our gratitude to the ZetaChain team for the collaborative engagement that enabled the execution of this dApp Security Assessment.
Zetachain is a blockchain platform that aims to provide a seamless and secure way for users to interact with decentralized applications (dApps) and services. They focus on enhancing the interoperability and scalability of blockchain networks, ensuring high performance and security.
Document | |
---|---|
Name | dApp Code Review and Security Analysis Report for ZetaChain |
Audited By | Stephen Ajayi |
Approved By | Stephen Ajayi |
Website | https://www.zetachain.com→ |
Changelog | 30/07/2024 - Final Report |
Platform | [Metamask Snap ] |
Language | [TypeScript, JavaScript] |
Tags | [ dApp, Snap ] |
Methodology | https://hackenio.cc/dApp_methodology→ |
Document
- Name
- dApp Code Review and Security Analysis Report for ZetaChain
- Audited By
- Stephen Ajayi
- Approved By
- Stephen Ajayi
- Website
- https://www.zetachain.com→
- Changelog
- 30/07/2024 - Final Report
- Platform
- [Metamask Snap ]
- Language
- [TypeScript, JavaScript]
- Tags
- [ dApp, Snap ]
- Methodology
- https://hackenio.cc/dApp_methodology→
Review Scope | |
---|---|
Repository | https://github.com/1337-ishaan/zetalink→ |
Commit | 619f27913c72a1f46d713cbf7c4faec41d6db04f |
Review Scope
- Repository
- https://github.com/1337-ishaan/zetalink→
- Commit
- 619f27913c72a1f46d713cbf7c4faec41d6db04f
Audit Summary
The system users should acknowledge all the risks summed up in the risks section of the report.
Documentation quality
Presence of README files in the main directories provides an overview of the packages and their purposes.
Clear configuration files (
tsconfig.json
,.eslintrc.js
,.prettierrc.js
) that outline the setup and rules for the project.Enhance the README with detailed instructions on how to set up and run the project, including installation steps and usage examples..
Code quality
The codebase uses TypeScript, which provides static type checking, reducing runtime errors and improving code quality.
Presence of ESLint and Prettier configurations ensures consistent coding style and helps in maintaining clean code.
The code is organized into modules (e.g., constants, functions) which promotes reusability and maintainability.
Includes unit tests (
index.test.ts
), indicating a focus on test-driven development and code reliability.Improve error handling mechanisms to gracefully manage unexpected situations and provide meaningful feedback to users.
Increase inline comments and documentation within the code to explain complex logic and ensure that new developers can easily understand the codebase.
System Overview
Zetachain is a blockchain platform that aims to provide a seamless and secure way for users to interact with decentralized applications (dApps) and services. They focus on enhancing the interoperability and scalability of blockchain networks, ensuring high performance and security.
What Zetachain Does:
Interoperability Solutions: Enables seamless communication between different blockchain networks, allowing for cross-chain transactions and interactions.
Scalability Enhancements: Implements advanced consensus mechanisms and sharding techniques to improve transaction throughput and reduce latency.
Security Measures: Employs robust security protocols to protect user data and prevent malicious attacks on the network.
Developer Support: Provides comprehensive tools and documentation to support developers in building and deploying dApps on their platform.
Snap Overview
The ZeTrax Snap package is a TypeScript-based project designed for integration with Metamask, incorporating multiple components for configuration, source code, testing, documentation, and web interface.
Key Components
Root Directory Files:
.gitignore
: Specifies files and directories to be ignored by Git.package-lock.json
andpackage.json
: Define project dependencies and their versions, ensuring consistency across environments..prettierrc.js
: Configuration for code formatting with Prettier..nvmrc
: Node Version Manager configuration for specifying the Node.js version..eslintrc.js
: Linting configuration to enforce code quality.tsconfig.json
: TypeScript configuration file for compiler options.LICENSE.MIT0
: The license file specifying the terms under which the code can be used..yarn/releases/yarn-3.2.1.cjs
: Yarn release file..yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs
and@yarnpkg/plugin-workspace-tools.cjs
: Yarn plugins for additional functionalities..github/workflows/
: Contains GitHub Actions workflows for CI/CD..vscode/settings.json
: VS Code settings to standardize the development environment.
Snap Package:
snap.config.ts
: Configuration settings specific to the snap package.snap.manifest.json
: Defines the snap’s metadata, including permissions and initial files to be included.src/index.ts
: Main entry point for the snap package.src/index.test.ts
: Unit tests for the main functionality.src/constants/index.ts
: Defines constants used throughout the project.src/functions/index.ts
: Utility functions used across the codebase.README.md
: Overview and instructions for the snap package.jest.config.js
: Configuration for running tests with Jest.scripts/install-chrome.sh
: Script for installing Chrome, potentially for end-to-end testing.
Site Package:
gatsby-config.ts
: Configuration file for the Gatsby site..env.local
and.env.production.dist
: Environment variable files for local development and production.gatsby-browser.tsx
andgatsby-ssr.tsx
: Gatsby files for browser and server-side rendering configurations.src/pages/index.tsx
: Main entry point for the site’s homepage.src/assets/
: Contains various SVG assets used in the site.README.md
: Overview and instructions for the site package.package.json
: Define project dependencies specific to the site package..eslintrc.js
: Linting configuration to enforce code quality.
Findings
Code ― | Title | Status | Severity | |
---|---|---|---|---|
F-2024-4470 | Insecure Private Key Handling | fixed | High | |
F-2024-4469 | Insufficient Origin Validation | fixed | Low | |
F-2024-4468 | Overly Broad Permissions | fixed | Low | |
F-2024-4458 | Vulnerable Dependencies | fixed | Low | |
F-2024-4410 | Improper Input Sanitization | fixed | Low | |
F-2024-4467 | Missing Explicit Strict Type-Checking Options | fixed | Observation | |
F-2024-4466 | Strict Null Checks Not Explicitly Enabled | fixed | Observation | |
F-2024-4464 | Missing Author Information in Package Metadata | fixed | Observation | |
F-2024-4462 | Potential for Using Outdated Node.js Version | fixed | Observation | |
F-2024-4461 | Imprecise Dependency Versioning | fixed | Observation |
Protect your dApp with insights like these.
Appendix 1. Severity Definitions
Severity | Description |
---|---|
Critical | These issues present a major security vulnerability that poses a severe risk to the system. They require immediate attention and must be resolved to prevent a potential security breach or other significant harm. |
High | These issues present a significant risk to the system, but may not require immediate attention. They should be addressed in a timely manner to reduce the risk of the potential security breach. |
Medium | These issues present a moderate risk to the system and cannot have a great impact on its function. They should be addressed in a reasonable time frame, but may not require immediate attention. |
Low | These issues present no risk to the system and typically relate to the code quality problems or general recommendations. They do not require immediate attention and should be viewed as a minor recommendation. |
Severity
- Critical
Description
- These issues present a major security vulnerability that poses a severe risk to the system. They require immediate attention and must be resolved to prevent a potential security breach or other significant harm.
Severity
- High
Description
- These issues present a significant risk to the system, but may not require immediate attention. They should be addressed in a timely manner to reduce the risk of the potential security breach.
Severity
- Medium
Description
- These issues present a moderate risk to the system and cannot have a great impact on its function. They should be addressed in a reasonable time frame, but may not require immediate attention.
Severity
- Low
Description
- These issues present no risk to the system and typically relate to the code quality problems or general recommendations. They do not require immediate attention and should be viewed as a minor recommendation.
Appendix 2. Scope
The scope of the project includes the following files from the provided repository:
Scope Details | |
---|---|
Repository | https://github.com/1337-ishaan/zetalink→ |
Commit | 619f27913c72a1f46d713cbf7c4faec41d6db04f |
Scope Details
- Repository
- https://github.com/1337-ishaan/zetalink→
- Commit
- 619f27913c72a1f46d713cbf7c4faec41d6db04f
Assets in Scope
Metamask Snap Codebase