Skip to content

Commit 341aaca

Browse files
fix(setup-gcp): filter scope output to https:// lines
Address review feedback: ts-node stderr (Node deprecation warnings, etc.) was captured into SCOPES_OUTPUT via 2>&1 and would have been surfaced to the user as bogus OAuth scopes. Filter on the https:// prefix instead, and fail loudly if filtering leaves zero scopes.
1 parent 1c2eaea commit 341aaca

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

scripts/setup-gcp.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,19 @@ if [ $? -ne 0 ]; then
104104
fi
105105

106106
SCOPES=()
107+
# Filter to https:// lines so any Node/ts-node warnings written to stderr
108+
# (captured via 2>&1 above so we can surface them on failure) don't end up
109+
# in the user-visible scope list.
107110
while IFS= read -r line; do
108-
[ -n "$line" ] && SCOPES+=("$line")
111+
[[ "$line" == https://* ]] && SCOPES+=("$line")
109112
done <<< "$SCOPES_OUTPUT"
110113

114+
if [ ${#SCOPES[@]} -eq 0 ]; then
115+
echo -e "${RED}Error: print-scopes.ts produced no scope output.${NC}"
116+
echo "$SCOPES_OUTPUT"
117+
exit 1
118+
fi
119+
111120
for scope in "${SCOPES[@]}"; do
112121
echo -e " ${GREEN}$scope${NC}"
113122
done

0 commit comments

Comments
 (0)