Skip to content

rfc15: update and tighten description of IMP environment passed to the job shell and run targets - #560

Merged
mergify[bot] merged 3 commits into
flux-framework:masterfrom
grondo:imp-env
Oct 15, 2026
Merged

mergify[bot] merged 3 commits into
flux-framework:masterfrom
grondo:imp-env

Conversation

@grondo

@grondo grondo commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Problem: RFC 15 doesn't fully specify the environment passed to the job shell, which allows the implementation to pass the full environment to the job shell from an untrusted source. For the 'imp run' case, the environment is too minimal which encourages the use of globs in allowed-environment, which results in arbitrary and unnecessary environment variables passed to processes running as root.

Update and tighten the set of environment variables propagated via 'run' an 'exec' by the IMP:

  1. Add FLUX_JOB_RANKS to the default set of environment variables passed by run. This is the sole environment variable found by inspection that necessitates FLUX_* in allowed-environment, so now use of allowed-environment can be dropped in most cases and globbing discouraged.
  2. Restrict the environment for exec so that only necessary environment variables are passed through the IMP to the job shell.
  3. Specify FLUX_IMP_EXEC_USERID to contain the userid that invoked the IMP. This will allow the job shell to securely determine when it is being run within an instance as a guest user, rather than trusting the instance security.owner.

@github-actions

Copy link
Copy Markdown

⚠️ linkcheck failed with status code 2

@garlick garlick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@mergify

mergify Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

Problem: The default set of environment variables passed through by
`flux-imp run` is specified as FLUX_JOB_ID and FLUX_JOB_USERID, but
the job manager also sets FLUX_JOB_RANKS in the environment of prolog,
epilog, and housekeeping commands. Sites that want it must set
allowed-environment, and the common advice to use a glob such as
"FLUX_*" opens a hole, since every variable named there is supplied by
the unprivileged instance owner and lands in the environment of a
command running as root.

Add FLUX_JOB_RANKS to the default set so that the defaults match what
the job manager supplies and allowed-environment is not needed for the
commands provided with Flux. State that the environment SHALL NOT be
otherwise inherited, and that PATH is set by the IMP and SHALL NOT be
overridden by this key. Add a note discouraging glob patterns.

Assisted-by: Claude:opus-5
Problem: RFC 15 does not specify the environment the IMP passes to
the job shell. The IMP is invoked by the instance owner and spawns
the shell as a guest user, so its inherited environment is tainted
input in the same sense as J, which the spec is otherwise careful
about. Left unspecified, an implementation may pass the environment
through unmodified, which allows the instance owner to set variables
naming a search path for an executable or shared object, and so run
arbitrary code as the guest user.

Specify the environment inherited by the job shell in the spec.
Include the motivations for the restrictions for reference.

Assisted-by: Claude:opus-5
Problem: A job shell may need to know whether the enclosing instance
is running as a different user than itself, but it has no trustworthy
source for this. The spec does not describe any mechanism by which
the IMP conveys this, and the preceding section restricts the job
shell environment to a closed list that an IMP-supplied variable
does not fit.

Require the IMP to set FLUX_IMP_EXEC_USERID in the environment of
the job shell to the user ID under which it was invoked, and add
variables set by the IMP to the list of what the job shell environment
may contain. Require that the IMP determine the value itself and set
it unconditionally, so an inherited value cannot be mistaken for it.

Assisted-by: Claude:opus-5
@mergify

mergify Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-15 16:01 UTC · Rule: default · triggered by rule rebase and merge when passing all checks
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-10-15 16:01 UTC · at 85a196a0a34a528eec174c625d520d55c50d2397 · merge

This pull request spent 13 seconds in the queue, including 1 second running CI.

Required conditions to merge

@mergify
mergify Bot merged commit 85a196a into flux-framework:master Oct 15, 2026
7 of 8 checks passed
@mergify mergify Bot removed the queued label Oct 15, 2026
@github-actions

Copy link
Copy Markdown

⚠️ linkcheck failed with status code 2

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants