Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
806d2120
Commit
806d2120
authored
Oct 18, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix csp issues from sentry
parent
43fdf196
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
getCspPolicy.ts
lib/csp/getCspPolicy.ts
+12
-3
No files found.
lib/csp/getCspPolicy.ts
View file @
806d2120
import
_unique
from
'
lodash/uniq
'
;
import
appConfig
from
'
configs/app/config
'
;
import
appConfig
from
'
configs/app/config
'
;
import
featuredNetworks
from
'
lib/networks/featuredNetworks
'
;
import
featuredNetworks
from
'
lib/networks/featuredNetworks
'
;
...
@@ -33,7 +35,7 @@ function getMarketplaceAppsOrigins() {
...
@@ -33,7 +35,7 @@ function getMarketplaceAppsOrigins() {
}
}
function
getMarketplaceAppsLogosOrigins
()
{
function
getMarketplaceAppsLogosOrigins
()
{
return
getMarketplaceApps
().
map
(({
logo
})
=>
logo
);
return
getMarketplaceApps
().
map
(({
logo
})
=>
new
URL
(
logo
)
);
}
}
function
makePolicyMap
()
{
function
makePolicyMap
()
{
...
@@ -91,11 +93,17 @@ function makePolicyMap() {
...
@@ -91,11 +93,17 @@ function makePolicyMap() {
// github avatars
// github avatars
'
avatars.githubusercontent.com
'
,
'
avatars.githubusercontent.com
'
,
// other github assets (e.g trustwallet token icons)
'
raw.githubusercontent.com
'
,
// auth0 assets
'
s.gravatar.com
'
,
// network assets
// network assets
...
networkExternalAssets
.
map
((
url
)
=>
url
.
host
),
...
networkExternalAssets
.
map
((
url
)
=>
url
.
host
),
// marketplace apps logos
// marketplace apps logos
...
getMarketplaceAppsLogosOrigins
(),
...
getMarketplaceAppsLogosOrigins
()
.
map
((
url
)
=>
url
.
host
)
,
],
],
'
font-src
'
:
[
'
font-src
'
:
[
...
@@ -133,7 +141,8 @@ function getCspPolicy() {
...
@@ -133,7 +141,8 @@ function getCspPolicy() {
return
;
return
;
}
}
return
[
key
,
value
.
join
(
'
'
)
].
join
(
'
'
);
const
uniqueValues
=
_unique
(
value
);
return
[
key
,
uniqueValues
.
join
(
'
'
)
].
join
(
'
'
);
})
})
.
filter
(
Boolean
)
.
filter
(
Boolean
)
.
join
(
'
;
'
);
.
join
(
'
;
'
);
...
...
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