Skip to content

The published package is never compiled as published, and ships a file whose import it excludes #76

Description

@thedavidmeister

Audit scope: whole-repo, commit 7aa85a4

Dimension 6 (hazard surface) · severity medium

Where

  • .soldeerignore:1-20
  • script/Build.sol:8
  • .github/workflows/package-release.yaml:1-11

Problem

Three reviewers found this independently, from three different artifacts:
the published 0.1.11 zip (twice) and a vendored 0.1.6 at
/home/gildlab/code/rain-deploy-15a/dependencies/rain-sol-codegen-0.1.6.

.soldeerignore is a second, hand-maintained definition of "what this library
is", disjoint from the source graph forge build compiles. Nothing checks the
two agree, so the published artifact can be broken or incomplete with a green
main.

.soldeerignore excludes /test but not /script or src/generated.
script/Build.sol:8 imports {CodeGennable} from "../test/concrete/CodeGennable.sol". The published zip contains
script/Build.sol and src/generated/CodeGennable.sol, and no test/. The
shipped script/Build.sol therefore cannot compile in any consumer. No CI step
ever builds the filtered tree, so this has been true across releases with no red.

Nothing breaks today because foundry only compiles dependency files something
imports — but the repo's only worked example of the library, the thing a
consumer copies, cannot be compiled from the package.

The latent import is the symptom; the shape is what lands next. Add
src/lib/LibNewThing.sol imported by LibCodeGen.sol, and add any
.soldeerignore pattern that happens to match it (the file already mixes
anchored /audit with unanchored .github, so pattern edits are easy to get
wrong) — the package publishes without it, every consumer's forge build breaks
on the next soldeer install, and this repo's own CI stays green because the
local tree is complete.

Proposed fix

Two halves:

  1. Compile the package as published, in CI, on every push — a job that unpacks
    what .soldeerignore would ship into a scratch project and builds it, failing
    on any unresolved import.
  2. Remove the inconsistency now: either move CodeGennable to
    src/concrete/CodeGennable.sol (its generated counterpart
    src/generated/CodeGennable.sol already ships) and update the imports in
    script/Build.sol, test/lib/LibFs.buildFileForContract.t.sol:8 and
    test/lib/LibCodeGen.bytecodeHashConstantString.t.sol:8 (both test/src/lib/
    after Move every .t.sol into the test/src/lib mirror tree #56) — or add
    /script to .soldeerignore, which drops the example from the package
    altogether.

Metadata

Metadata

Labels

auditAudit findingmediumAudit findingpass6Audit finding

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions