Skip to content

bin/dev: self-defending entrypoint — scrub foreign bundler activation before Ruby boots #94

Description

@JPDuchesne

Third member of the harness-env-leak family (ai-flow#38, ai-flow#44, dev#89): any harness that runs under bundle exec and shells out to dev leaks RUBYOPT=-r.../bundler/setup + BUNDLE_GEMFILE into the child, and the interpreter activates the caller's bundle before bin/dev's first line runs — dev then can't load its own gems (LoadError: cannot load such file -- cli/ui, observed live in ai-flow#44).

dev vendors its own gems and picks its own Ruby; there is no caller whose bundler activation it ever wants. So instead of every caller patching every spawn site, bin/dev should defend itself: the sh shim unsets the bundler-activation keys (RUBYOPT, RUBYLIB, BUNDLE_*) before probing for / exec'ing Ruby. Callers' scrubs (ai-flow's HarnessEnv, dev#90's HARNESS_ENV_SCRUB) become defense-in-depth instead of load-bearing.

Scope note: GEM_HOME/GEM_PATH stay untouched — they are legitimate user config, and the one place they redirect resolution into an ephemeral cache is already guarded (dev#90).

Metadata

Metadata

Assignees

No one assigned

    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