Commit 06d995e
fix: Address Gemini Code Assist review — shell injection, shlex, check=True
1. Shell injection (HIGH): Use shlex.split() and pass args as separate
list elements to subprocess.run instead of concatenating into bash -c
command string. Args now arrive as positional params ($1, $2, ...).
2. Fragile arg parsing (MEDIUM): Replace .split() with shlex.split() for
Python script sys.argv injection — correctly handles quoted arguments
like --name "John Doe".
3. Status detection (MEDIUM): Add check=True to subprocess.run in shell
wrapper so non-zero exit codes raise CalledProcessError, which the
code executor captures as stderr.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent d019e0b commit 06d995e
File tree
3 files changed
+21
-14
lines changed- contributing/samples/skill_script_demo
- src/google/adk/tools
- tests/unittests/tools
3 files changed
+21
-14
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
244 | 245 | | |
245 | 246 | | |
246 | 247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
396 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
397 | 398 | | |
398 | 399 | | |
399 | 400 | | |
400 | 401 | | |
401 | | - | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
402 | 406 | | |
403 | | - | |
| 407 | + | |
404 | 408 | | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
414 | 417 | | |
415 | 418 | | |
416 | 419 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
476 | | - | |
| 476 | + | |
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
| 481 | + | |
481 | 482 | | |
482 | 483 | | |
483 | 484 | | |
| |||
499 | 500 | | |
500 | 501 | | |
501 | 502 | | |
| 503 | + | |
502 | 504 | | |
503 | 505 | | |
504 | 506 | | |
| |||
520 | 522 | | |
521 | 523 | | |
522 | 524 | | |
| 525 | + | |
523 | 526 | | |
524 | 527 | | |
525 | 528 | | |
| |||
0 commit comments