saltstack / saltstack/salt

[BUG] `git.latest` function can fail if `fetch_url` is `None`

Open
#66,537 1 comment 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

Description

https://github.com/saltstack/salt/blob/551e7c4b0456ca520c04cb2b8c7d3030b34afdce/salt/states/git.py#L1144-L1158

I wonder that it is required to check fetch_url is None at line 1151 because the function redact_http_basic_auth at line 1155 does not allow None type and raises TypeError.
It is the result of my type checker, so I wanted to provide test cases but I couldn't.
If this is the correct behavior, I apologize for taking your time.

Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)

Please be as specific as possible and give set-up details.

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD
  • classic packaging
  • onedir packaging
  • used bootstrap to install

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 in salt/states/git.py at lines 1144-1158 and inspect how git.latest handles a None fetch_url before calling redact_http_basic_auth. Reproduce the type-checker case and add regression coverage showing that the function no longer raises TypeError when fetch_url is None.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.