Semantic security scanner for Algorand smart contracts and workflows
Project description
AlgoSec (A Secure)
AlgoSec is a semantic security scanner and runtime decision assistant for Algorand smart contracts.
It supports static contract analysis, on-chain checks, AI-assisted risk narratives, contract auto-remediation, and API-based policy gating.
1) What AlgoSec does today
Contract scanning (TEAL + PyTeal)
- Scans files or folders containing
.teal/.pycontracts. - Normalizes PyTeal patterns (
approval_program/clear_state_program) before analysis. - Runs semantic checks for common exploit paths:
- missing
RekeyTo == ZeroAddress - missing
CloseRemainderTo == ZeroAddress - missing
AssetCloseTo == ZeroAddress - unguarded update/delete/admin paths
- unsafe
Gtxnassumptions without strict group validation - missing argument-bound checks
- state mutation without sender/role authorization
- missing
Scoring and risk output
- Computes
security_score,risk_score,grade, and deploy verdict. - Exit code is non-zero when findings/errors exist (CI-friendly behavior).
Reports
- Console dashboard (visual)
- JSON
- Markdown
- SARIF
- HTML (expanded analytics + charts)
On-chain and indexer analysis
- Scan deployed app by
app_id - Scan account risk posture
- Scan ASA metadata/configuration
- Scan transaction streams for anomalies
AI-assisted workflow
ai-run: scan + simulate + policy decision + explanation artifacts.- Works in two modes:
- deterministic mode (always available; no key required)
- Gemini narrative mode (optional; enabled when API key is available)
Auto-fix workflow
fix-contractapplies hardened guard patterns to vulnerable PyTeal contracts.- Optional post-fix verification scan (
--verify).
Entitlement / premium support
premium-statussupports ASA-balance mode and subscription-app mode.- Testnet deploy commands are dry-run by default for safety.
2) Installation
Standard install
pip install algo-secure
With Gemini SDKs
pip install "algo-secure[ai]"
Development install
pip install -e .
3) Quick start
# Home UI
algosec
# Core scan
algosec analyze ./contracts
# Export html report
algosec scan ./contracts -f html -o report.html
# Compare two versions
algosec diff ./contracts_old ./contracts_new
# Auto-fix a vulnerable contract
algosec fix-contract examples/incoming_contracts/random_user_contract.py --verify
Aliases: algosec, alg, aplussec.
4) Command groups
Static and project scan
scan,alg_scan,analyzestatsdiff
On-chain/indexer scan
scan-deployed-app,alg_scan_deployed_appscan-account,alg_scan_accountscan-asset,alg_scan_assetscan-transactions,alg_scan_transactions
Testing
test-pyteal,alg_test_pyteal
AI and remediation
ai-statusai-run,alg_ai_runfix-contract,alg_fix_contract
Entitlement and deploy
premium-statusdeploy-token-registry-testnetdeploy-subscription-testnet
API server
serve
5) AI behavior (important)
AlgoSec is designed to work on any system even without LLM credentials.
- If no Gemini key/sdk is available,
ai-runstill executes using deterministic reasoning (narrative_provider=deterministic). - If Gemini is available, narrative generation switches to
narrative_provider=gemini.
Gemini key lookup order:
ALGOSEC_GEMINI_API_KEYGEMINI_API_KEYGOOGLE_API_KEY
Optional one-shot override:
algosec ai-status --gemini-api-key "<key>"
6) Security and secret handling
- No API key is hardcoded in source.
- Auth signing secret does not default to a fixed insecure string.
- If
ALGOSEC_AUTH_SECRETis absent, runtime uses an ephemeral in-memory secret. - Recommendation for production API deployments:
- set
ALGOSEC_AUTH_SECRET - set
ALGOSEC_REQUIRE_API_KEY=1 - set
ALGOSEC_API_KEY
- set
7) API surface
Primary routes include:
/health/scan/simulate/safe_execute/agent/run/auth/challenge/auth/verify/auth/me
8) Packaging and release status
pyproject.tomlis configured for setuptools build.- Wheel + sdist build is validated (
python -m build,twine check). - PyPI publishing workflow is present in .github/workflows/release.yml.
9) License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file algo_secure-0.1.4.tar.gz.
File metadata
- Download URL: algo_secure-0.1.4.tar.gz
- Upload date:
- Size: 74.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38b3e98f2bb9c9d6fc79319b435c9cd65cdc478135ff04f0b04d66b67431eae9
|
|
| MD5 |
1164dd72f680bafd57e5e337bd04c46b
|
|
| BLAKE2b-256 |
09d94721bae63ab6a16e894739c06cb2e3ea84fe2f88b5086c6cbf5a18e1e067
|
File details
Details for the file algo_secure-0.1.4-py3-none-any.whl.
File metadata
- Download URL: algo_secure-0.1.4-py3-none-any.whl
- Upload date:
- Size: 103.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8c9e034bd3ef3be737b7b71514fd7efab45484b305006e93450ae50c8be7391
|
|
| MD5 |
82c547571d3432656b4b7b825874c994
|
|
| BLAKE2b-256 |
ae2a94bbb1e5701f9f11149ac71cc3a23b837b61c2895f669eeeefc6fed0dc2f
|