Skip to content

Commit 004b9cb

Browse files
committed
Merge branch '6.2' into 6.3
* 6.2: subdomains are also allowed on allowed hosts
2 parents 76b353b + 55f8aad commit 004b9cb

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

html_sanitizer.rst

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,8 @@ URLs of ``<a>`` elements:
731731
allowed_link_schemes: ['http', 'https', 'mailto']
732732
733733
# specifies the allowed hosts, the attribute will be dropped if the
734-
# URL contains a different host
734+
# URL contains a different host. Subdomains are allowed: e.g. the following
735+
# config would also allow 'www.symfony.com', 'live.symfony.com', etc.
735736
allowed_link_hosts: ['symfony.com']
736737
737738
# whether to allow relative links (i.e. URLs without scheme and host)
@@ -765,7 +766,8 @@ URLs of ``<a>`` elements:
765766
<allowed-link-scheme>mailto</allowed-link-scheme>
766767
767768
<!-- specifies the allowed hosts, the attribute will be dropped if the
768-
URL contains a different host -->
769+
URL contains a different host. Subdomains are allowed: e.g. the following
770+
config would also allow 'www.symfony.com', 'live.symfony.com', etc. -->
769771
<allowed-link-host>symfony.com</allowed-link-host>
770772
</framework:html-sanitizer>
771773
</framework:config>
@@ -789,7 +791,8 @@ URLs of ``<a>`` elements:
789791
->allowedLinkSchemes(['http', 'https', 'mailto'])
790792
791793
// specifies the allowed hosts, the attribute will be dropped if the
792-
// URL contains a different host
794+
// URL contains a different host. Subdomains are allowed: e.g. the following
795+
// config would also allow 'www.symfony.com', 'live.symfony.com', etc.
793796
->allowedLinkHost('symfony.com')
794797
795798
// whether to allow relative links (i.e. URLs without scheme and host)
@@ -814,8 +817,8 @@ URLs of ``<a>`` elements:
814817
->allowedLinkSchemes(['http', 'https', 'mailto'])
815818
816819
// specifies the allowed hosts, the attribute will be dropped if the
817-
// URL contains a different host
818-
->allowedLinkHosts(['symfony.com'])
820+
// URL contains a different host which is not a subdomain of the allowed host
821+
->allowedLinkHosts(['symfony.com']) // Also allows any subdomain (i.e. www.symfony.com)
819822
820823
// whether to allow relative links (i.e. URLs without scheme and host)
821824
->allowRelativeLinks()
@@ -849,8 +852,8 @@ the HTML sanitizer: ``src``, ``href``, ``lowsrc``, ``background`` and ``ping``.
849852
allowed_media_schemes: ['http', 'https', 'mailto']
850853
851854
# specifies the allowed hosts, the attribute will be dropped if the URL
852-
# contains a different host
853-
allowed_media_hosts: ['symfony.com']
855+
# contains a different host which is not a subdomain of the allowed host
856+
allowed_media_hosts: ['symfony.com'] # Also allows any subdomain (i.e. www.symfony.com)
854857
855858
# whether to allow relative URLs (i.e. URLs without scheme and host)
856859
allow_relative_medias: true
@@ -883,7 +886,8 @@ the HTML sanitizer: ``src``, ``href``, ``lowsrc``, ``background`` and ``ping``.
883886
<allowed-media-scheme>mailto</allowed-media-scheme>
884887
885888
<!-- specifies the allowed hosts, the attribute will be dropped if the URL
886-
contains a different host -->
889+
contains a different host which is not a subdomain of the allowed host.
890+
Also allows any subdomain (i.e. www.symfony.com) -->
887891
<allowed-media-host>symfony.com</allowed-media-host>
888892
</framework:html-sanitizer>
889893
</framework:config>
@@ -907,8 +911,8 @@ the HTML sanitizer: ``src``, ``href``, ``lowsrc``, ``background`` and ``ping``.
907911
->allowedMediaSchemes(['http', 'https', 'mailto'])
908912
909913
// specifies the allowed hosts, the attribute will be dropped if the URL
910-
// contains a different host
911-
->allowedMediaHost('symfony.com')
914+
// contains a different host which is not a subdomain of the allowed host
915+
->allowedMediaHost('symfony.com') // Also allows any subdomain (i.e. www.symfony.com)
912916
913917
// whether to allow relative URLs (i.e. URLs without scheme and host)
914918
->allowRelativeMedias(true)
@@ -932,8 +936,8 @@ the HTML sanitizer: ``src``, ``href``, ``lowsrc``, ``background`` and ``ping``.
932936
->allowedMediaSchemes(['http', 'https', 'mailto'])
933937
934938
// specifies the allowed hosts, the attribute will be dropped if the URL
935-
// contains a different host
936-
->allowedMediaHosts(['symfony.com'])
939+
// contains a different host which is not a subdomain of the allowed host
940+
->allowedMediaHosts(['symfony.com']) // Also allows any subdomain (i.e. www.symfony.com)
937941
938942
// whether to allow relative URLs (i.e. URLs without scheme and host)
939943
->allowRelativeMedias()

0 commit comments

Comments
 (0)