Skip to content

Commit

Permalink
[orion-ci] Strip out C:\Users\Administrator from PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
jschwartzentruber committed Jun 18, 2024
1 parent a2fc04a commit 8ec8c50
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions services/orion-decision/src/orion_decision/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,22 @@ def ci_launch() -> None:
"""CI task entrypoint."""
args = parse_ci_launch_args()
configure_logging(level=args.log_level)
# copy environment and filter out `Administrator` paths
# which we shouldn't have access to
# this broke tox either in 4.15 or when some permission thing changed
# in the Windows AMI
env = os_environ.copy()
if "PATH" in env:
env["PATH"] = ";".join(
p
for p in env["PATH"].split(";")
if p
# check if path starts with `\Users\Administrator\`
# skipping drive (parts[0]) and ignoring case
# this only works on English machines ¯\_(ツ)_/¯
and [pt.casefold() for pt in Path(p).resolve().parts[1:3]]
== ["users", "administrator"]
)
# fetch secrets
LOG.info("Fetching %d secrets", len(args.job.secrets))
for secret in args.job.secrets:
Expand Down

0 comments on commit 8ec8c50

Please sign in to comment.