fix(#1356): tea login resolution fails closed on a declared git identity (#1361)
ci/woodpecker/push/publish Pipeline was canceled
ci/woodpecker/push/publish Pipeline was canceled
Co-authored-by: fred <[email protected]>
This commit was merged in pull request #1361.
This commit is contained in:
@@ -49,11 +49,27 @@ if [[ -z "$LOGIN" ]]; then
|
||||
if [[ -n "${GITEA_LOGIN:-}" ]]; then
|
||||
LOGIN="$GITEA_LOGIN"
|
||||
else
|
||||
case "${REPO%%/*}" in
|
||||
usc|USC) LOGIN=usc ;;
|
||||
mosaicstack|mosaic) LOGIN=mosaicstack ;;
|
||||
*) LOGIN="$(get_gitea_login_for_repo_override 2>/dev/null || true)" ;;
|
||||
esac
|
||||
# #1356: the owner-derived map below picks a SHARED login (bare `usc` /
|
||||
# `mosaicstack`). On a seat that is borrowing another identity, which is
|
||||
# exactly what gate 16 forbids. So the identity ladder goes first and the
|
||||
# map is only the no-identity fallback (a human at a terminal), which is
|
||||
# where the token path stops enforcing too.
|
||||
if LOGIN="$(get_gitea_login_for_repo_override "$REPO")"; then
|
||||
:
|
||||
elif resolve_git_identity >/dev/null 2>&1; then
|
||||
# A git identity IS set and the ladder still could not resolve a login.
|
||||
# The named reason is already on stderr. Falling through to the map here
|
||||
# would hand this seat a SHARED login (bare `usc` / `mosaicstack`) — the
|
||||
# identity-borrowing #1356 exists to stop. Fail closed instead.
|
||||
exit 2
|
||||
else
|
||||
# No identity: a human at a terminal. Owner-derived map, unchanged. This
|
||||
# is the same point at which the token path stops enforcing.
|
||||
case "${REPO%%/*}" in
|
||||
usc|USC) LOGIN=usc ;;
|
||||
mosaicstack|mosaic) LOGIN=mosaicstack ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
[[ -n "$LOGIN" ]] || { echo "FATAL: could not resolve a Gitea login for $REPO (pass -L or set GITEA_LOGIN)" >&2; exit 2; }
|
||||
|
||||
Reference in New Issue
Block a user