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
ccc01ede
Commit
ccc01ede
authored
Jul 17, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move csp for marketplace to separate file
parent
3d6ae520
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
6 deletions
+24
-6
generateCspPolicy.ts
nextjs/csp/generateCspPolicy.ts
+1
-0
app.ts
nextjs/csp/policies/app.ts
+0
-6
index.ts
nextjs/csp/policies/index.ts
+1
-0
marketplace.ts
nextjs/csp/policies/marketplace.ts
+22
-0
No files found.
nextjs/csp/generateCspPolicy.ts
View file @
ccc01ede
...
...
@@ -10,6 +10,7 @@ function generateCspPolicy() {
descriptors
.
googleFonts
(),
descriptors
.
googleReCaptcha
(),
descriptors
.
growthBook
(),
descriptors
.
marketplace
(),
descriptors
.
mixpanel
(),
descriptors
.
monaco
(),
descriptors
.
safe
(),
...
...
nextjs/csp/policies/app.ts
View file @
ccc01ede
...
...
@@ -31,8 +31,6 @@ const getCspReportUrl = () => {
};
export
function
app
():
CspDev
.
DirectiveDescriptor
{
const
marketplaceFeaturePayload
=
getFeaturePayload
(
config
.
features
.
marketplace
);
return
{
'
default-src
'
:
[
// KEY_WORDS.NONE,
...
...
@@ -57,7 +55,6 @@ export function app(): CspDev.DirectiveDescriptor {
getFeaturePayload
(
config
.
features
.
addressVerification
)?.
api
.
endpoint
,
getFeaturePayload
(
config
.
features
.
nameService
)?.
api
.
endpoint
,
getFeaturePayload
(
config
.
features
.
addressMetadata
)?.
api
.
endpoint
,
marketplaceFeaturePayload
&&
'
api
'
in
marketplaceFeaturePayload
?
marketplaceFeaturePayload
.
api
.
endpoint
:
''
,
// chain RPC server
config
.
chain
.
rpcUrl
,
...
...
@@ -65,9 +62,6 @@ export function app(): CspDev.DirectiveDescriptor {
// github (spec for api-docs page)
'
raw.githubusercontent.com
'
,
// airtable (for dapps ratings)
'
api.airtable.com
'
,
].
filter
(
Boolean
),
'
script-src
'
:
[
...
...
nextjs/csp/policies/index.ts
View file @
ccc01ede
...
...
@@ -5,6 +5,7 @@ export { googleAnalytics } from './googleAnalytics';
export
{
googleFonts
}
from
'
./googleFonts
'
;
export
{
googleReCaptcha
}
from
'
./googleReCaptcha
'
;
export
{
growthBook
}
from
'
./growthBook
'
;
export
{
marketplace
}
from
'
./marketplace
'
;
export
{
mixpanel
}
from
'
./mixpanel
'
;
export
{
monaco
}
from
'
./monaco
'
;
export
{
safe
}
from
'
./safe
'
;
...
...
nextjs/csp/policies/marketplace.ts
0 → 100644
View file @
ccc01ede
import
type
CspDev
from
'
csp-dev
'
;
import
config
from
'
configs/app
'
;
const
feature
=
config
.
features
.
marketplace
;
export
function
marketplace
():
CspDev
.
DirectiveDescriptor
{
if
(
!
feature
.
isEnabled
)
{
return
{};
}
return
{
'
connect-src
'
:
[
'
api
'
in
feature
?
feature
.
api
.
endpoint
:
''
,
feature
.
rating
?
'
https://api.airtable.com
'
:
''
,
],
'
frame-src
'
:
[
'
*
'
,
],
};
}
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