Skip to main content
damlisk

damlisk

Static analyzer for Daml smart contracts.

PyPI CI Python License

Detectors · Examples

damlisk reads the Daml-LF inside a .dar through dazl, walks every template, choice and value, and runs detectors over it. It needs no Daml source and no running ledger: what damlc compiled is what gets checked.

How it works

1. Install damlisk (Python 3.11 or newer):

pip install damlisk

2. Build your Daml project with dpm build. This choice uses a fetched value after its contract was replaced:

    nonconsuming choice PayOut : ContractId Receipt
      with
        cid : ContractId Account
      controller owner
      do
        acc <- fetch cid
        _ <- exercise cid Withdraw with amt = 10.0
        create Receipt with bank; owner; remaining = acc.amount

3. Scan the DAR:

$ damlisk scan examples/vulnerable/stale-fetch/stale-fetch.dar --detect stale-fetch
[Medium] stale-fetch Main.daml:29
    Main:Desk.PayOut: `acc` is used after `Withdraw`
[Medium] stale-fetch Main.daml:38
    Main:Desk.PayTwice: `acc` is used after `Withdraw`
2 finding(s).

Documentation

Each page explains its detectors: what they report, why it matters, an example with the scan output, and how the check works and what it misses.

# Page Detectors
1 Authorization controller-from-argument, hardcoded-party, unprotected-archive, over-disclosure, delegated-authority-leak
2 Assets stuck-asset, value-to-arbitrary-party
3 Contracts unsafe-primitive, untrusted-interface-exercise, stale-fetch
4 Validation missing-amount-check, partial-function, nonconsuming-create, unchecked-fetch, time-from-argument, amount-tolerance, divide-before-multiply, unconsumed-input, hash-concat-collision, time-equality, missing-ensure, ignored-optional
5 Time time-dependence, weak-randomness
6 Loops ledger-op-in-loop, unbounded-input-loop
7 Hygiene boolean-cst, boolean-equal, unused-template-field, discarded-update, aborting-choice, tautological-compare, debug-trace, rtlo
8 Upgrade sdk-version
All detectors with impact and confidence
Detector Impact Confidence What it finds
boolean-cst Medium Medium Boolean constants used as conditions
boolean-equal Informational High Comparison to True / False
controller-from-argument High Medium Consuming choice controlled only by an unchecked argument party
missing-amount-check Low Medium Decimal template field not constrained by ensure
unused-template-field Informational Medium Template field that no ledger code reads
hardcoded-party Medium High Party identity built from or compared with a text literal
partial-function Low Medium Choice argument passed to head, fromSome, !!, ...
discarded-update Medium High Ledger actions wrapped in pure and never run
nonconsuming-create High Medium Nonconsuming choice creates its own template without archiving self
unchecked-fetch High Medium Contract fetched from a choice argument and used without validation
time-from-argument Medium Medium Deadline logic on a caller-supplied Time instead of ledger time
amount-tolerance Medium High Decimal amounts compared with abs (a - b) < eps instead of exactly
divide-before-multiply Medium Medium Result of a division multiplied, compounding its rounding error
unconsumed-input High Medium Input contract of the same template read but not archived
aborting-choice Informational High Choice whose body always aborts
hash-concat-collision Medium Medium sha256 of texts joined without a separator
time-equality Medium High Ledger time compared with == or /=
tautological-compare Medium High Value compared with itself (payer == payer)
unprotected-archive High Medium Consuming choice controlled by a non-signatory
missing-ensure Medium High Template with amount or time fields and no or trivial ensure
over-disclosure Medium Medium Choice observers taken from the choice argument
unsafe-primitive High High Unchecked cast of a contract id, interface or Any value
debug-trace Informational High Debug trace left in production code
stuck-asset Medium Medium Asset its owner cannot move: no owner-controlled consuming choice
sdk-version Informational High DAR built for a Daml-LF 1.x target
rtlo High High Bidirectional control character (right-to-left override) in source or Text
delegated-authority-leak High Medium Non-signatory controller passes parties or amounts into a create or exercise
untrusted-interface-exercise High Medium Interface contract id from the choice argument is exercised or fetched
value-to-arbitrary-party High Medium Asset created for an owner from the choice argument by a non-owner controller
time-dependence Low Medium Ledger time decides a branch
weak-randomness High Medium Ledger time or a hash picks a list element or map entry
ledger-op-in-loop Low Medium Create, exercise or fetch inside a loop
unbounded-input-loop Medium Medium Loop over a list from the choice argument with no length check
stale-fetch Medium Medium Fetched value used after the contract was replaced by a successor
ignored-optional Medium Medium Optional result discarded or forced with fromSome

