Skip to content

feat(assail): exempt Julia *Ext.jl from DynamicCodeExecution (idiomatic package-extension pattern)#71

Merged
hyperpolymath merged 1 commit into
mainfrom
rule/dynamic-code-execution-julia-ext-exemption
May 27, 2026
Merged

feat(assail): exempt Julia *Ext.jl from DynamicCodeExecution (idiomatic package-extension pattern)#71
hyperpolymath merged 1 commit into
mainfrom
rule/dynamic-code-execution-julia-ext-exemption

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Summary

Adds a small predicate at the analyze_julia DCE detection site that subtracts the Julia package-extension idiom: *Ext.jl files and the conventional ext/<Name>.jl directory layout. These files use eval / Meta.parse legitimately as part of the language's extension mechanism.

Mirrors the shape of #53 (JSON-LD InsecureProtocol exemption) — small guard inline at the detector, plus regression tests for the exempt and non-exempt cases.

Motivation

julia-ecosystem#6 logged 209 panic-attack findings of which ~202 were this exact pattern. Without an exemption, every Julia repo with a single package extension produces a flood of false positives that drowns out real findings.

Changes

  • src/assail/analyzer.rs (analyze_julia): guard adds is_julia_package_extension check matching *Ext.jl / ext/ / /ext/ paths before pushing the DynamicCodeExecution WeakPoint.
  • New tests in #[cfg(test)] mod tests:
    • julia_ext_jl_dce_is_exempt — `FooExt.jl` with `Meta.parse` is exempt
    • julia_ext_dir_dce_is_exempt — `ext/MyExtension.jl` with `eval` is exempt
    • julia_regular_file_still_flags_eval — non-extension file still flags

Test plan

  • `cargo test --lib julia_` — all 3 new tests pass locally
  • CI green
  • Re-scan julia-ecosystem to confirm ~202 findings drop

🤖 Generated with Claude Code

Julia's package-extension mechanism uses `eval` and `Meta.parse` as a
core idiom in `*Ext.jl` files (and the conventional `ext/<Name>.jl`
layout). Treating these as DCE findings produces mass false positives
in any Julia repository — julia-ecosystem#6 logged 209 findings with
~202 of them this pattern.

Match the shape of PR #53 (JSON-LD InsecureProtocol exemption): add a
small predicate at the detection site that subtracts the known-
idiomatic pattern before the WeakPoint is constructed. Regression
tests cover the *Ext.jl filename, ext/ directory, and non-extension
control case (which must still flag).

Closes the bulk of julia-ecosystem#6.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hyperpolymath hyperpolymath enabled auto-merge (squash) May 27, 2026 13:49
@hyperpolymath hyperpolymath merged commit 1811b7b into main May 27, 2026
0 of 26 checks passed
@hyperpolymath hyperpolymath deleted the rule/dynamic-code-execution-julia-ext-exemption branch May 27, 2026 14:32
hyperpolymath added a commit that referenced this pull request May 27, 2026
…72 after force-push race) (#77)

Refile of #72 after a botched rebase pushed the wrong HEAD and
auto-closed the original PR. Same intent: exclude .yarn,
idaptik-rescript13-staging, rescript-ecosystem from analysis. Resolved
conflict in src/assail/analyzer.rs by merge-both (kept #71's Julia
*Ext.jl tests + this PR's vendored-snapshot tests).

Closes #72 (refiled).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request May 27, 2026
…ansitive (#75) (#78)

## Summary

Two layered refinements on top of #76 (phantom-declared /
phantom-transitive split). Same three-way
Mitigable/Unmitigable/Informational output, but the Informational tier
now produces an accurate \`action\` field for two cohorts where the
generic message was misleading.

Closes #74 in part (build-script-only /
vendored-pin name-list portion).
Closes #75.

## Cohort E-3 — build-script-only / vendored-pin (#74, partial)

A naive \`cargo machete --fix\` strip of certain phantom-declared crates
breaks the build inscrutably (cross-compile TLS, native-lib resolution,
build-time codegen). New \`is_build_script_only_or_vendored_pin(name)\`
predicate covers crates that **have no \`use\` site by design**:

- Build-script side-effect crates: \`pkg-config\`, \`cc\`, \`bindgen\`,
\`cmake\`, \`autocfg\`, \`vcpkg\`, \`winres\`, \`embed-resource\`
- Canonical vendored-pin: \`openssl-src\`

When a phantom-declared crate matches, the action flips from \"Strip
from Cargo.toml\" to \"DO NOT STRIP — load-bearing via build.rs
side-effects or native-lib linkage\".

**Future follow-up**: feature-based detection (e.g. \`openssl-sys = {
features = [\"vendored\"] }\`) needs feature-set plumbing through
\`ReachabilityEvidence\` — left out of scope.

## Cohort E-2 — Dioxus/GTK transitive (#75)

Phantom-transitive advisories where the parent is in the Dioxus desktop
family (\`wry\`, \`dioxus-desktop\`, \`dioxus\`) and the affected crate
is in the GTK/webkit family now get a Cohort E-2 message naming the
no-local-fix path (wait for parent release, or swap the desktop
renderer). Sub-rule covers \`printpdf\`→\`kuchiki\`.

GTK/webkit family matched: \`atk*\`, \`gdk*\`, \`gtk*\`, \`glib\`,
\`glib-sys\`, \`gio\`, \`gio-sys\`, \`gobject-sys\`, \`gtk3-macros\`,
\`proc-macro-error\`, \`paste\`, \`fxhash\`, \`webkit2gtk\`,
\`webkit2gtk-sys\`.

## Bonus repair: src/assail/analyzer.rs test-module corruption

The squash-merge sequence of PRs #71 (Julia) → #77 (refile of #72
vendored-snapshot) → #73 (flake.lock) left \`src/assail/analyzer.rs\`
with an unclosed-delimiter at line 7962:

- \`count_julia_dce\` had \`flake_findings\` body
- \`julia_ext_jl_dce_is_exempt\` was missing closing braces
- Two flake tests (\`flake_without_lock_is_low_severity\`,
\`flake_with_narhash_has_no_finding\`) had landed inside the Julia
section

\`cargo test --lib\` was failing to compile on main as a result. This PR
reassembles each section in its intended location; no test logic
changed.

## Test plan

- [x] \`cargo test --features http --lib bridge::classify::\` — 14/14
pass (5 new + 9 existing)
- [x] \`cargo test --features http --lib\` — 343 lib tests pass (was
previously failing to compile)
- [x] \`cargo check --features http\` — green

## Changes

- \`src/bridge/classify.rs\`: +268 / -29 lines (3 predicate fns + 2
cohort override branches + 5 regression tests)
- \`src/assail/analyzer.rs\`: +/-109 lines, net wash (reassemble
corrupted test sections)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant