Skip to content

Commit 95bf30e

Browse files
author
Maxwell Voss
committed
fix(critical): Fix 7 runtime-crash bugs - paywall signature, Finding attributes, newlines, gas accumulation, quoting, Docker, init files
1 parent 73ecea0 commit 95bf30e

8 files changed

Lines changed: 53 additions & 28 deletions

File tree

.dockerignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.git
2+
.gitignore
3+
__pycache__
4+
.pytest_cache
5+
*.pyc
6+
*.pyo
7+
*.egg-info
8+
.env
9+
docs/
10+
dashboard/node_modules/
11+
dashboard/.next/
12+
*.md
13+
!README.md
14+
LICENSE

Dockerfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
FROM python:3.11-slim
22

3+
LABEL maintainer="Maxwell VOSS"
4+
LABEL description="AI-powered smart contract scanner for Ethereum, Base & Solana"
5+
LABEL version="3.2"
6+
37
# Install solc and system dependencies
48
RUN apt-get update && apt-get install -y \
59
software-properties-common \
@@ -11,7 +15,7 @@ RUN apt-get update && apt-get install -y \
1115
# Install python dependencies
1216
COPY requirements.txt /app/requirements.txt
1317
RUN pip install --no-cache-dir -r /app/requirements.txt
14-
RUN pip install --no-cache-dir web3 slither-analyzer solc-select
18+
RUN pip install --no-cache-dir slither-analyzer solc-select
1519

1620
# Install common solc versions for Slither
1721
RUN solc-select install 0.8.20 && \
@@ -35,8 +39,7 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
3539
COPY . /app
3640
WORKDIR /app
3741

38-
# The entrypoint script
39-
COPY entrypoint.sh /entrypoint.sh
40-
RUN chmod +x /entrypoint.sh
42+
RUN chmod +x /app/entrypoint.sh
43+
44+
ENTRYPOINT ["/app/entrypoint.sh"]
4145

42-
ENTRYPOINT ["/entrypoint.sh"]

entrypoint.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
#!/bin/bash
22
set -e
33

4-
CONTRACT_ADDRESS=$1
5-
WALLET_ADDRESS=$2
6-
RPC_URL=$3
7-
GITHUB_TOKEN=$4
8-
ENTERPRISE_KEY=$5
4+
CONTRACT_ADDRESS="$1"
5+
WALLET_ADDRESS="$2"
6+
RPC_URL="$3"
7+
GITHUB_TOKEN="$4"
8+
ENTERPRISE_KEY="$5"
99

1010
echo "=========================================================="
11-
echo "🛡️ Starting Automated Smart Contract Auditor Pro"
11+
echo "⚡ Solidity Security Scanner PRO v3.2"
1212
echo "=========================================================="
13+
echo "Engine: Slither + Foundry Fuzz + Solana/Rust + AI Validator"
1314

1415
export WALLET_ADDRESS
1516
export RPC_URL
@@ -18,8 +19,8 @@ export ENTERPRISE_KEY
1819

1920
if [ -z "$CONTRACT_ADDRESS" ]; then
2021
echo "Scanning entire repository workspace..."
21-
python /app/security_scanner.py --workspace ${GITHUB_WORKSPACE}
22+
python /app/security_scanner.py --workspace "${GITHUB_WORKSPACE}"
2223
else
2324
echo "Scanning specific contract: $CONTRACT_ADDRESS"
24-
python /app/security_scanner.py --address $CONTRACT_ADDRESS
25+
python /app/security_scanner.py --address "$CONTRACT_ADDRESS"
2526
fi

gas_optimizer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ def __init__(self, workspace: str):
99

1010
def optimize_contract(self, contract_path: str) -> Dict[str, Any]:
1111
"""Runs heuristic analysis to find gas optimization opportunities."""
12+
self.gas_findings = [] # Reset findings for each contract
1213
if not os.path.exists(contract_path):
1314
return {"status": "error", "message": "File not found"}
1415

paywall/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Paywall module for Web3 subscription verification

paywall/verify_subscription.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
}
3030
}
3131

