Skip to content

Commit 0e45785

Browse files
committed
Address a bunch of minor linting issues
* Don't overload the builtin `input` * Tell _ruff_/_bandit_ that I trust my `subprocess.run()` * Provide a full path for the _ssh-keygen_ binary * Skip redundant `open` `mode` argument
1 parent c8e37b8 commit 0e45785

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

vault_oidc_ssh_cert_action.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ def _check_inputs() -> None:
3636
"vault_server",
3737
]
3838
missing_inputs: list[str] = []
39-
for input in required_inputs:
40-
if not os.environ.get(input.upper(), "").strip():
41-
missing_inputs.append(input)
39+
for input_name in required_inputs:
40+
if not os.environ.get(input_name.upper(), "").strip():
41+
missing_inputs.append(input_name)
4242

4343
if not missing_inputs:
4444
return
@@ -153,12 +153,21 @@ def _generate_and_sign(
153153
work_pub_path = os.path.join(workdir, f"{key_fname}.pub")
154154
work_cert_path = os.path.join(workdir, cert_fname)
155155

156-
subprocess.run(
157-
["ssh-keygen", "-q", "-t", "ed25519", "-N", "", "-f", work_key_path],
156+
subprocess.run( # noqa: S603
157+
[
158+
"/usr/bin/ssh-keygen",
159+
"-q",
160+
"-t",
161+
"ed25519",
162+
"-N",
163+
"",
164+
"-f",
165+
work_key_path,
166+
],
158167
check=True,
159168
)
160169

161-
with open(work_pub_path, mode="r", encoding="utf-8") as pubkf:
170+
with open(work_pub_path, encoding="utf-8") as pubkf:
162171
pubkey = pubkf.read()
163172

164173
ssh_cert: str = _issue_ssh_cert(

0 commit comments

Comments
 (0)