[hotfix][java][python] Harden Bash arithmetic evaluation - #1083
Merged
wenjin272 merged 1 commit intoSep 2, 2026
Merged
Conversation
Reject declaration commands, arithmetic expansions, and standalone variable assignments that Bash can reinterpret outside the validated AST. Add mirrored Java and Python regression coverage. Generated-by: Codex (GPT-5) Co-authored-by: Codex <[email protected]>
wenjin272
marked this pull request as ready for review
September 2, 2026 01:40
wenjin272
added a commit
that referenced
this pull request
Sep 2, 2026
Generated-by: Codex (GPT-5) Co-authored-by: Codex <[email protected]> (cherry picked from commit 388d4b8)
5 tasks
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.
Linked issue: N/A (hotfix)
Purpose of change
Bash can reinterpret values during integer declarations and arithmetic expansion after the original command has passed AST validation. This creates execution paths that are not covered by the command allowlist.
This change applies the same fail-closed policy in Java and Python:
This intentionally makes validation stricter: benign declaration commands, arithmetic expansions, and standalone assignments are also rejected.
Tests
pytest -q python/flink_agents/plan/tools/bash/tests/test_bash_tool.py(46 passed)mvn -pl plan -am -DskipITs -Dtest=BashValidatorTest,BashToolTest -Dsurefire.failIfNoSpecifiedTests=false test(21 passed)JAVA_HOME=/Users/jhin/Kit/jdk-17.0.2.jdk/Contents/Home mvn -pl plan -am -DskipITs test(713 tests, 0 failures/errors, 12 skipped)ruff checkandruff format --checkfor the changed Python filesgit diff --checkAPI
No public API changes. Bash tool validation behavior is intentionally stricter.
Documentation
doc-neededdoc-not-neededdoc-includedWas this patch authored or co-authored using generative AI tooling?
Generated-by: Codex (GPT-5)