Commands

damlisk --help                       # top-level usage and command list
damlisk --version                    # installed version
damlisk list-detectors               # every detector with impact and confidence
damlisk info path/to/project.dar     # packages, Daml-LF versions and declarations
damlisk scan path/to/project.dar     # run all detectors on the main package

scan options:

Option Meaning
--detect a,b Run only these detectors
--exclude a,b Skip these detectors
--json / --pretty-json Print findings as JSON
--fail-on <impact> Exit with code 1 on a finding of this impact or higher (high, medium, low, informational, none)
--traceback Show a Python traceback on error

Examples

examples/vulnerable/ has one small Daml project per detector. Each holds the cases that are reported and the look-alikes that are not. examples/dars/ holds the Splice DARs used as a real-world baseline in the tests. No DAR is committed: make dars builds every example with dpm build and downloads every published Splice version from the official Splice repository.

Local development

python -m venv .venv
source .venv/bin/activate
make dev-init        # editable install with the dev dependency group
make dars            # build the example DARs and download the Splice DARs (needs dpm)

Run the tests and linters, and build the wheel:

make test            # pytest
make lint            # mypy, black, flake8, isort
make build           # dist/damlisk-<version>-py3-none-any.whl

CI (.github/workflows/ci.yml) is started by hand from the Actions tab (Run workflow). It runs the same steps inside the Nix dev shell from flake.nix: it installs dpm and the Daml SDK, runs make dars, then lint and tests. Run it locally with:

nix develop --command make ci

Publishing to PyPI

Pushing a v*.*.* tag runs .github/workflows/workflow.yml. It builds the sdist and wheel with the tag as the version (v0.2.0 gives damlisk --version = 0.2.0), checks that, and uploads to PyPI through trusted publishing, so no API token is stored in the repository:

git tag v0.2.0
git push origin v0.2.0

License

damlisk is licensed under the Apache License, Version 2.0.

Metadata

Release files for damlisk 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for damlisk 0.0.1
File Size Uploaded Provenance Actions
damlisk-0.0.1.tar.gz 134.0 kB With provenance Details for damlisk-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for damlisk 0.0.1
File Interpreter ABI Platform Actions
damlisk-0.0.1-py3-none-any.whl Python 3 none any Details for damlisk-0.0.1-py3-none-any.whl

Total release size: 219.2 kB

Release files / damlisk-0.0.1.tar.gz

Download URL damlisk-0.0.1.tar.gz
Size 134.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e52c4824cd05f24994079474ed83d570ba5baa9effd16a257002a6564f3863bc
BLAKE2b-256 checksum
How to use checksums
a7b9e3f5510441fd700659c7f36e9b3971172f5a7feecca8cb21b05105d13e10
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 10, 2026.

Transparency log

Release files / damlisk-0.0.1-py3-none-any.whl

Download URL damlisk-0.0.1-py3-none-any.whl
Size 85.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d85a7783d92ae07fa0f53db9d28bf3ffa391c60ebc0ea5373ea7d3263fda2730
BLAKE2b-256 checksum
How to use checksums
2d1d3df9a6c24597abb46d244111f1a2770de2d13ae8c3dbc1e786977ab9ea93
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 10, 2026.

Transparency log

Security for damlisk 0.0.1

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.

Select from 2 files

Attestation for damlisk-0.0.1.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 10, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page