From 4c77605cb173be6f807c2d4b0931728a86fb7b46 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 13 Sep 2024 10:47:34 +0200 Subject: [PATCH] Scripts: fix wildcard to lower path wildcard edge case --- Scripts/dashboard-acl.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Scripts/dashboard-acl.sh b/Scripts/dashboard-acl.sh index 27cc5de39..83a92d2be 100755 --- a/Scripts/dashboard-acl.sh +++ b/Scripts/dashboard-acl.sh @@ -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}" ${ACLS}; then - PATTERN=${PATTERN%/*} - if ! grep -q "${PATTERN}/\*" ${ACLS}; then + if ! grep -Fq "${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}" ${ACLS}; then echo "Unknown ACL for ${WIDGET}:" echo ${ENDPOINT} exit 1