32-
def verify_subscription(user_wallet: str) -> bool:
32+
def verify_subscription(user_wallet: str, rpc_url: str = "https://mainnet.base.org") -> bool:
3333
"""
3434
Verifies if `user_wallet` has sent at least `REQUIRED_AMOUNT` of USDC
3535
to `OWNER_WALLET` within the last 30 days on either Ethereum or Base.

security_scanner.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ def scan_contract(contract_address: str, workspace_override: str = None) -> None
645645
if solana_scanner.is_solana:
646646
_log("INFO", "Solana/Rust project detected! Routing to Solana Scanner engine...")
647647
sol_res = solana_scanner.scan()
648-
sys.stdout.write(json.dumps(sol_res) + "\\n")
648+
sys.stdout.write(json.dumps(sol_res) + "\n")
649649
sys.stdout.flush()
650650
return
651651
except Exception as e:
@@ -878,29 +878,33 @@ def scan_contract(contract_address: str, workspace_override: str = None) -> None
878878

879879
# Heuristic findings
880880
for finding in heuristic_findings:
881-
if finding.severity in ["Critical", "High"] and finding.line_number > 0 and posted_comments < 15:
882-
body = f"**[{finding.severity}] {finding.title}**\\n{finding.description}"
883-
commenter.post_inline_comment(finding.file_path, finding.line_number, body)
881+
sev_str = finding.severity.value if hasattr(finding.severity, 'value') else str(finding.severity)
882+
if sev_str in ["Critical", "High"] and finding.line_number > 0 and posted_comments < 15:
883+
body = f"**[{sev_str}] {finding.name}**\n{finding.description}"
884+
commenter.post_inline_comment(finding.filepath, finding.line_number, body)
884885
posted_comments += 1
885886

886887
# Slither findings
887888
for sf in slither_raw:
888-
if sf.mapped_severity in ["Critical", "High"] and sf.lines and posted_comments < 15:
889-
# Use the first line of the first element
890-
line_no = sf.lines[0]
889+
sev = getattr(sf, 'mapped_severity', getattr(sf, 'severity', 'Low'))
890+
lines = getattr(sf, 'lines', [])
891+
if sev in ["Critical", "High"] and lines and posted_comments < 15:
892+
line_no = lines[0]
891893
if line_no > 0:
892-
body = f"**[{sf.mapped_severity}] {sf.check_name}**\\n{sf.description}"
893-
# Slither file path is usually relative
894-
commenter.post_inline_comment(sf.file_path, line_no, body)
894+
check = getattr(sf, 'check_name', getattr(sf, 'check', 'Unknown'))
895+
desc = getattr(sf, 'description', '')
896+
fpath = getattr(sf, 'file_path', getattr(sf, 'filename', ''))
897+
body = f"**[{sev}] {check}**\n{desc}"
898+
commenter.post_inline_comment(fpath, line_no, body)
895899
posted_comments += 1
896900

897901
# General summary comment
898902
if total_findings > 0:
899-
summary_body = f"The Web3 AI Scanner found **{total_findings}** issues.\\n"
900-
summary_body += f"- Critical: {merged_counts.get('Critical', 0)}\\n"
901-
summary_body += f"- High: {merged_counts.get('High', 0)}\\n"
903+
summary_body = f"The Web3 AI Scanner found **{total_findings}** issues.\n"
904+
summary_body += f"- Critical: {merged_counts.get('Critical', 0)}\n"
905+
summary_body += f"- High: {merged_counts.get('High', 0)}\n"
902906
if not has_pro:
903-
summary_body += "\\n🔒 **Unlock AI False-Positive Suppression & Gas Optimizer** by sending 50 USDC to `0x9758AdAe878bD4EA0d0aa24408c56D7d4aEC29a5`."
907+
summary_body += "\n🔒 **Unlock AI False-Positive Suppression & Gas Optimizer** by sending 50 USDC to `0x9758AdAe878bD4EA0d0aa24408c56D7d4aEC29a5`."
904908
commenter.post_general_comment(summary_body)
905909

906910
except Exception as e:

tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Tests package

0 commit comments

Comments
 (0)