Skip to content

Commit 151c929

Browse files
committed
Mark non-cryptographic random.Random seeds with # nosec B311
The bandit security job flagged three pre-existing B311 sites (the random-value flow command and humanized motion/typing jitter). None are security-sensitive; annotate them so the security gate passes on this branch too.
1 parent 347ec1e commit 151c929

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

je_auto_control/utils/executor/flow_control.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ def exec_random_to_var(executor: Any,
406406
args: Mapping[str, Any]) -> Dict[str, Any]:
407407
"""Store a random value (int / float / choice) in a flow variable."""
408408
import random
409-
rng = random.Random(args.get("seed"))
409+
rng = random.Random(args.get("seed")) # nosec B311 # reason: non-crypto test data
410410
kind = str(args.get("kind", "int"))
411411
if kind == "choice":
412412
value: Any = rng.choice(list(args.get("choices") or [None]))

je_auto_control/utils/humanize/motion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def humanized_path(start: Point, end: Point,
6060
is set.
6161
"""
6262
motion = motion or HumanizedMotion()
63-
rng = random.Random(motion.seed)
63+
rng = random.Random(motion.seed) # nosec B311 # reason: non-crypto motion jitter
6464
sx, sy = float(start[0]), float(start[1])
6565
ex, ey = float(end[0]), float(end[1])
6666
dx, dy = ex - sx, ey - sy

je_auto_control/utils/humanize/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def humanized_key_delays(text: str, *, base_delay: float = 0.05,
2020
``pause_chance`` probability of an extra ``pause_delay`` (a human
2121
pausing to think). Deterministic when ``seed`` is set.
2222
"""
23-
rng = random.Random(seed)
23+
rng = random.Random(seed) # nosec B311 # reason: non-crypto typing jitter
2424
delays: List[float] = []
2525
for _ in text:
2626
delay = max(0.0, base_delay + rng.uniform(-jitter, jitter))

0 commit comments

Comments
 (0)