@@ -806,10 +806,38 @@ test_case_t_worker_gate_ignores_mismatched_precomputed_permission() {
806806}
807807
808808# =============================================================================
809- # Case (u): issue-author=NONE + spoofed approval marker but failed verification
809+ # Case (u): worker gate ignores precomputed permission with empty login (GH#25090)
810+ # =============================================================================
811+ test_case_u_worker_gate_ignores_empty_precomputed_permission_login () {
812+ setup_test_env
813+ define_helpers_under_test || { teardown_test_env; return 0; }
814+
815+ printf ' {"author_association":"COLLABORATOR","user":{"login":"issue-author"}}' > " ${TEST_ROOT} /issue.json"
816+ printf ' []' > " ${TEST_ROOT} /comments.json"
817+ printf ' read' > " ${TEST_ROOT} /permission.txt"
818+ export AIDEVOPS_WORKER_BRIEFED_AUTO_MERGE=1
819+
820+ local result=0
821+ _attempt_worker_briefed_auto_merge " 120" " owner/repo" " origin:worker" " false" " 62" " write" " " && result=0 || result=$?
822+
823+ if [[ " $result " -eq 0 ]]; then
824+ print_result " Case (u): worker gate ignores empty precomputed permission login (GH#25090)" 1 \
825+ " Expected non-zero exit, got 0 (empty cached-permission login should not trust issue author)"
826+ elif grep -q " /collaborators/issue-author/permission" " $GH_LOG " 2> /dev/null; then
827+ print_result " Case (u): worker gate ignores empty precomputed permission login (GH#25090)" 0
828+ else
829+ print_result " Case (u): worker gate ignores empty precomputed permission login (GH#25090)" 1 \
830+ " Expected fallback collaborator permission API call for issue-author"
831+ fi
832+ teardown_test_env
833+ return 0
834+ }
835+
836+ # =============================================================================
837+ # Case (v): issue-author=NONE + spoofed approval marker but failed verification
810838# → blocked. Comment marker presence alone is not a trust signal (GH#21936).
811839# =============================================================================
812- test_case_u_spoofed_crypto_marker_blocked () {
840+ test_case_v_spoofed_crypto_marker_blocked () {
813841 setup_test_env
814842 define_helpers_under_test || { teardown_test_env; return 0; }
815843
@@ -822,13 +850,13 @@ test_case_u_spoofed_crypto_marker_blocked() {
822850 _attempt_worker_briefed_auto_merge " 117" " owner/repo" " origin:worker" " false" " 59" && result=0 || result=$?
823851
824852 if [[ " $result " -eq 0 ]]; then
825- print_result " Case (u ): spoofed crypto marker without verification → blocked" 1 \
853+ print_result " Case (v ): spoofed crypto marker without verification → blocked" 1 \
826854 " Expected non-zero exit, got 0 (unverified marker should block)"
827855 else
828856 if grep -q " no cryptographic approval signature found (t2449/t3052)" " $LOGFILE " 2> /dev/null; then
829- print_result " Case (u ): spoofed crypto marker without verification → blocked" 0
857+ print_result " Case (v ): spoofed crypto marker without verification → blocked" 0
830858 else
831- print_result " Case (u ): spoofed crypto marker without verification → blocked" 1 \
859+ print_result " Case (v ): spoofed crypto marker without verification → blocked" 1 \
832860 " Exit was non-zero but expected block log message not found"
833861 fi
834862 fi
@@ -865,7 +893,8 @@ main() {
865893 test_case_r_precomputed_permission_skips_api
866894 test_case_s_worker_gate_uses_matching_precomputed_permission
867895 test_case_t_worker_gate_ignores_mismatched_precomputed_permission
868- test_case_u_spoofed_crypto_marker_blocked
896+ test_case_u_worker_gate_ignores_empty_precomputed_permission_login
897+ test_case_v_spoofed_crypto_marker_blocked
869898
870899 echo " "
871900 printf ' Results: %d/%d passed\n' " $(( TESTS_RUN - TESTS_FAILED)) " " $TESTS_RUN "
0 commit comments