Skip to content

Swift lanes honest-miss package-linked decision functions (isolated single-file compile can't reach them) #72

Description

@anagnorisis2peripeteia

Problem

The Swift lanes — including the new differential-oracle-swift (#71) and the existing command-injection/path-traversal/ssrf Swift lanes — compile the target file + a generated driver in isolation (swiftc Target.swift main.swift). A decision function (or sink entrypoint) that needs the rest of its SwiftPM package to compile — it imports another module, calls a package-internal symbol, or has a required non-defaulted parameter typed by a package enum — never builds, so the lane reports an honest miss and silently skips it.

The consequence: the most security-relevant functions in a real target are exactly the ones that live in package-linked modules, so they get discovered as candidates but 0-driven. A "0 divergences / 0 findings" result there is a compile-miss, not a clean bill.

Evidence (from the #71 runs)

  • Peekaboo MCPFilesystemGuard.resolve(_ rawPath: String, access: Access, roots: [URL] = …) — the required access: parameter (a package enum with no default) means the single-first-String-arg driver generates resolve(payload), which won't compile. The confinement decision the lane exists to test is unreachable.
  • CodexBar GatekeeperAssessment.isLaunchCandidateAllowed(path:) (Sources/CodexBarCore/PathEnvironment.swift) — compiling the file alone fails: error: cannot find 'SpawnedProcessGroup' in scope (+ other CodexBarCore symbols). The launch-approval gate is unreachable.
  • Net: both repos returned 0 oracle divergences, but neither marquee gate was actually exercised.

Proposal

A package-build oracle/driver mode: instead of swiftc-ing one file, swift build the target's SwiftPM package, then compile a small driver target/executable that imports the module and calls the discovered decision function against the built artifacts — mirroring the .NET lane's "project-build + reflection-invoke" path. Additionally:

  • Synthesize plausible values for required non-String params (an enum param → a case such as .write; a defaulted param → omit).
  • Fall back to the current isolated compile when the target isn't a resolvable SwiftPM package.

Impact

Without this, the Swift oracle (and Swift lanes generally) can only reach Foundation-only, single-untrusted-String-arg functions — a small slice of real targets. The package-build path is what lets the lanes exercise the confinement/launch gates that actually matter.

Surfaced while running #71 on Peekaboo + CodexBar.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions