🛡️ Sentinel: Improve control character detection in input validation#102
Conversation
…lidation Updated input validation in `project/app.py` and `scripts/rename.py` to use `str.isprintable()` instead of a naive ASCII range check (`c < " "`). This ensures that the `DEL` character (0x7f) and other non-printable characters are correctly identified and rejected, mitigating risks of terminal injection or UI manipulation. Added a test case in `tests/test_app.py` to verify the fix for the `DEL` character.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
…lidation (Addressed feedback) - Replaced naive ASCII range check (`c < " "`) with `str.isprintable()` for robust control character detection. - Updated `project/app.py` and `scripts/rename.py`. - Added a test case in `tests/test_app.py` for the `DEL` character. - Removed unnecessary comment in `tests/test_app.py` as per review feedback.
The input validation for control characters was using a naive check
c < " ", which only caught characters in the range 0x00-0x1F. This missed theDELcharacter (0x7F) and other non-printable Unicode characters.I replaced this check with
not c.isprintable()in bothproject/app.pyandscripts/rename.py.Verified the fix with a new test case in
tests/test_app.pyand by running the full test suite.PR created automatically by Jules for task 11125674854379474649 started by @amrabed