saltstack / saltstack/salt

[BUG] Wheel `key.accept` report success even if it did not accepted anything

Open
#63,477 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

When I use wheel key.accept module on a minion that does not exists it returns a success

Setup

Really basic setup

Steps to Reproduce the behavior

$ salt-call saltutil.wheel key.accept invalid-minion
local:
    ----------
    _stamp:
        2023-01-13T10:06:04.503984
    fun:
        wheel.key.accept
    fun_args:
        - invalid-minion
    jid:
        20230113100604497168
    return:
        ----------
    success:
        True
    user:
        UNKNOWN

Expected behavior

Either an exception saying that there is no minion matching it, either the success field set to False

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3002.9
 
Dependency Versions:
          cffi: 1.11.5
      cherrypy: unknown
      dateutil: 2.6.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.10.1
       libgit2: Not Installed
      M2Crypto: 0.35.2
          Mako: Not Installed
       msgpack: 0.6.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.14
      pycrypto: Not Installed
  pycryptodome: Not Installed
        pygit2: Not Installed
        Python: 3.6.8 (default, Nov  8 2022, 11:32:15)
  python-gnupg: Not Installed
        PyYAML: 6.0
         PyZMQ: 19.0.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: rocky 8.7 Green Obsidian
        locale: UTF-8
       machine: x86_64
       release: 4.18.0-372.32.1.el8_6.x86_64
        system: Linux
       version: Rocky Linux 8.7 Green Obsidian

Additional context
Add any other context about the problem here.

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 reproducing the reported salt-call saltutil.wheel key.accept invalid-minion command and trace the wheel.key.accept entry point. Inspect how it determines success for a nonexistent minion and locate the related test area, if present. Done means the command no longer reports success when no key was accepted and regression coverage verifies the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.