gitlab-org--gitlab-foss/lib/gitlab/utils
Kerri Miller acc694ead6 Extract SanitizeNodeLink and apply to WikiLinkFilter
The SanitizationFilter was running before the WikiFilter. Since
WikiFilter can modify links, we could see links that _should_ be stopped
by SanatizationFilter being rendered on the page. I (kerrizor) had
previously addressed the bug in: 7bc971915b
However, an additional exploit was discovered after that was merged.
Working through the issue, we couldn't simply shuffle the order of
filters, due to some implicit assumptions about the order of filters, so
instead we've extracted the logic that sanitizes a Nokogiri-generated
Node object, and applied it to the WikiLinkFilter as well.

On moving filters around:
Once we start moving around filters, we get cascading failures; fix one,
another one crops up. Many of the existing filters in the WikiPipeline
chain seem to assume that other filters have already done their work,
and thus operate on a "transform anything that's left" basis;
WikiFilter, for instance, assumes any link it finds in the markdown
should be prepended with the wiki_base_path.. but if it does that, it
also turns `href="@user"` into `href="/path/to/wiki/@user"`, which the
UserReferenceFilter doesn't see as a user reference it needs to
transform into a user profile link. This is true for all the reference
filters in the WikiPipeline.
2019-07-26 13:41:11 +00:00
..
deep_size.rb Prevent Billion Laughs attack 2019-07-02 06:23:06 +00:00
merge_hash.rb Add cache to the 'compile-assets' and 'gitlab:assets:compile' jobs 2019-02-05 14:04:54 +01:00
override.rb Add cache to the 'compile-assets' and 'gitlab:assets:compile' jobs 2019-02-05 14:04:54 +01:00
sanitize_node_link.rb Extract SanitizeNodeLink and apply to WikiLinkFilter 2019-07-26 13:41:11 +00:00
strong_memoize.rb Add cache to the 'compile-assets' and 'gitlab:assets:compile' jobs 2019-02-05 14:04:54 +01:00