| Crates.io | swayscan |
| lib.rs | swayscan |
| version | 0.2.9 |
| created_at | 2025-07-18 07:01:18.414972+00 |
| updated_at | 2025-08-18 06:19:28.292662+00 |
| description | Advanced security scanner for Sway smart contracts with comprehensive vulnerability detection and minimal false positives |
| homepage | https://safeedges.in |
| repository | https://github.com/Safe-Edges/swayscan |
| max_upload_size | |
| id | 1758677 |
| size | 570,062 |
Advanced AST-based security scanner for Sway smart contracts with comprehensive vulnerability detection and minimal false positives.
SwayScanner performs deep AST-based static analysis on Sway smart contracts to identify security vulnerabilities, code quality issues, and best practice violations. Built by the Safe Edges Team to secure the decentralized future.
cargo install swayscan
cargo install swayscan
git clone https://github.com/Safe-Edges/swayscan
cd swayscan
cargo install --path .
# Scan a single file with AST-based analysis
swayscan contract.sw
swayscan contract.sw -d path
# Scan with Markdown report (recommended)
swayscan contract.sw -o name.md
swayscan contract.sw --export-md
# Scan all Sway files recursively
swayscan --scan-all
# Generate comprehensive Markdown audit report
swayscan contract.sw --markdown-report audit-report.md
# Multiple output formats
swayscan contract.sw --display-format json
swayscan contract.sw --display-format sarif
# Scan with specific detectors only
swayscan contract.sw --detectors access_control,reentrancy
# Exclude specific detectors
swayscan contract.sw --exclude-detectors magic_number
# Filter by severity
swayscan contract.sw --severity-filter high
# Verbose output with detailed AST analysis
swayscan contract.sw --verbose
SwayScanner uses AST-based analysis to detect the following vulnerability categories:
================================================================================
███████╗██╗ ██╗ █████╗ ██╗ ██╗███████╗ ██████╗ █████╗ ███╗ ██╗
██╔════╝██║ ██║██╔══██╗╚██╗ ██╔╝██╔════╝██╔════╝██╔══██╗████╗ ██║
███████╗██║ █╗ ██║███████║ ╚████╔╝ ███████╗██║ ███████║██╔██╗ ██║
╚════██║██║███╗██║██╔══██║ ╚██╔╝ ╚════██║██║ ██╔══██║██║╚██╗██║
███████║╚███╔███╔╝██║ ██║ ██║ ███████║╚██████╗██║ ██║██║ ╚████║
╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═══╝
AST-Based Security Analysis for Sway Smart Contracts
Powered by Safe Edges
https://safeedges.in
================================================================================
Running AST-based detectors... (14 active)
SECURITY AUDIT REPORT
===========================================
CRITICAL: access_control
├─ Missing access control in admin_mint function
├─ Location: contract.sw:45:5 (AST span: 45:5-67:8)
└─ Risk: Unauthorized users can mint tokens
HIGH: reentrancy
├─ Potential reentrancy in unsafe_withdraw function
├─ Location: contract.sw:67:5 (AST span: 67:5-89:12)
└─ Risk: Attacker can drain contract funds
MEDIUM: input_validation
├─ Missing input validation in transfer function
├─ Location: contract.sw:23:5 (AST span: 23:5-45:10)
└─ Risk: Invalid parameters may cause unexpected behavior
Check out the examples/ directory for sample vulnerable contracts to test SwayScanner:
# Test on example vulnerable contract
swayscan examples/vulnerable_contract.sw --export-md
Create a swayscan.toml configuration file for custom settings:
[analysis]
confidence_threshold = 0.7
parallel_threads = 4
ast_analysis = true
[detectors]
enabled = ["access_control", "reentrancy", "arithmetic_issues"]
disabled = ["magic_number"]
[output]
format = "text"
color = true
We welcome contributions! Please see our Contributing Guidelines for details.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
SwayScanner is developed by Safe Edges, a team dedicated to securing the decentralized future through advanced security tooling and auditing services.
Made by the Safe Edges Team