{
  "id": "gobra",
  "name": "Gobra",
  "aka": [],
  "summary": "Add specifications as comments to Go code; Gobra translates it to the Viper verifier, which proves memory safety, race freedom and your contracts.",
  "use_if": [
    "You want to prove memory safety, absence of crashes and data races, and functional properties of Go code.",
    "Your code uses goroutines, channels or sync.Mutex and you can describe what each goroutine owns.",
    "You need to prove that secrets do not leak, using Gobra's hyperproperty mode."
  ],
  "avoid_if": [
    "You cannot add annotations for heap permissions; Gobra needs them for every pointer access.",
    "You rely on integer wrap-around; overflow is only checked with the --overflow flag, and without it Gobra treats integers as unbounded.",
    "Your code depends on many standard-library packages; only a few have specifications."
  ],
  "effort": "auto-active",
  "open": "open-source",
  "license": "MPL-2.0 (with listed exceptions)",
  "maintainers": [
    "ETH Zurich (Programming Methodology group)"
  ],
  "links": {
    "homepage": "https://www.pm.inf.ethz.ch/research/gobra.html",
    "repo": "https://github.com/viperproject/gobra",
    "docs": "https://github.com/viperproject/gobra/blob/master/docs/tutorial.md",
    "paper": "https://doi.org/10.1007/978-3-030-81685-8_17",
    "tutorial": "https://github.com/viperproject/gobra/blob/master/docs/tutorial.md"
  },
  "components": [
    {
      "role": "frontend",
      "name": "Gobra's own Go parser and type checker (ANTLR grammar)",
      "assurance": "trusted",
      "note": "Annotations live in // @ comments, so the same files still build with the normal Go compiler."
    },
    {
      "role": "translation",
      "name": "Gobra encoding of Go into the Viper intermediate language",
      "assurance": "trusted"
    },
    {
      "role": "translation",
      "name": "Viper back end (Silicon symbolic execution by default; Carbon via Boogie as an option)",
      "assurance": "trusted"
    },
    {
      "role": "checker",
      "name": "Z3",
      "ref": "z3",
      "ref_kind": "prover",
      "assurance": "trusted"
    },
    {
      "role": "compiler",
      "name": "gc (the Go compiler)",
      "assurance": "trusted"
    }
  ],
  "verifies": [
    {
      "target": "go",
      "note": "Gobra supports many Go features but not all; strings and some integer types such as rune have very limited support."
    }
  ],
  "properties": {
    "no-ub": {
      "status": "partial",
      "note": "Proves memory safety (through permissions) and absence of runtime errors such as nil dereference and out-of-bounds access. Integer overflow is only checked with --overflow, which is off by default.",
      "source": "https://github.com/viperproject/gobra/blob/master/src/main/scala/viper/gobra/frontend/Config.scala"
    },
    "functional": {
      "status": "full",
      "note": "Pre- and postconditions, predicates, ghost code and pure functions.",
      "source": "https://github.com/viperproject/gobra/blob/master/docs/tutorial.md"
    },
    "equivalence": {
      "status": "partial",
      "note": "No dedicated equivalence mode. The hyperproperty mode relates two runs of the same program, but comparing two different versions needs a hand-written specification."
    },
    "info-flow": {
      "status": "full",
      "note": "A hyperproperty mode (--hyperMode, off by default) proves that secret (non-low) data does not affect public outputs, with a declassify statement for intended releases.",
      "source": "https://github.com/viperproject/gobra/tree/master/src/test/resources/regressions/features/hyper_properties"
    },
    "concurrency": {
      "status": "partial",
      "note": "Proves freedom from data races and properties of messages sent over channels and data guarded by locks. The tutorial does not cover deadlock freedom.",
      "source": "https://github.com/viperproject/gobra/blob/master/docs/tutorial.md"
    },
    "termination": {
      "status": "full",
      "note": "Termination is proved with decreases clauses. It is required for pure and ghost functions and optional for other code.",
      "source": "https://github.com/viperproject/gobra/blob/master/docs/tutorial.md"
    }
  },
  "features": {
    "core.integers": {
      "status": "partial",
      "note": "Without --overflow (the default) Gobra treats bounded integers as mathematical integers, so it neither checks overflow nor models wrap-around. The tutorial also says support for some integer types such as rune is very limited.",
      "source": "https://github.com/viperproject/gobra/blob/master/src/main/scala/viper/gobra/ast/internal/transform/OverflowChecksTransform.scala"
    },
    "core.floats": {
      "status": "partial",
      "note": "Basic float32/float64 arithmetic appears in the regression tests; how closely IEEE 754 is modeled is not documented.",
      "source": "https://github.com/viperproject/gobra/tree/master/src/test/resources/regressions/features/floats"
    },
    "core.heap": {
      "status": "full",
      "note": "Pointers and heap access use permissions (acc predicates), including fractional and quantified permissions.",
      "source": "https://github.com/viperproject/gobra/blob/master/docs/tutorial.md"
    },
    "core.arrays": {
      "status": "full",
      "note": "Arrays and slices are supported.",
      "source": "https://github.com/viperproject/gobra/blob/master/docs/tutorial.md"
    },
    "core.loops": {
      "status": "full",
      "note": "Loop invariants; decreases clauses for termination.",
      "source": "https://github.com/viperproject/gobra/blob/master/docs/tutorial.md"
    },
    "core.recursion": {
      "status": "full",
      "source": "https://github.com/viperproject/gobra/blob/master/docs/tutorial.md"
    },
    "core.higher-order": {
      "status": "full",
      "note": "Closures are specified with specification types and proved to satisfy them.",
      "source": "https://github.com/viperproject/gobra/tree/master/src/test/resources/regressions/features/closures"
    },
    "core.concurrency": {
      "status": "full",
      "note": "Goroutines, channels and sync.Mutex, with permissions passed between goroutines.",
      "source": "https://github.com/viperproject/gobra/blob/master/docs/tutorial.md"
    },
    "core.io": {
      "status": "partial",
      "note": "Some packages (for example net, fmt, time) have trusted specification stubs; other I/O needs hand-written specifications.",
      "source": "https://github.com/viperproject/gobra/tree/master/src/main/resources/stubs"
    },
    "core.stdlib": {
      "status": "partial",
      "note": "Specification stubs exist for a few packages (bytes, encoding/binary, errors, fmt, net, strconv, strings, sync, time); they are assumed, not verified.",
      "source": "https://github.com/viperproject/gobra/tree/master/src/main/resources/stubs"
    },
    "go.goroutines": {
      "status": "full",
      "note": "go statements and channels are verified with predicates that say which permissions travel with each message.",
      "source": "https://github.com/viperproject/gobra/blob/master/docs/tutorial.md"
    },
    "go.interfaces": {
      "status": "full",
      "note": "Interfaces with specifications and implementation proofs. Gobra tracks whether interface values are comparable, because comparing incomparable values panics in Go.",
      "source": "https://github.com/viperproject/gobra/blob/master/docs/tutorial.md"
    },
    "go.slices-maps": {
      "status": "full",
      "note": "Slices and maps are covered by the regression suite.",
      "source": "https://github.com/viperproject/gobra/tree/master/src/test/resources/regressions/features/maps"
    },
    "go.defer-panic": {
      "status": "partial",
      "note": "defer is supported (regression tests); support for panic and recover is not documented.",
      "source": "https://github.com/viperproject/gobra/tree/master/src/test/resources/regressions/features/defer"
    }
  },
  "trust": {
    "checker": {
      "level": "amber",
      "summary": "Viper's symbolic execution engine and the Z3 SMT solver decide; no proof certificates.",
      "source": "https://github.com/viperproject/gobra/blob/master/README.md"
    },
    "semantics": {
      "level": "red",
      "summary": "Go model built into Gobra; ignores integer overflow unless --overflow is set.",
      "note": "By default Gobra does not check for integer overflow, and the bounds of Go's integer types are only added by the --overflow transformation. Without the flag, a proof can therefore hold for mathematical integers but not for a real Go run in which a value overflows and wraps around. With the flag, overflow is reported as an error. Otherwise the encoding is tested by Gobra's regression suite.",
      "source": "https://github.com/viperproject/gobra/blob/master/src/main/scala/viper/gobra/ast/internal/transform/OverflowChecksTransform.scala"
    },
    "frontend": {
      "level": "amber",
      "summary": "Gobra's own Go parser and type checker, not the Go compiler's front end.",
      "source": "https://github.com/viperproject/gobra/tree/master/src/main/antlr4"
    },
    "binary_gap": {
      "level": "red",
      "summary": "The binary comes from the Go compiler, which is not verified."
    },
    "escape_hatches": {
      "level": "amber",
      "summary": "assume, trusted functions and bodiless functions are accepted; found by searching.",
      "note": "Functions marked trusted or written without a body are assumed to meet their specification. Library stubs are also assumed.",
      "source": "https://github.com/viperproject/gobra/blob/master/docs/tutorial.md"
    }
  },
  "stage_evidence": {
    "public_artifact": {
      "met": true,
      "evidence": "https://github.com/viperproject/gobra"
    },
    "published_use": {
      "met": true,
      "evidence": "https://arxiv.org/abs/2405.06074",
      "note": "Formal verification of the SCION border router's Go implementation (VerifiedSCION)."
    },
    "installs_on_current": {
      "met": true,
      "evidence": "https://github.com/viperproject/gobra/blob/master/README.md",
      "note": "Built from source with sbt and Java; needs Z3 (CI uses Z3 4.16.0). Releases are tagged about twice a year."
    },
    "user_docs": {
      "met": true,
      "evidence": "https://github.com/viperproject/gobra/blob/master/docs/tutorial.md"
    },
    "external_users": {
      "met": true,
      "evidence": "https://arxiv.org/abs/2507.00595",
      "note": "Engineers from Amazon Web Services, with ETH Zurich, used Gobra on a 100k+ line production Go codebase (Diodon)."
    },
    "soundness_channel": {
      "met": true,
      "evidence": "https://github.com/viperproject/gobra/issues?q=label%3Asoundness",
      "note": "Public GitHub issues with a \"soundness\" label."
    }
  },
  "production_users": [],
  "last_release": {
    "version": "v26.09",
    "date": "2026-10-13",
    "source": "https://github.com/viperproject/gobra/releases/tag/v26.09"
  },
  "used_for": [
    {
      "name": "VerifiedSCION (SCION border router data plane)",
      "url": "https://github.com/viperproject/VerifiedSCION"
    },
    {
      "name": "Diodon (security of a large production Go key-exchange codebase)",
      "url": "https://arxiv.org/abs/2507.00595"
    },
    {
      "name": "Go's extendedGCD in crypto/internal/fips140/bigmod",
      "url": "https://arxiv.org/abs/2606.05796"
    },
    {
      "name": "Verified implementations of WireGuard and other security protocols",
      "url": "https://github.com/viperproject/SecurityProtocolImplementations"
    }
  ],
  "last_checked": "2026-11-26",
  "attestation": "maintainer",
  "claimed_by_authors": false,
  "sources": [
    {
      "url": "https://github.com/viperproject/gobra/blob/master/README.md",
      "title": "Gobra README",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://github.com/viperproject/gobra/blob/master/docs/tutorial.md",
      "title": "A Tutorial on Gobra",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://github.com/viperproject/gobra/blob/master/src/main/scala/viper/gobra/frontend/Config.scala",
      "title": "Gobra command-line options (overflow and hyperMode defaults)",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://doi.org/10.1007/978-3-030-81685-8_17",
      "title": "Gobra: Modular Specification and Verification of Go Programs (CAV 2021)",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://arxiv.org/abs/2405.06074",
      "title": "Protocols to Code: Formal Verification of a Next-Generation Internet Router",
      "accessed": "2026-11-26"
    }
  ],
  "computed": {
    "kind": "toolchains",
    "methodology_version": "0.1",
    "built": "2026-11-26",
    "links": {
      "html": "/toolchains/gobra/",
      "json": "/toolchains/gobra.json",
      "markdown": "/toolchains/gobra.md"
    },
    "stage": {
      "stage": 1,
      "name": "Usable",
      "criteria": [
        {
          "key": "public_artifact",
          "stage": 0,
          "label": "Publicly available",
          "met": true,
          "evidence": "https://github.com/viperproject/gobra",
          "computed": false
        },
        {
          "key": "published_use",
          "stage": 0,
          "label": "At least one published verification uses it",
          "met": true,
          "evidence": "https://arxiv.org/abs/2405.06074",
          "note": "Formal verification of the SCION border router's Go implementation (VerifiedSCION).",
          "computed": false
        },
        {
          "key": "recent_release",
          "stage": 1,
          "label": "Released or updated in the last 12 months",
          "met": true,
          "evidence": "https://github.com/viperproject/gobra/releases/tag/v26.09",
          "note": "Latest release: v26.09, 2026-10-13.",
          "computed": true
        },
        {
          "key": "installs_on_current",
          "stage": 1,
          "label": "Installs and runs on current platforms",
          "met": true,
          "evidence": "https://github.com/viperproject/gobra/blob/master/README.md",
          "note": "Built from source with sbt and Java; needs Z3 (CI uses Z3 4.16.0). Releases are tagged about twice a year.",
          "computed": false
        },
        {
          "key": "user_docs",
          "stage": 1,
          "label": "User documentation or tutorial",
          "met": true,
          "evidence": "https://github.com/viperproject/gobra/blob/master/docs/tutorial.md",
          "computed": false
        },
        {
          "key": "external_users",
          "stage": 1,
          "label": "Used by a group other than its authors",
          "met": true,
          "evidence": "https://arxiv.org/abs/2507.00595",
          "note": "Engineers from Amazon Web Services, with ETH Zurich, used Gobra on a 100k+ line production Go codebase (Diodon).",
          "computed": false
        },
        {
          "key": "production_users",
          "stage": 2,
          "label": "Verified code in production at two or more independent organizations",
          "met": false,
          "note": "None recorded.",
          "computed": true
        },
        {
          "key": "checker_not_red",
          "stage": 2,
          "label": "Checker axis is not red",
          "met": true,
          "computed": true
        },
        {
          "key": "semantics_not_red",
          "stage": 2,
          "label": "Semantics axis is not red",
          "met": false,
          "computed": true
        },
        {
          "key": "soundness_channel",
          "stage": 2,
          "label": "Public channel for soundness bugs",
          "met": true,
          "evidence": "https://github.com/viperproject/gobra/issues?q=label%3Asoundness",
          "note": "Public GitHub issues with a \"soundness\" label.",
          "computed": false
        }
      ],
      "missing_for_next": [
        "production_users",
        "semantics_not_red"
      ]
    }
  }
}