Skip to content

aid reads DEVLAUNCH_AID_AGENT with the call osext exists to replace #402

Description

@blooop

Finding

aid/src/main.rs:92 reads DEVLAUNCH_AID_AGENT with the call osext exists to replace:

std::env::var(rewrite::AGENT_ENV_VAR).ok().as_deref(),

osext.rs:11-13 names the hazard: std::env::var(..).ok() reports a non-UTF-8 value as unset. So a DEVLAUNCH_AID_AGENT holding undecodable bytes silently selects the default agent instead of refusing with UnknownAgentInEnvironment — the refusal rewrite::default_agent (aid/src/rewrite.rs:244) exists to give.

This is the same class as the DEVLAUNCH_NO_TTY divergence fixed in b52f4fa, with a milder consequence: a wrong agent rather than an inverted opt-out. Filed rather than fixed alongside it because the fix is not local — aid depends on dl and not on devlaunch-core (deliberately: aid/src/main.rs:20-26), so the correct reader has to be re-exported one more level, and that is surface churn worth deciding on rather than smuggling into a bug fix.

Shape

Either re-export the reader through dl the way shell and python_repr already are (dl/src/lib.rs:44,51), or have rewrite take the already-decoded value and let dl do the reading. The second keeps aid's dependency story intact.

While there: osext is still pub(crate) apart from the one wrapper b52f4fa exposed. Every future binary-side environment read has the same trap set for it, and the general fix is to make osext binary surface — the tier clients, domain and flows already sit in.

Proving it

DEVLAUNCH_AID_AGENT=$'\xff' should refuse by name, not fall through to the default.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions