saltstack / saltstack/salt

[Bug]: saltutil.runner drops privileges to the salt-api eauth user during orchestration

Open
#70,251 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

What happened?

saltutil.runner drops privileges to the salt-api eauth user during orchestration.
master_user_runas() reads opts["user"], which state.orchestrate overwrites with the publishing user. The pwd.getpwnam() guard added in #69600 only filters synthetic sudo values; PAM/LDAP eauth users are real local accounts, so master-side runners execute under the API caller's uid instead of the master daemon's.
Repro: master running as root, orchestration invoked via salt-api as a PAM user, orch contains a salt.runner state.
Symptom is obscured by a second bug: SyncClientMixin.low() references proc_fn in its finally block before it is assigned, so the real exception is replaced by UnboundLocalError: cannot access local variable 'proc_fn'.

Type of salt install

Official deb

Major version

3008.x

What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)

centos-stream-9, windows-2022, windows-2025, debian-13, amazonlinux-2023, rhel-9, ubuntu-22.04

salt --versions-report output
Salt Version:
            Salt: 3008.2

Python Version:
          Python: 3.14.6 (main, Jun 11 2026, 02:19:05) [GCC 11.2.0]

Dependency Versions:
            cffi: 2.0.0
        cherrypy: 18.10.0
    cryptography: 48.0.0
        dateutil: 2.9.0.post0
       docker-py: Not Installed
           gitdb: 4.0.12
       gitpython: 3.1.50
          Jinja2: 3.1.6
         libgit2: Not Installed
    looseversion: 1.3.0
        M2Crypto: Not Installed
            Mako: Not Installed
         msgpack: 1.1.2
    msgpack-pure: Not Installed
    mysql-python: Not Installed
       packaging: 24.0
       pycparser: 3.00
        pycrypto: 3.23.0
    pycryptodome: 3.23.0
          pygit2: Not Installed
    python-gnupg: 0.5.6
          PyYAML: 6.0.3
           PyZMQ: 27.1.0
          relenv: 0.22.14
           smmap: 5.0.2
         timelib: 0.3.0
         Tornado: 6.5.7
             ZMQ: 4.3.5

Salt Extensions:
 saltext.azurerm: 4.4.1

Salt Package Information:
    Package Type: onedir

System Versions:
            dist: ubuntu 22.04.5 jammy
          locale: utf-8
         machine: x86_64
         release: 6.8.0-1053-aws
          system: Linux
         version: Ubuntu 22.04.5 jammy

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing _master_user_runas() through state.orchestrate and the salt-api PAM/LDAP execution path, then inspect SyncClientMixin.low() and the guard introduced in #69600. Reproduce with a root master, a PAM eauth user, and an orchestration containing a salt.runner state. Done means master-side runners retain the daemon identity and the underlying exception is no longer replaced by UnboundLocalError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.