mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-12-02 13:32:43 -05:00
Currently, SimplePie uses legacy DOMDocument parsing, which outputs potentially problematic HTML, not correctly sanitised.
This breaks the assumption that one can use something like `<div><!-- some HTML sanitized from SimplePie --></div>`.
```
--- Expected
+++ Actual
@@ @@
'<ul>
- <li><div></div></li>
+ <li><div>
<li>Item</li>
-</ul>'
+</div></li></ul>'
```
When shown in a compliant Web browser, several tags will be wrongly closed, breaking the layout of the client.
This PR patches SimplePie to use the modern parser and code syntax, while maintaining a best-effort polyfill for legacy PHP versions < 8.4.
Depends on:
SimplePie: Upgrade to PHPStan 2
* https://github.com/FreshRSS/simplepie/pull/97
* https://github.com/simplepie/simplepie/pull/939
* https://github.com/simplepie/simplepie/pull/1019
SimplePie: Use PHP 8.4+ \Dom classes and functions
* https://github.com/FreshRSS/simplepie/pull/98
* https://github.com/simplepie/simplepie/issues/1021
SimplePie: Add unit test for HTML5 sanitizing compliance
* https://github.com/simplepie/simplepie/pull/1022
SimplePie: Remove obsolete xml_is_sane and XMLReader fallback
* https://github.com/simplepie/simplepie/pull/1023
CssXPath: Add support for case insensitivity
* https://github.com/phpgt/CssXPath/pull/256
fix https://github.com/FreshRSS/FreshRSS/issues/5201
fix https://github.com/FreshRSS/FreshRSS/issues/6830
fix https://github.com/FreshRSS/FreshRSS/issues/6831
~5% faster for HTML sanitising.
Remove SimpleXML. Remove XMLReader.
72 lines
2.8 KiB
Plaintext
72 lines
2.8 KiB
Plaintext
# Test image for development
|
|
FROM alpine:3.18
|
|
|
|
ENV TZ=UTC
|
|
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
|
|
|
|
RUN apk add --no-cache \
|
|
tzdata \
|
|
apache2 php82-apache2 \
|
|
php82 php82-curl php82-gmp php82-intl php82-mbstring php82-xml php82-zip \
|
|
php82-ctype php82-dom php82-fileinfo php82-iconv php82-json php82-opcache php82-openssl php82-phar php82-session php82-simplexml php82-xmlwriter php82-xml php82-tokenizer php82-zlib \
|
|
php82-pdo_sqlite php82-pdo_mysql php82-pdo_pgsql
|
|
|
|
RUN mkdir -p /var/www/FreshRSS /run/apache2/
|
|
WORKDIR /var/www/FreshRSS
|
|
|
|
COPY --chown=root:www-data . /var/www/FreshRSS
|
|
COPY ./Docker/*.Apache.conf /etc/apache2/conf.d/
|
|
|
|
ARG FRESHRSS_VERSION
|
|
ARG SOURCE_COMMIT
|
|
|
|
LABEL \
|
|
org.opencontainers.image.description="A self-hosted RSS feed aggregator" \
|
|
org.opencontainers.image.documentation="https://freshrss.github.io/FreshRSS/" \
|
|
org.opencontainers.image.licenses="AGPL-3.0" \
|
|
org.opencontainers.image.revision="${SOURCE_COMMIT}" \
|
|
org.opencontainers.image.source="https://github.com/FreshRSS/FreshRSS" \
|
|
org.opencontainers.image.title="FreshRSS" \
|
|
org.opencontainers.image.url="https://freshrss.org/" \
|
|
org.opencontainers.image.vendor="FreshRSS" \
|
|
org.opencontainers.image.version="$FRESHRSS_VERSION"
|
|
|
|
RUN \
|
|
# Disable unwanted Apache modules and configurations
|
|
rm -f /etc/apache2/conf.d/languages.conf /etc/apache2/conf.d/info.conf \
|
|
/etc/apache2/conf.d/status.conf /etc/apache2/conf.d/userdir.conf && \
|
|
sed -r -i "/^\s*LoadModule .*mod_(alias|autoindex|negotiation|status).so$/s/^/#/" \
|
|
/etc/apache2/httpd.conf && \
|
|
sed -r -i "/^\s*(CustomLog|ErrorLog|Listen) /s/^/#/" \
|
|
/etc/apache2/httpd.conf && \
|
|
# Enable required Apache modules
|
|
sed -r -i "/^\s*#\s*LoadModule .*mod_(deflate|expires|filter|headers|mime|remoteip|setenvif).so$/s/^\s*#//" \
|
|
/etc/apache2/httpd.conf && \
|
|
# PHP configuration
|
|
if [ ! -f /usr/bin/php ]; then ln -s /usr/bin/php82 /usr/bin/php; else true; fi && \
|
|
echo 'memory_limit = 256M' > /etc/php82/conf.d/10_memory.ini && \
|
|
# Disable built-in FreshRSS updates when using Docker, as the full image is supposed to be updated instead.
|
|
sed -r -i "\\#disable_update#s#^.*#\t'disable_update' => true,#" ./config.default.php && \
|
|
# Configure cron job
|
|
touch /var/www/FreshRSS/Docker/env.txt && \
|
|
echo "27,57 * * * * . /var/www/FreshRSS/Docker/env.txt; \
|
|
su apache -s /bin/sh -c 'php /var/www/FreshRSS/app/actualize_script.php' \
|
|
2>> /proc/1/fd/2 > /tmp/FreshRSS.log" > /etc/crontab.freshrss.default
|
|
|
|
ENV COPY_LOG_TO_SYSLOG=On
|
|
ENV COPY_SYSLOG_TO_STDERR=On
|
|
ENV CRON_MIN=''
|
|
ENV DATA_PATH=''
|
|
ENV ENABLE_ACCESS_LOG=1
|
|
ENV FRESHRSS_ENV=''
|
|
ENV LISTEN=''
|
|
ENV OIDC_ENABLED=''
|
|
ENV TRUSTED_PROXY=''
|
|
|
|
ENTRYPOINT ["./Docker/entrypoint.sh"]
|
|
|
|
EXPOSE 80
|
|
# hadolint ignore=DL3025
|
|
CMD ([ -z "$CRON_MIN" ] || crond -d 6) && \
|
|
exec httpd -D FOREGROUND $([ -n "$OIDC_ENABLED" ] && [ "$OIDC_ENABLED" -ne 0 ] && echo "-D OIDC_ENABLED")
|