From 6873428a2e5af4f1add47d3b57e0bbf4f0e1036a Mon Sep 17 00:00:00 2001 From: Daniel Ruthardt Date: Fri, 14 Nov 2025 11:21:12 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20significant=20issues=20hig?= =?UTF-8?q?hlighted=20thanks=20to=20testing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/file/is_world_accessible | 5 ++++- libs/file/is_world_executable | 2 +- libs/file/is_world_readable | 2 +- libs/file/is_world_writable | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libs/file/is_world_accessible b/libs/file/is_world_accessible index f433da5..b3f5d3e 100644 --- a/libs/file/is_world_accessible +++ b/libs/file/is_world_accessible @@ -15,6 +15,9 @@ # limitations under the License. # +#include file/is_world_readable +#include file/is_world_executable + # file::is_world_accessible # Checks if a file or directory is world-readable and executable. # @@ -40,7 +43,7 @@ function file::is_world_accessible() { if [[ ! -d "$path" ]]; then mode=$(stat -c "%a" "$path") - if file::is_world_readable "$path"; then + if ! file::is_world_readable "$path"; then return 1 fi diff --git a/libs/file/is_world_executable b/libs/file/is_world_executable index ecb2010..ac9798b 100644 --- a/libs/file/is_world_executable +++ b/libs/file/is_world_executable @@ -33,5 +33,5 @@ # status (false). function file::is_world_executable() { local path=${1:?st argument (path) must be set} - [[ -n $(find "$path" -perm -005) ]] + [[ -n $(find "$path" -maxdepth 0 -perm -005) ]] } diff --git a/libs/file/is_world_readable b/libs/file/is_world_readable index 1977248..b968340 100644 --- a/libs/file/is_world_readable +++ b/libs/file/is_world_readable @@ -33,5 +33,5 @@ # status (false). function file::is_world_readable() { local path=${1:?st argument (path) must be set} - [[ -n $(find "$path" -perm -004) ]] + [[ -n $(find "$path" -maxdepth 0 -perm -004) ]] } diff --git a/libs/file/is_world_writable b/libs/file/is_world_writable index 272f8b9..1be1479 100644 --- a/libs/file/is_world_writable +++ b/libs/file/is_world_writable @@ -33,5 +33,5 @@ # status (false). function file::is_world_writable() { local path=${1:?st argument (path) must be set} - [[ -n $(find "$path" -perm -002) ]] + [[ -n $(find "$path" -maxdepth 0 -perm -002) ]] }