Skip to content

Environment import is an unencoded entry point: inherited user values are interpreted as live carrier protocol #2884

Closed

Description

@caomengxuan666

Summary

Process environment import is the one entry point that stores incoming values without entry escaping. Inherited user variables are therefore interpreted as live carrier protocol. GNU keeps all values verbatim (it has no transport domain). Found by the #2879 systematic carrier-protocol sweep (env-import battery, 1/4 pass; captain spot-verified symptom 1).

Parent sets the variable before exec; rubash behavior:

Parent value rubash GNU
bare U+E314 expansion/length keep it, but declare -p prints v="" — the bare PARAM_WORD_BACKSLASH_GUARD is consumed by the display decoder's guard arm verbatim
U+E400 + U+E314 (pair-shaped data) collapses to 1 char on expansion (${#v} = 1); set prints the stored pair, declare -p the decoded char kept as 2 chars
raw ESC byte (A<ESC>B) declare -p prints v="AB" with a raw ESC inside the quotes (its own set listing prints $'A\EB' correctly) declare -p → v=$'A\EB'

One root, three symptoms: foreign values enter the transport domain unescaped, so bare registry chars in them are live protocol and pair-shaped data is decoded as protocol.

Scoping (important)

Values inherited from a rubash parent (respawn/nesting) deliberately rely on transport interpretation for the __RUBASH_* machinery — that interpretation stays. The gap is user variables; the internal namespace is already distinguishable by name.

Fix destination (1.5.1 — sweep item E3)

Entry-encode user environment variables at import, at parity with bytes_to_script_text; keep __RUBASH_* transport interpretation. Golden cells = the three diffs above. Repro: ~/workspace/pua-audit/probes/work/env_import.sh.

Activity

  1. added this to the 1.5.1 milestone on Nov 6, 2026
  2. added
    bug
    gnu-baseline
    area:expansion
    on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:expansionbuggnu-baseline

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions