Skip to content

Commit 20e4cce

Browse files
KlimTodrikdjklim87
andauthored
fix: address high-severity vulnerabilities in UA lemmatizer (#125)
Co-authored-by: djklim87 <klim@manticoresearch.com>
1 parent 1681ed8 commit 20e4cce

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

Dockerfile

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ RUN if [ "$TARGETPLATFORM" = "linux/arm64" ] ; then export ARCH="arm"; else expo
7070
echo "2nd step of building dev image for linux/${ARCH}64 architecture" \
7171
&& wget -q https://repo.manticoresearch.com/manticore-dev-repo.noarch.deb \
7272
&& dpkg -i manticore-dev-repo.noarch.deb \
73+
&& sed -i 's|http://repo.manticoresearch.com|https://repo.manticoresearch.com|g' /etc/apt/sources.list.d/*.list \
7374
&& apt-key adv --fetch-keys 'https://repo.manticoresearch.com/GPG-KEY-manticore' && apt-get -y update \
7475
&& apt-get -y install manticore manticore-extra manticore-load manticore-lemmatizer-uk manticore-language-packs;\
7576
elif [ ! -z "$DAEMON_URL" ]; then \
@@ -99,14 +100,23 @@ RUN if [ -d "/packages/" ]; then apt -y install /packages/*deb; fi \
99100
&& tar -xf /tmp/ru.pak.tgz -C /usr/share/manticore/ \
100101
&& rm /tmp/*.pak.tgz
101102

102-
# Installing the Ukrainian Lemmatizer using the working Jammy approach
103-
RUN apt-get update && apt-get install -y software-properties-common curl && \
104-
add-apt-repository -y ppa:deadsnakes/ppa && \
105-
apt-get update && \
106-
apt-get install -y python3.9 python3.9-dev python3.9-distutils && \
107-
curl https://bootstrap.pypa.io/get-pip.py | python3.9 && \
108-
python3.9 -m pip install pymorphy2 pymorphy2-dicts-uk && \
109-
apt-get clean && rm -rf /var/lib/apt/lists/*
103+
# Install Python deps needed for Ukrainian morphology (lemmatize_uk).
104+
# Keep it minimal (avoid `python3.9-dev`) and pin/upgrade `cryptography` to avoid HIGH CVEs.
105+
RUN set -eux; \
106+
apt-get update; \
107+
apt-get install -y --no-install-recommends software-properties-common ca-certificates; \
108+
add-apt-repository -y ppa:deadsnakes/ppa; \
109+
apt-get update; \
110+
apt-get install -y --no-install-recommends python3.9 python3.9-distutils python3.9-venv libpython3.9; \
111+
if dpkg -s python3-cryptography >/dev/null 2>&1; then apt-get purge -y --auto-remove python3-cryptography; fi; \
112+
apt-get purge -y --auto-remove software-properties-common; \
113+
python3.9 -m ensurepip --upgrade; \
114+
python3.9 -m pip install --no-cache-dir --upgrade pip setuptools wheel; \
115+
python3.9 -m pip install --no-cache-dir pymorphy2 pymorphy2-dicts-uk; \
116+
python3.9 -m pip install --no-cache-dir --upgrade "cryptography>=43.0.1"; \
117+
python3.9 -m pip check; \
118+
apt-get clean; \
119+
rm -rf /var/lib/apt/lists/*
110120

111121
COPY manticore.conf.sh /etc/manticoresearch/
112122
RUN sed -i '/log = \/var\/log\/manticore\/searchd.log/d;/query_log = \/var\/log\/manticore\/query.log/d' /etc/manticoresearch/manticore.conf

0 commit comments

Comments
 (0)