Skip to content

chore(ci): enforce the clippy deny list, cargo fmt --check and cargo-deny; forbid sqlx, sea-orm, diesel in check-deps.sh #40

Closed

Description

@aRustyDev

Context

CI (.github/workflows/ci.yml) runs changes, plan, ci-scripts, deps, hermetic, pg-adapter, contract and mutants, and then gate, the only required check. gate's needs list is at ci.yml:211; when Rust changed, every job it needs must report exactly success (.github/scripts/assert-gate.sh:12-14,39-40). docs/src/architecture/cicd.md:79 lists cargo fmt, cargo clippy and any licence or dependency audit as "Not in CI", and the repo has no deny.toml, clippy.toml, rustfmt.toml or [workspace.lints]. scripts/check-deps.sh:13 forbids 17 crates, including sqlx and lapin, but it checks them only in thrust-contracts, thrust-ports, thrust-core and thrust-api (line 14) and in thrust-adapters-memory (lines 30-37).

Problem

  • Clippy deny list. ADR-0006's panic policy says "clippy denies unwrap_used, expect_used, panic and indexing_slicing in core, ports and adapters (not yet enforced: a P0 task)" (ADR-0006:99). With panic=abort on the Worker, a panic fails its own request and can fail other requests on the same isolate: 1 in 328 on the real platform (ADR-0006:130). The adapters call unwrap and expect today, for example the memory adapter's lock unwraps and PgTx::client (crates/thrust-adapters-postgres/src/lib.rs:383).
  • ORM crates. Through Hyperdrive, named prepared statements work only as pg and postgres.js implement them, and sqlx, SeaORM and diesel-async rely on them (research/0004 §10.4 F1). ADR-0044 (round 29, line 36) accepts hand SQL on tokio-postgres and makes check-deps.sh forbid sqlx, sea-orm and diesel, yet nothing stops sea-orm or diesel today. sqlx is also not checked in thrust-adapters-postgres or the roots, which is where it would land.
  • Supply-chain gate. ADR-0101 (accepted, line 37) and ADR-0100 (line 80) require a Rust supply-chain gate (cargo-deny, cargo-vet or cargo audit). None runs.

Proposal

  • check-deps.sh: add a loop over the whole workspace on both targets (cargo tree --workspace -e normal --target all -i <crate>) for sqlx, sea-orm, diesel and diesel-async, and exit non-zero on any hit.
  • Clippy:
    • Set [lints.clippy] unwrap_used, expect_used, panic and indexing_slicing to deny in thrust-core, thrust-ports and the four adapter crates.
    • Add a clippy.toml that sets allow-unwrap-in-tests, allow-expect-in-tests, allow-panic-in-tests and allow-indexing-slicing-in-tests to true.
    • Add a lint job that runs cargo clippy --workspace --all-targets -- -D warnings natively and cargo clippy -p thrust-worker --no-default-features --target wasm32-unknown-unknown -- -D warnings.
    • Fix each existing call, or keep it with an #[allow] that states the reason.
  • fmt: run cargo fmt --all --check in the same job.
  • cargo-deny:
    • Add a deny.toml with [licenses] (an allow-list compatible with AGPL-3.0-only, Cargo.toml:22), [advisories], [bans] (deny sqlx, sea-orm and diesel again, as a second guard) and [sources] (crates.io only).
    • Install the tool through taiki-e/install-action, pinned by SHA like the other actions.
    • Ignore RUSTSEC-2023-0071 explicitly (the rsa crate, the "Marvin Attack", CVE-2023-49092: its private-key operations are not
      constant-time, so timing observable over the network can leak a private key; no patched version exists, and rsa 0.9.10, the version
      in Cargo.lock, and 0.10.0-rc.18 were both still affected on the advisory's 2026-09-12 note). Put the ignore in deny.toml's
      [advisories], with its reason written beside it, and keep it the only ignore. Why it does not apply to us: rsa enters through
      openidconnect 4.0.1, which should use it only to verify RS256 ID-token signatures with the issuer's public key (confirm that against
      the crate's source when writing the ignore), so there is no private key on our side to leak; and through thrust-contract-tests,
      whose mock IdP signs with a throwaway key on 127.0.0.1 inside the test
      process. Add a note to re-check it whenever rsa or openidconnect is updated and when the advisory gains a patched version, to
      remove the ignore once one is adopted, and to revisit it if any code path ever signs or decrypts with an rsa private key where
      an attacker can time it. Do not avoid RS256 to get rid of the finding (owner decision, 2026-10-24): Zitadel signs with it.
  • Gate and docs: add the new job or jobs to gate's needs (ci.yml:211). Update docs/src/architecture/cicd.md:79 and docs/src/testing/techniques/architecture-gates.md.

Acceptance criteria

  • grep -n "sea-orm" scripts/check-deps.sh matches. Adding sea-orm to crates/thrust-adapters-postgres/Cargo.toml makes scripts/check-deps.sh exit non-zero (the control; record it in architecture-gates.md next to the existing worker control).
  • A deliberate .unwrap() in non-test code in thrust-core fails the clippy step, and a mis-formatted file fails cargo fmt --all --check. Show both failing once, on a throwaway branch.
  • cargo deny check passes on main, and fails when a dependency with a disallowed licence or a banned crate is added (the control).
  • deny.toml ignores RUSTSEC-2023-0071 and nothing else, with the justification and the re-check note beside the entry. Deleting the entry
    makes cargo deny check advisories fail and name that advisory (the control: it shows the ignore is what makes main pass, and that the
    advisory is really in the graph).
  • gate lists the new job in needs and stays green on main, and .github/scripts/tests/test-ci-scripts.sh still passes.
  • The "Not in CI" list in docs/src/architecture/cicd.md no longer names clippy, fmt or the dependency audit.

References

  • Review: .agents/plans/contrail/reviews/2026-10-19-fable-architecture-review.md (FR-07; roadmap M0 "clippy deny list in CI")
  • scripts/check-deps.sh:13-14,30-37; .github/workflows/ci.yml:211; .github/scripts/assert-gate.sh:12-14; docs/src/architecture/cicd.md:79; docs/src/testing/techniques/architecture-gates.md:27-30
  • ADR-0006 panic policy (.agents/plans/contrail/adrs/architecture/0006-runtime-language-and-framework.md:99,130); ADR-0044 (adrs/data/layer/0044-query-layer-orm.md:36); ADR-0101 (adrs/ci/0101-ci-supply-chain.md:37); ADR-0100:80; ADR-0002
  • Q-0006.4 (QUESTIONS.md:357), Q-0044 (QUESTIONS.md:80); research/0004 §10.4 F1; docs/src/contributing/crates.md

Finding: FR-07, ADR-0006 panic policy

Amended 2026-10-24 with the owner after PR #76 (the auth slice) brought rsa into the dependency graph through openidconnect: the RUSTSEC-2023-0071 ignore in the cargo-deny proposal and its acceptance criterion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:processprio:p0review:fable-2026-10-19

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions