Skip to content

Commit f8fff21

Browse files
CopilotPDowney
andauthored
security: remove redundant log directory check, use case for path validation
Agent-Logs-Url: https://github.com/EngineScript/EngineScript/sessions/b7a76c75-34d2-4d2c-b506-bda5f1f115b4 Co-authored-by: PDowney <[email protected]>
1 parent fd744e0 commit f8fff21

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

scripts/ci/run-install-step.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,14 @@ if [ -z "${RESOLVED_LOG_PARENT:-}" ]; then
5050
exit 1
5151
fi
5252

53-
if [ "$RESOLVED_LOG_PARENT" != "$ALLOWED_LOG_BASE_DIR" ] && [[ "$RESOLVED_LOG_PARENT"/ != "$ALLOWED_LOG_BASE_DIR"/* ]]; then
54-
echo "Error: log path must be within $ALLOWED_LOG_BASE_DIR: $LOG_PATH" >&2
55-
exit 1
56-
fi
53+
case "$RESOLVED_LOG_PARENT" in
54+
"$ALLOWED_LOG_BASE_DIR"|"$ALLOWED_LOG_BASE_DIR"/*)
55+
;;
56+
*)
57+
echo "Error: log path must be within $ALLOWED_LOG_BASE_DIR: $LOG_PATH" >&2
58+
exit 1
59+
;;
60+
esac
5761

5862
if [ "$LOG_FILENAME" = "." ] || [ "$LOG_FILENAME" = ".." ]; then
5963
echo "Error: invalid log file name: $LOG_PATH" >&2

0 commit comments

Comments
 (0)