@@ -108,11 +108,48 @@ EXIT_CODE=$(run_bash_guard "$INPUT")
108108assert_eq_verbose " test_bash_tickets_tracker_reference_blocks" " 2" " $EXIT_CODE "
109109
110110# --- test_bash_ticket_cli_allowlisted ---
111- # Bash command that is a ticket CLI invocation (tk show) must be allowed (exit 0).
112- INPUT=' {"tool_name":"Bash","tool_input":{"command":"tk show dso-1234"}}'
111+ # Bash command that is a bare ticket CLI invocation must be allowed (exit 0).
112+ INPUT=' {"tool_name":"Bash","tool_input":{"command":"ticket show dso-1234"}}'
113113EXIT_CODE=$( run_bash_guard " $INPUT " )
114114assert_eq_verbose " test_bash_ticket_cli_allowlisted" " 0" " $EXIT_CODE "
115115
116+ # --- test_bash_dso_shim_ticket_comment_allowlisted ---
117+ # Bash command via DSO shim (.claude/scripts/dso ticket comment) must be allowed (exit 0).
118+ INPUT=' {"tool_name":"Bash","tool_input":{"command":".claude/scripts/dso ticket comment 4506-e5da \"## Description\""}}'
119+ EXIT_CODE=$( run_bash_guard " $INPUT " )
120+ assert_eq_verbose " test_bash_dso_shim_ticket_comment_allowlisted" " 0" " $EXIT_CODE "
121+
122+ # --- test_bash_dso_shim_ticket_create_allowlisted ---
123+ # Bash command via DSO shim (.claude/scripts/dso ticket create) must be allowed (exit 0).
124+ INPUT=' {"tool_name":"Bash","tool_input":{"command":".claude/scripts/dso ticket create bug \"some title\""}}'
125+ EXIT_CODE=$( run_bash_guard " $INPUT " )
126+ assert_eq_verbose " test_bash_dso_shim_ticket_create_allowlisted" " 0" " $EXIT_CODE "
127+
128+ # --- test_bash_dso_shim_ticket_transition_allowlisted ---
129+ # Bash command via DSO shim (.claude/scripts/dso ticket transition) must be allowed (exit 0).
130+ INPUT=' {"tool_name":"Bash","tool_input":{"command":".claude/scripts/dso ticket transition w21-u3op open in_progress"}}'
131+ EXIT_CODE=$( run_bash_guard " $INPUT " )
132+ assert_eq_verbose " test_bash_dso_shim_ticket_transition_allowlisted" " 0" " $EXIT_CODE "
133+
134+ # --- test_bash_dso_shim_ticket_list_allowlisted ---
135+ # Bash command via DSO shim (.claude/scripts/dso ticket list) must be allowed (exit 0).
136+ INPUT=' {"tool_name":"Bash","tool_input":{"command":".claude/scripts/dso ticket list 2>/dev/null | python3 -c \"...\""}}'
137+ EXIT_CODE=$( run_bash_guard " $INPUT " )
138+ assert_eq_verbose " test_bash_dso_shim_ticket_list_allowlisted" " 0" " $EXIT_CODE "
139+
140+ # --- test_bash_dso_shim_via_bash_allowlisted ---
141+ # Bash command via "bash .claude/scripts/dso ticket ..." must be allowed (exit 0).
142+ INPUT=' {"tool_name":"Bash","tool_input":{"command":"bash .claude/scripts/dso ticket show w21-1234"}}'
143+ EXIT_CODE=$( run_bash_guard " $INPUT " )
144+ assert_eq_verbose " test_bash_dso_shim_via_bash_allowlisted" " 0" " $EXIT_CODE "
145+
146+ # --- test_bash_embedded_dso_ticket_in_echo_blocks ---
147+ # A command that embeds "/dso ticket" as a string argument (not a real invocation)
148+ # while also referencing .tickets-tracker/ must still be blocked (exit 2).
149+ INPUT=' {"tool_name":"Bash","tool_input":{"command":"echo \"/dso ticket\" > /repo/.tickets-tracker/event.json"}}'
150+ EXIT_CODE=$( run_bash_guard " $INPUT " )
151+ assert_eq_verbose " test_bash_embedded_dso_ticket_in_echo_blocks" " 2" " $EXIT_CODE "
152+
116153# --- test_bash_no_tickets_tracker_ref_allows ---
117154# Bash command with no .tickets-tracker/ reference must be allowed (exit 0).
118155INPUT=' {"tool_name":"Bash","tool_input":{"command":"echo hello world"}}'
0 commit comments