This release is a pre-release and may not be stable for production use.
sak-guard
Static pre-commit security guardrail for Solana agent code. The static complement to a runtime transaction firewall.
Status: 0.2.0a2 release candidate. Five Solana rule families are implemented. This is an alpha heuristic guardrail. Read the detection envelope before using a passing result as a release decision.
Why this exists
Solana's agent ecosystem is adding transaction capability faster than safety tooling.
solana-agent-kit lets an agent construct and submit transactions, and the community is
patching the gap ad hoc — most visibly
sendaifun/solana-agent-kit#575,
which proposes @prflght/sak-plugin, a plugin that wraps the SAK execution flow to
intercept every transaction before it lands on-chain.
That is a runtime control. It sees a transaction at the moment it is built. It does not see, and cannot stop, the bad code that builds it — an agent-authored tool that sources a keypair from the wrong place, leaks a seed into a prompt, or does something other than what its description claims. By the time a runtime firewall has something to intercept, the vulnerable code is already merged and running.
sak-guard asks a different question, earlier:
Before this code is merged — does it do what it claims to do, and does it handle keys and transactions safely?
The two are complements, not competitors. Use both.
Install
pip install --pre sak-guard # latest published pre-release
pip install "sak-guard==0.2.0a2" # pin this candidate once published
Published on PyPI under Trusted Publishing (OIDC) — no API token is stored in this repository.
Requires Python >= 3.10 (see why the floor is 3.10 rather than 3.9).
No runtime dependencies — the engine is stdlib-only, so a pre-commit hook does not have to touch your environment.
Use
sak-guard FILE|DIR # audit a file or a tree
sak-guard - # Python source on stdin (not a git diff)
sak-guard F --json # machine-readable
sak-guard F --fail-on X # critical | high | medium | low | any | never
sak-guard F --strategy S # security-focused (default) | default | ast-heavy | intent-focused
sak-guard F --intent "..." # what the code is supposed to do
sak-guard F --use-llm # optional LLM intent pass (provider from LLM_* env)
sak-guard F --language python # source language (default: python)
sak-guard F --quiet # only print failing targets
Exit codes: 0 clean or below threshold · 1 findings at/above threshold · 2 usage,
IO, parse or incomplete-analysis error. Scan errors remain exit 2 with --fail-on never.
That option suppresses the failure status for completed findings only.
reports[].passed means there are no High/Critical findings; it is independent of
the selected CLI threshold. An incomplete report always has passed: false.
$ sak-guard tests/fixtures/vulnerable_api.py
tests/fixtures/vulnerable_api.py: 3 issue(s) (confidence 0.95)
[critical]:13 security: Hardcoded secret/credential detected
fix: Use environment variables or a secrets manager
[critical]:23 security: Use of eval() is a security risk — allows arbitrary code execution
fix: Use ast.literal_eval() for safe evaluation or avoid eval entirely
[high]:9 security: subprocess with shell=True allows shell injection
fix: Use shell=False and pass args as a list
3 issue(s) across 1 target(s); fail-on=high
$ echo $?
1
Why the default strategy is security-focused
The base analyzer bank covers hardcoded secrets and eval(). It does not look for shell
injection at all — no os.system or shell=True pattern exists in it. Those live in the
security-focused strategy's extra patterns. A security auditor defaulting to the base bank
reports "clean" on subprocess.call(cmd, shell=True). So the CLI defaults to the bank
that actually looks for command injection.
Verify this yourself: run the same fixture with --strategy default and count.
Pre-commit
# .pre-commit-config.yaml
repos:
- repo: https://github.com/Pantronux-Research/sak-guard
rev: v0.2.0-alpha.1 # use the reviewed release tag once it exists
hooks:
- id: sak-guard
args: ["--fail-on", "high"]
Each pre-commit file scan uses its own isolated process. Budget roughly 0.1 seconds of process startup per small file on the review machine; 100 files can add about 10 seconds before substantial analysis. Measure this on your runner. For larger projects, scope the consumer hook to all key-handling and transaction-building paths, for example:
- id: sak-guard
files: ^(src/transaction_client/|src/agents/|tests/solana/)
require_serial: true
args: ["--fail-on", "high"]
Replace those example paths with your own complete set. Files outside the filter
receive no checks. require_serial avoids competing hook processes on a loaded
runner; it does not reuse workers. The 15-second deadline is a per-file analysis
budget, not a promise that every valid generated module fits it. A timeout exits
2 and requires investigation; it never becomes a passing verdict.
GitHub Actions
- run: python -m pip install .
- run: sak-guard src/ --fail-on high
Three engines
- AST analysis — structural inspection: where keypairs are sourced, whether transaction construction is validated, whether signing is gated.
- Security pattern banks — AST checks for hardcoded secrets,
eval/exec,subprocess(..., shell=True)and unsafe deserialization. Text heuristics supply additional advisory diagnostics. - Intent-mismatch verification (in progress) — declare what a tool is supposed to do; fail the build when the implementation diverges. No existing Solana safety tool does this statically.
Detection envelope
Read this before treating a pass as proof. sak-guard is static analysis. It will miss
whole vulnerability classes:
- anything depending on runtime state, economic conditions, or on-chain state — none of which exist at commit time;
- logic errors that are syntactically safe;
- vulnerabilities in dependencies.
It is not a replacement for a runtime firewall, a fuzzer, or a formal audit. We publish our
detection gaps and false-positive rate rather than hide them, because a safety tool that
overstates its coverage is itself a risk. Current measured rates are in
VERIFICATION.md.
The current rule contract describes the signing and amount proxies, conservative false positives, resource limits and unsupported flows. Historical verification reports describe their own snapshots, not this release candidate.
Each CLI file scan has a 15-second worker deadline (60 seconds with explicit LLM use),
a 4 MiB source limit and a 200,000-node AST limit. Analysis never imports or executes
submitted code. Only --use-llm permits sending source to a configured provider.
Roadmap
- Decoupled CLI, stdlib-only, no server
- AST + regex engines with verified pass/fail behaviour
- Initial Solana banks: key handling, RPC, model provenance, signing and amount bounds
- GitHub Action with inline PR annotations
- Intent-mismatch verification, published fixtures
- Documented detection envelope and regression fixtures
License
Apache-2.0. See LICENSE.
Pantronux Research — Indonesia
Metadata
Release files for sak-guard 0.2.0a2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sak_guard-0.2.0a2.tar.gz | 116.9 kB | With provenance | Details for sak_guard-0.2.0a2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sak_guard-0.2.0a2-py3-none-any.whl | Python 3 | none | any | Details for sak_guard-0.2.0a2-py3-none-any.whl |
Total release size: 188.3 kB
Release files / sak_guard-0.2.0a2.tar.gz
| Download URL | sak_guard-0.2.0a2.tar.gz |
|---|---|
| Size | 116.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
508660bccc444512417539ebcd2f7428241b6e0376e0a302187f143a08292518
|
|
BLAKE2b-256 checksum How to use checksums |
abaeeb533d63e15a1d4c226d36ca53031d6c21a729be56b494ad46819d23250c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logRelease files / sak_guard-0.2.0a2-py3-none-any.whl
| Download URL | sak_guard-0.2.0a2-py3-none-any.whl |
|---|---|
| Size | 71.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
87e4498413be19cdd4563c2cc825e8e2250c06482e0124c8603800e72a2d8430
|
|
BLAKE2b-256 checksum How to use checksums |
48e398060538d13903311f0fdc21d6e27697dd9aaa95f182a8e6310bda926130
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logSecurity for sak-guard 0.2.0a2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sak_guard-0.2.0a2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.