Scripts: fix wildcard to lower path wildcard edge case

This commit is contained in:
Franco Fichtner 2024-09-13 10:47:34 +02:00
parent 1822897717
commit 4c77605cb1

View File

@ -74,10 +74,16 @@ for WIDGET in ${WIDGETS}; do
fi
for ENDPOINT in ${ENDPOINTS}; do
# do a full match here
PATTERN=${ENDPOINT#/}
if ! grep -q "<pattern>${PATTERN}</pattern>" ${ACLS}; then
PATTERN=${PATTERN%/*}
if ! grep -q "<pattern>${PATTERN}/\*</pattern>" ${ACLS}; then
if ! grep -Fq "<pattern>${PATTERN}</pattern>" ${ACLS}; then
if [ -z "${PATTERN%%*/\*}" ]; then
# already a wildcard match, allow lower path
PATTERN=${PATTERN%/*}
fi
# do a wildcard match as a fallback
PATTERN=${PATTERN%/*}/*
if ! grep -Fq "<pattern>${PATTERN}</pattern>" ${ACLS}; then
echo "Unknown ACL for ${WIDGET}:"
echo ${ENDPOINT}
exit 1