Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
921c704f
Commit
921c704f
authored
Sep 05, 2019
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set asset_proxy_whitelist default to gitlab host
parent
700bdfc7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
changelogs/unreleased/67037-user-content-gitlab-static-net-brings-back-404-only.yml
...7-user-content-gitlab-static-net-brings-back-404-only.yml
+5
-0
lib/banzai/filter/asset_proxy_filter.rb
lib/banzai/filter/asset_proxy_filter.rb
+5
-1
spec/lib/banzai/filter/asset_proxy_filter_spec.rb
spec/lib/banzai/filter/asset_proxy_filter_spec.rb
+11
-0
No files found.
changelogs/unreleased/67037-user-content-gitlab-static-net-brings-back-404-only.yml
0 → 100644
View file @
921c704f
---
title
:
Default the asset proxy whitelist to the installation domain
merge_request
:
32703
author
:
type
:
fixed
lib/banzai/filter/asset_proxy_filter.rb
View file @
921c704f
...
...
@@ -44,7 +44,7 @@ module Banzai
Gitlab
.
config
.
asset_proxy
[
'enabled'
]
=
application_settings
.
asset_proxy_enabled
Gitlab
.
config
.
asset_proxy
[
'url'
]
=
application_settings
.
asset_proxy_url
Gitlab
.
config
.
asset_proxy
[
'secret_key'
]
=
application_settings
.
asset_proxy_secret_key
Gitlab
.
config
.
asset_proxy
[
'whitelist'
]
=
application_settings
.
asset_proxy_whitelist
||
[
Gitlab
.
config
.
gitlab
.
host
]
Gitlab
.
config
.
asset_proxy
[
'whitelist'
]
=
determine_whitelist
(
application_settings
)
Gitlab
.
config
.
asset_proxy
[
'domain_regexp'
]
=
compile_whitelist
(
Gitlab
.
config
.
asset_proxy
.
whitelist
)
else
Gitlab
.
config
.
asset_proxy
[
'enabled'
]
=
::
ApplicationSetting
.
defaults
[
:asset_proxy_enabled
]
...
...
@@ -57,6 +57,10 @@ module Banzai
escaped
=
domain_list
.
map
{
|
domain
|
Regexp
.
escape
(
domain
).
gsub
(
'\*'
,
'.*?'
)
}
Regexp
.
new
(
"^(
#{
escaped
.
join
(
'|'
)
}
)$"
,
Regexp
::
IGNORECASE
)
end
def
self
.
determine_whitelist
(
application_settings
)
application_settings
.
asset_proxy_whitelist
.
presence
||
[
Gitlab
.
config
.
gitlab
.
host
]
end
end
end
end
spec/lib/banzai/filter/asset_proxy_filter_spec.rb
View file @
921c704f
...
...
@@ -36,6 +36,17 @@ describe Banzai::Filter::AssetProxyFilter do
expect
(
Gitlab
.
config
.
asset_proxy
.
whitelist
).
to
eq
%w(gitlab.com *.mydomain.com)
expect
(
Gitlab
.
config
.
asset_proxy
.
domain_regexp
).
to
eq
/^(gitlab\.com|.*?\.mydomain\.com)$/i
end
context
'when whitelist is empty'
do
it
'defaults to the install domain'
do
stub_application_setting
(
asset_proxy_enabled:
true
)
stub_application_setting
(
asset_proxy_whitelist:
[])
described_class
.
initialize_settings
expect
(
Gitlab
.
config
.
asset_proxy
.
whitelist
).
to
eq
[
Gitlab
.
config
.
gitlab
.
host
]
end
end
end
context
'when properly configured'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment