You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve gh.sh wrapper: stricter validation and better error messages (#996)
- Use allowlist for issue view (numeric issue numbers only)
- Enforce zero positional args for issue list / label list
- Pin GH_HOST and GH_REPO explicitly to avoid ambient state
- Add descriptive error messages with usage examples
if [[ ${#POSITIONAL[@]}-ne 1 ]] ||! [[ "${POSITIONAL[0]}"=~ ^[0-9]+$ ]];then
86
+
echo"Error: issue view requires exactly one numeric issue number (e.g., ./scripts/gh.sh issue view 123)">&2
87
+
exit 1
88
+
fi
89
+
gh "$SUB1""$SUB2""${POSITIONAL[0]}""${FLAGS[@]}"
77
90
else
78
-
# Reject URLs in positional args to prevent cross-repo access
79
-
forposin"${POSITIONAL[@]}";do
80
-
if [[ "$pos"== http://*||"$pos"== https://* ]];then
81
-
exit 1
82
-
fi
83
-
done
84
-
gh "$SUB1""$SUB2""${POSITIONAL[@]}""${FLAGS[@]}"
91
+
if [[ ${#POSITIONAL[@]}-ne 0 ]];then
92
+
echo"Error: issue list and label list do not accept positional arguments (e.g., ./scripts/gh.sh issue list --state open, ./scripts/gh.sh label list --limit 100)">&2
0 commit comments