Skip to content

Security: define dependency provenance and reproducible audit policy #9

Description

@Joaco2603

Problem

The contracts depend on OpenZeppelin Stellar Contracts from Git tag v0.7.1. Cargo.lock pins the resolved commit, but the repository has no enforceable policy for reviewing dependency updates, proving the source of the resolved revision, or managing audit exceptions.

Smart-contract dependencies are part of the trusted computing base: an unreviewed Git revision or an undocumented advisory exception can change contract behavior before the WASM is built.

Required outcome

Establish a reproducible, enforceable dependency-supply-chain policy for the Rust/Soroban workspace.

Dependency provenance controls

  • Determine and document whether compatible crates.io releases exist and whether they are preferable to the current OpenZeppelin Git dependencies.
  • If Git dependencies remain, pin every OpenZeppelin package to the same reviewed immutable revision; keep the human-readable tag only as documentation, not as the sole trust boundary.
  • Create a machine-readable allowlist/manifest of approved Git source URL, repository owner, tag, resolved commit, packages, and review date.
  • Add a verification command that compares Cargo.toml, Cargo.lock, and the allowlist, failing when a Git dependency is added, removed, retargeted, or resolved to an unapproved commit.
  • Require dependency-update PRs to include the upstream release/commit diff, compatibility assessment, security impact, and an intentional lockfile update.

Audit and CI controls

  • Keep cargo audit in CI and provide a reproducible local make audit path.
  • Add a checked-in, documented advisory-exception policy: every ignored/yanked advisory needs a rationale, owner, review/expiry date, and CI must fail when the exception expires.
  • Run the provenance verification and audit as distinct, named CI steps before build/test output is trusted.
  • Ensure CI triggers when dependency-policy files, Cargo manifests/lockfile, Makefile, or workflow configuration change.
  • Produce CI logs/artifacts that identify the exact Rust toolchain, host target, lockfile hash, and approved Git revision used for the verification run.

Operational documentation

  • Document the trusted dependency sources, immutable revisions, review workflow, local verification commands, and emergency rollback procedure in the README or security documentation.
  • Define a maintainer procedure for rotating a compromised dependency revision and regenerating/reviewing the lockfile.

Acceptance criteria

  • cargo build --workspace passes with the approved lockfile.
  • cargo test --workspace passes using the documented host target.
  • cargo audit passes in CI and locally through the documented command.
  • The provenance verifier fails in tests/CI for an unapproved Git URL, package, tag, or resolved commit, and passes for the approved dependency graph.
  • All OpenZeppelin Git packages resolve to one documented immutable commit, or their crates.io replacement and version constraints are documented and tested.
  • The policy manifest and Cargo.lock are synchronized; a stale manifest or lockfile mismatch fails deterministically.
  • Advisory exceptions are checked in, justified, time-bounded, and cause CI failure after expiry.
  • CI has separate, visible provenance, audit, build, test, clippy, and format evidence.
  • README/security documentation explains dependency updates, audits, provenance verification, incident rollback, and the exact local commands.
  • The implementation does not silently change the deployed contracts' public API or token/marketplace behavior.

Non-goals

  • Replacing every third-party dependency or building a custom package registry.
  • Claiming a Git tag alone is immutable provenance.
  • Suppressing audit findings without a time-bounded, reviewed exception.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions