Skip to content

Fix security issues: remove eval(), use secrets for crypto, pin CI actions#2739

Merged
keon merged 3 commits intomainfrom
fix/security-crypto-eval
Mar 13, 2026
Merged

Fix security issues: remove eval(), use secrets for crypto, pin CI actions#2739
keon merged 3 commits intomainfrom
fix/security-crypto-eval

Conversation

@keon
Copy link
Owner

@keon keon commented Mar 12, 2026

Summary

Test plan

  • python -m pytest tests/test_math.py tests/test_linked_list.py -x -q — 62 tests pass
  • No eval() remaining in codebase
  • No import random in crypto modules
  • All CI actions pinned to SHAs

Closes #2728, #2729, #2730, #2731, #2733

🤖 Generated with Claude Code

keon and others added 3 commits March 12, 2026 11:07
…tions

- Remove eval() in kth_to_last_eval, replace with safe iterative loop (#2728)
- Replace random module with secrets in rsa.py, diffie_hellman_key_exchange.py,
  rabin_miller.py for cryptographically secure RNG (#2729)
- Replace unbounded _modinv while-loop with extended Euclidean algorithm
  that raises ValueError on non-coprime inputs (#2730)
- Pin all GitHub Actions in publish.yml to commit SHAs (#2731)
- Fix float division num /= 2 → num //= 2 in rabin_miller.py and
  correct _pow2_factor return type annotation (#2733)

Closes #2728, closes #2729, closes #2730, closes #2731, closes #2733

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Make _extended_gcd iterative to prevent RecursionError on large keys
- Fix pypa/gh-action-pypi-publish SHA to correct commit hash

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@keon keon merged commit a1bf1f3 into main Mar 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: Remove eval() usage in linked_list/kth_to_last.py

1 participant