Skip to content

Commit

Permalink
feat: improve security warnings filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
rlespinasse authored Jul 24, 2023
1 parent 24bef8a commit cc20bd3
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 27 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ RUN set -e; \
apt-get remove -y wget; \
rm -rf /var/lib/apt/lists/*;

COPY scripts/* ./
COPY src/* ./

ENV ELECTRON_DISABLE_SECURITY_WARNINGS "true"
ENV DRAWIO_DISABLE_UPDATE "true"
ENV DRAWIO_DESKTOP_COMMAND_TIMEOUT "10s"
ENV DRAWIO_DESKTOP_EXECUTABLE_PATH "/opt/drawio/drawio"
ENV DRAWIO_DESKTOP_SOURCE_FOLDER "/opt/drawio-desktop"
ENV DRAWIO_DESKTOP_RUNNER_COMMAND_LINE "/opt/drawio-desktop/runner.sh"
ENV XVFB_DISPLAY ":42"
ENV XVFB_OPTIONS ""
Expand Down
10 changes: 0 additions & 10 deletions scripts/entrypoint.sh

This file was deleted.

16 changes: 0 additions & 16 deletions scripts/runner.sh

This file was deleted.

17 changes: 17 additions & 0 deletions src/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail

# Prepare output cleaning
touch "${DRAWIO_DESKTOP_SOURCE_FOLDER:?}/unwanted-lines.txt"
if [[ "${ELECTRON_DISABLE_SECURITY_WARNINGS:?}" == "true" ]]; then
cat "${DRAWIO_DESKTOP_SOURCE_FOLDER:?}/unwanted-security-warnings.txt" >>"${DRAWIO_DESKTOP_SOURCE_FOLDER:?}/unwanted-lines.txt"
fi

# Start Xvfb
export DISPLAY="${XVFB_DISPLAY:?}"
# shellcheck disable=SC2086
# shellcheck disable=SC2154
Xvfb "${XVFB_DISPLAY:?}" ${XVFB_OPTIONS} &

# Run
timeout "${DRAWIO_DESKTOP_COMMAND_TIMEOUT:?}" "${DRAWIO_DESKTOP_SOURCE_FOLDER:?}/runner_wrapper.sh" "$@"
4 changes: 4 additions & 0 deletions src/runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail

"${DRAWIO_DESKTOP_EXECUTABLE_PATH:?}" "$@" --no-sandbox
5 changes: 5 additions & 0 deletions src/runner_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail

# Run and filter output
"${DRAWIO_DESKTOP_RUNNER_COMMAND_LINE:?}" "$@" 2>&1 | grep -Fvf "${DRAWIO_DESKTOP_SOURCE_FOLDER:?}/unwanted-lines.txt"
8 changes: 8 additions & 0 deletions src/unwanted-security-warnings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Failed to connect to socket
Could not parse server address
Floss manager not present
Exiting GPU process
called with multiple threads
extension not supported
Failed to send GpuControl.CreateCommandBuffer
Init observer found at shutdown

0 comments on commit cc20bd3

Please sign in to comment.