Conversation
…tion
Security fix: Replace eval() with safe getattr() method in _convert_cookiejar_to_render()
to extract cookie attributes. This eliminates a security vulnerability and improves
code maintainability.
Changes:
- Replace eval("cookiejar."+key) with getattr(cookiejar, key, None)
- Improve error handling: bare except -> except Exception
- Maintains full backward compatibility
Tested against existing test suite - all non-async tests pass (18/18).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Hi maintainers — while preparing this PR I noticed two earlier PRs already proposed the same fixes independently, both still unmerged after months: #610 ( Combined with 242 open issues and no commits to If that's the case — no worries, If I'm wrong and this is still active, apologies for the noise, and happy to close this however makes sense. |
Description
Fixes a security vulnerability in the
_convert_cookiejar_to_render()method whereeval()was used to extract cookie attributes.Security Impact
eval()to dynamically access attributes (security risk)getattr()for safe attribute extractionChanges Made
eval("cookiejar." + key)withgetattr(cookiejar, key, None)except:→except Exception:Testing
getattr()works correctlyType of Change
Checklist
🤖 Generated with Claude Code