10000 minor #18379 [HtmlSanitizer] Information about subdomains of allowed … · xelaris/symfony-docs@7d61be4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7d61be4

Browse files
committed
minor symfony#18379 [HtmlSanitizer] Information about subdomains of allowed hosts (they also match) (scuben)
This PR was merged into the 6.2 branch. Discussion ---------- [HtmlSanitizer] Information about subdomains of allowed hosts (they also match) As seen in the [code](https://github.com/symfony/html-sanitizer/blob/6.2/TextSanitizer/UrlSanitizer.php#L108-L135) the allowed hosts also match any subdomain. Commits ------- 9e3d225 subdomains are also allowed on allowed hosts
2 parents e821cb0 + 9e3d225 commit 7d61be4

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

html_sanitizer.rst

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -731,8 +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
735-
allowed_link_hosts: ['symfony.com']
734+
# URL contains a different host which is not a subdomain of the allowed host
735+
allowed_link_hosts: ['symfony.com'] # also allows any subdomain (i.e. www.symfony.com)
736736
737737
# whether to allow relative links (i.e. URLs without scheme and host)
738738
allow_relative_links: true
@@ -765,7 +765,8 @@ URLs of ``<a>`` elements:
765765
<allowed-link-scheme>mailto</allowed-link-scheme>
766766
767767
<!-- specifies the allowed hosts, the attribute will be dropped if the
768-
URL contains a different host -->
768+
URL contains a different host which is not a subdomain of the allowed host
769+
Also allows any subdomain (i.e. www.symfony.com) -->
769770
<allowed-link-host>symfony.com</allowed-link-host>
770771
</framework:html-sanitizer>
771772
</framework:config>
@@ -789,8 +790,8 @@ URLs of ``<a>`` elements:
789790
->allowedLinkSchemes(['http', 'https', 'mailto'])
790791
791792
// specifies the allowed hosts, the attribute will be dropped if the
792-
// URL contains a different host
793-
->allowedLinkHost('symfony.com')
793+
// URL contains a different host which is not a subdomain of the allowed host
794+
->allowedLinkHost('symfony.com') // Also allows any subdomain (i.e. www.symfony.com)
794795
795796
// whether to allow relative links (i.e. URLs without scheme and host)
796797
->allowRelativeLinks(true)
@@ -814,8 +815,8 @@ URLs of ``<a>`` elements:
814815
->allowedLinkSchemes(['http', 'https', 'mailto'])
815816
816817
// specifies the allowed hosts, the attribute will be dropped if the
817-
// URL contains a different host
818-
->allowedLinkHosts(['symfony.com'])
818+
// URL contains a different host which is not a subdomain of the allowed host
819+
->allowedLinkHosts(['symfony.com']) // Also allows any subdomain (i.e. www.symfony.com)
819820
820821
// whether to allow relative links (i.e. URLs without scheme and host)
821822
->allowRelativeLinks()
@@ -849,8 +850,8 @@ the HTML sanitizer: ``src``, ``href``, ``lowsrc``, ``background`` and ``ping``.
849850
allowed_media_schemes: ['http', 'https', 'mailto']
850851
851852
# specifies the allowed hosts, the attribute will be dropped if the URL
852-
# contains a different host
853-
allowed_media_hosts: ['symfony.com']
853+
# contains a different host which is not a subdomain of the allowed host
854+
allowed_media_hosts: ['symfony.com'] # Also allows any subdomain (i.e. www.symfony.com)
854855
855856
# whether to allow relative URLs (i.e. URLs without scheme and host)
856857
allow_relative_medias: true
@@ -883,7 +884,8 @@ the HTML sanitizer: ``src``, ``href``, ``lowsrc``, ``background`` and ``ping``.
883884
<allowed-media-scheme>mailto</allowed-media-scheme>
884885
885886
<!-- specifies the allowed hosts, the attribute will be dropped if the URL
886-
contains a different host -->
887+
contains a different host which is not a subdomain of the allowed host.
888+
Also allows any subdomain (i.e. www.symfony.com) -->
887889
<allowed-media-host>symfony.com</allowed-media-host>
888890
</framework:html-sanitizer>
889891
</framework:config>
@@ -907,8 +909,8 @@ the HTML sanitizer: ``src``, ``href``, ``lowsrc``, ``background`` and ``ping``.
907909
->allowedMediaSchemes(['http', 'https', 'mailto'])
908910
909911
// specifies the allowed hosts, the attribute will be dropped if the URL
910-
// contains a different host
911-
->allowedMediaHost('symfony.com')
912+
// contains a different host which is not a subdomain of the allowed host
913+
->allowedMediaHost('symfony.com') // Also allows any subdomain (i.e. www.symfony.com)
912914
913915
// whether to allow relative URLs (i.e. URLs without scheme and host)
914916
->allowRelativeMedias(true)
@@ -932,8 +934,8 @@ the HTML sanitizer: ``src``, ``href``, ``lowsrc``, ``background`` and ``ping``.
932934
->allowedMediaSchemes(['http', 'https', 'mailto'])
933935
934936
// specifies the allowed hosts, the attribute will be dropped if the URL
935-
// contains a different host
936-
->allowedMediaHosts(['symfony.com'])
937+
// contains a different host which is not a subdomain of the allowed host
938+
->allowedMediaHosts(['symfony.com']) // Also allows any subdomain (i.e. www.symfony.com)
937939
938940
// whether to allow relative URLs (i.e. URLs without scheme and host)
939941
->allowRelativeMedias()

0 commit comments

Comments
 (0)
0