Fix a memory leak caused by Banzai::Filter::SanitizationFilter
In Banzai::Filter::SanitizationFilter#customize_whitelist, we append three lambdas that has reference to the SanitizationFilter instance, which in turn (potentially) has a reference to the following chain: context hash -> Project instance -> Repository instance -> lookup hash -> various Rugged instances -> various mmap-ed git pack files. All of the above is not garbage collected because the array we append the lambdas to is the constant HTML::Pipeline::SanitizationFilter::WHITELIST.
This commit is contained in:
parent
30f5b9a5b7
commit
504a3b5e6f
2 changed files with 4 additions and 1 deletions
|
@ -108,6 +108,7 @@ v 8.11.0 (unreleased)
|
||||||
- Sort folders with submodules in Files view !5521
|
- Sort folders with submodules in Files view !5521
|
||||||
- Each `File::exists?` replaced to `File::exist?` because of deprecate since ruby version 2.2.0
|
- Each `File::exists?` replaced to `File::exist?` because of deprecate since ruby version 2.2.0
|
||||||
- Add auto-completition in pipeline (Katarzyna Kobierska Ula Budziszewska)
|
- Add auto-completition in pipeline (Katarzyna Kobierska Ula Budziszewska)
|
||||||
|
- Fix a memory leak caused by Banzai::Filter::SanitizationFilter
|
||||||
|
|
||||||
v 8.10.5
|
v 8.10.5
|
||||||
- Add a data migration to fix some missing timestamps in the members table. !5670
|
- Add a data migration to fix some missing timestamps in the members table. !5670
|
||||||
|
|
|
@ -7,7 +7,7 @@ module Banzai
|
||||||
UNSAFE_PROTOCOLS = %w(data javascript vbscript).freeze
|
UNSAFE_PROTOCOLS = %w(data javascript vbscript).freeze
|
||||||
|
|
||||||
def whitelist
|
def whitelist
|
||||||
whitelist = super
|
whitelist = super.dup
|
||||||
|
|
||||||
customize_whitelist(whitelist)
|
customize_whitelist(whitelist)
|
||||||
|
|
||||||
|
@ -42,6 +42,8 @@ module Banzai
|
||||||
# Allow any protocol in `a` elements...
|
# Allow any protocol in `a` elements...
|
||||||
whitelist[:protocols].delete('a')
|
whitelist[:protocols].delete('a')
|
||||||
|
|
||||||
|
whitelist[:transformers] = whitelist[:transformers].dup
|
||||||
|
|
||||||
# ...but then remove links with unsafe protocols
|
# ...but then remove links with unsafe protocols
|
||||||
whitelist[:transformers].push(remove_unsafe_links)
|
whitelist[:transformers].push(remove_unsafe_links)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue