Skip to content

v1.5.7

Choose a tag to compare

@github-actions github-actions released this 02 Dec 17:04
· 29 commits to main since this release

Fixed

  • RG09 does not treat a local assigned only in a catch or branch as a
    constant.
    let failed; try { .. } catch { failed = true }; assert.isTrue(failed)
    was reported as "failed is a constant", although the assertion fails when
    the call succeeds: the assignment runs only in the branch. The IR flattens
    branches and the constant check read the single assignment. A local is now a
    constant only when its value is the declaration's initializer
    (let a = 1; assert_eq!(a, 1) still fires); an assignment after the
    declaration is not, even when it is the only one and its value is a literal.
    Covered by a_local_assigned_only_in_a_catch_is_not_a_constant and
    a_local_initialized_with_a_constant_is_still_a_tautology in
    tests/typescript.rs.
  • RG08 is silent on a file the tool, not the author, made a test. A
    top-level script (scripts/setup.ts, solve.ts) has no it()/#[test];
    the frontend read it as one script test, and RG08 then reported that the
    "test" asserts nothing. The suite name made the false positive visible as
    setup::fragment or a script's main. A test whose boundary the tool
    supplied is now marked synthetic, and RG08 skips it. --fragment is the
    operator saying the file is a test body, so that boundary is theirs and RG08
    still fires there; a .rs/.ts/.js file given explicitly without the flag
    is still read as a fragment, but RG08 does not judge it. Covered by
    a_top_level_script_with_no_test_is_not_flagged_for_asserting_nothing and
    an_auto_detected_fragment_is_not_flagged_for_asserting_nothing in
    tests/typescript.rs.
  • A policy file inside the repository is refused regardless of path
    casing on Windows.
    --declaration and --config must live outside the
    tree under review, but the containment check compared paths
    case-sensitively. git rev-parse --show-toplevel reports the on-disk
    casing while the process's current directory can be spelled differently, so
    entering the checkout with a different case (for example desktop for
    Desktop) let a realism.yaml inside the repository be applied. The check
    now compares case-insensitively on Windows. Covered by
    policy_path_tests in src/cli.rs.
  • RG09 no longer calls a snapshot taken before the attack a tautology.
    The 1.5.4 change "a local assigned the same expression is compared as that
    expression" substituted a local's initializer without checking whether state
    could change in between. let before = svm.get_account(&market).unwrap(); send(..); assert_eq!(svm.get_account(&market).unwrap(), before) was reported
    as "both sides are svm.get_account(&market).unwrap()", although the
    transaction may have changed the account and the assertion can fail. A local
    is now substituted only when its initializer is a compile-time constant, or
    when no state-changing op lies between the binding and the assertion. The
    snapshot shape accounted for 669 of the 693 RG09 findings on the pinned
    Solana corpus, all 669 in one source; RG09 is now silent on it. A constant
    local such as let a = 1; assert_eq!(a, 1) is still reported. Covered by
    tests/rg09_state_change.rs, the RG09 snapshot fixtures in Rust, TypeScript
    and Solidity, and a property test that inserts a state-changing call between
    the binding and the assertion.
  • RG02 now sees a privileged prank inside a function of a contract the PoC
    defines in its own file.
    op.act() where act does
    vm.prank(owner); vault.setFee(0) used to stop at the external call, so only
    RG08 fired. RG02 now reads that function's body (and same-contract calls it
    makes) for a sender switch to a privileged address, and reports it at the
    prank's own line. Only contracts defined in the test's own file are read; an
    imported dependency's body is never followed. RG02 is the only rule that
    changes: the test's other findings do not move. Covered by
    privileged_address_aliased_through_a_helper_contract in
    tests/adversarial.rs (previously #[ignore]d). The golden manifest is
    byte-identical, and the corpus counts are unchanged (no committed fixture,
    DeFiHackLabs file or DeFiVulnLabs file has this shape).
  • A privileged prank reached through abi.encode/abi.decode is reported as
    RG02.
    address who = abi.decode(abi.encode(admin), (address)); vm.prank(who)
    was not treated as a prank to the privileged admin: the identity pass
    followed a plain alias to another variable but not the ABI wrapper around the
    same value, so only RG08 fired. rg-model's alias follow now peels
    abi.encode(x), abi.encodePacked(x) and abi.decode(x, (T)) down to the
    value they carry; a call that combines several values is left alone. Covered
    by privileged_address_round_tripped_through_abi_encode_decode in
    tests/adversarial.rs (previously #[ignore]d) and a unit test in
    rg-model. The golden manifest is byte-identical: no committed fixture uses
    the shape.
  • rg-model changed and is re-published at the next release. rg-ir gains
    Function::synthetic and Op::decl, rg-frontend-ts sets the synthetic
    boundary on a script, and rg-rules reads both; all four move to 1.5.7
    (rg-ir and rg-frontend-ts to 1.5.1, rg-rules to 1.5.6).
    rg-render moves with the tool version.

Changed

  • syn 3.0.10 (from 2.0.119) parses Rust tests. syn 3 removes
    Arm::guard and carries a match guard as Pat::Guard on the arm's
    pattern; rg-frontend-rust now reads it from there, so guards are lowered
    as before. No output change: every golden case is byte-identical. syn 3.0.10
    declares rust-version 1.71, so the MSRV stays 1.95. Supersedes Dependabot
    PR #56, which did not compile.
  • rg-frontend-rust changed, so it is re-published at the next release
    (its own version is still 1.5.0).

Install

cargo binstall realism-gate

or download an archive below and check it:

sha256sum -c SHA256SUMS --ignore-missing
gh attestation verify <archive> --repo KhomDev/realism-gate

Three binaries are included: realism-gate (the checker), rgate
(the same program under a short name) and realism-gate-mcp (the MCP
server). cargo binstall installs all three. Linux builds are static
(musl).

Built with rustc 1.95.0 and repacked deterministically, so the
archives can be compared with a local rebuild. From a checkout of this
repository:

scripts/reproduce-release.sh v1.5.7 x86_64-unknown-linux-musl