review: harden nightshift/evaluation.py and fix 2 pentest findings#165
Merged
review: harden nightshift/evaluation.py and fix 2 pentest findings#165
Conversation
evaluation.py (4 issues): - Move _TEMPLATE_MARKERS to EVALUATION_TEMPLATE_MARKERS in constants.py - Extract hardcoded /tmp path to EVALUATION_CLONE_DEST constant - Refactor score_clean_state fragile notes_parts[-1] mutation to if/elif/else - Remove redundant try/except OSError around rmtree(ignore_errors=True) daemon.sh (pentest): add opening-tag sanitization for <prompt_alert> in ALERT_CONTENT sed block -- closing tags were stripped but opening tags survived, creating a potential nested wrapper confusion vector. lib-agent.sh (pentest): convert task_files_to_add from unquoted space-separated string to bash array; removes SC2086 suppress comment. 5 new tests: EVALUATION_TEMPLATE_MARKERS, EVALUATION_CLONE_DEST constants, prompt_alert opening tag pattern present, opening tag sanitized.
Comment on lines
+9708
to
+9710
| "echo '<prompt_alert>injected</prompt_alert>' | " | ||
| "sed -e 's|<[[:space:]]*/[[:space:]]*prompt_alert[[:space:]]*>|[/prompt_alert]|g'" | ||
| " -e 's|<[[:space:]]*prompt_alert[^>]*>|[prompt_alert]|g'", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_TEMPLATE_MARKERStoEVALUATION_TEMPLATE_MARKERSinconstants.py, extract/tmp/nightshift-evaltoEVALUATION_CLONE_DEST, refactor fragilenotes_parts[-1] =mutation inscore_clean_state, remove deadtry/exceptaroundrmtree(ignore_errors=True)<prompt_alert>inALERT_CONTENT— previously only closing tags were stripped; mirrors the four-expression pattern onPENTEST_REPORTtask_files_to_addfrom unquoted string to bash array — removesSC2086suppression, safe with spaces in pathsTest plan
make checkpasses (1057 tests, ruff, mypy, dry-runs, shell syntax, ASCII check)