File tree 4 files changed +15
-7
lines changed
4 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,10 @@ require (
15
15
golang.org/x/exp v0.0.0-20230807204917-050eac23e9de
16
16
)
17
17
18
- require github.com/dlclark/regexp2 v1.11.0 // indirect
18
+ require (
19
+ github.com/dlclark/regexp2 v1.11.0 // indirect
20
+ golang.org/x/net v0.28.0 // indirect
21
+ )
19
22
20
23
require (
21
24
github.com/alecthomas/chroma/v2 v2.14.0
@@ -26,7 +29,7 @@ require (
26
29
github.com/mattn/go-colorable v0.1.13 // indirect
27
30
github.com/mattn/go-isatty v0.0.19 // indirect
28
31
github.com/pmezard/go-difflib v1.0.0 // indirect
29
- golang.org/x/sys v0.12 .0 // indirect
32
+ golang.org/x/sys v0.23 .0 // indirect
30
33
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
31
34
gopkg.in/yaml.v3 v3.0.1 // indirect
32
35
)
Original file line number Diff line number Diff line change @@ -60,12 +60,16 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
60
60
github.com/stretchr/testify v1.9.0 /go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY =
61
61
golang.org/x/exp v0.0.0-20230807204917-050eac23e9de h1:l5Za6utMv/HsBWWqzt4S8X17j+kt1uVETUX5UFhn2rE =
62
62
golang.org/x/exp v0.0.0-20230807204917-050eac23e9de /go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc =
63
+ golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE =
64
+ golang.org/x/net v0.28.0 /go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg =
63
65
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M =
64
66
golang.org/x/sync v0.7.0 /go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk =
65
67
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab /go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg =
66
68
golang.org/x/sys v0.6.0 /go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg =
67
69
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o =
68
70
golang.org/x/sys v0.12.0 /go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg =
71
+ golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM =
72
+ golang.org/x/sys v0.23.0 /go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA =
69
73
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 /go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0 =
70
74
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk =
71
75
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c /go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q =
Original file line number Diff line number Diff line change @@ -29,10 +29,11 @@ type Cfg struct {
29
29
ConnectionURI string `env:"CONNECTION_URI" json:"-"`
30
30
31
31
// Web
32
- Headless bool `env:"HEADLESS" envDefault:"false" json:"headless"` // Enable website
33
- Analytics string `env:"ANALYTICS" envDefault:"" json:"analytics"` // <script> tag for analytics (leave blank to disable)
34
- Username string `env:"USERNAME" envDefault:"" json:"username"` // Basic Auth username. Required to enable Basic Auth
35
- Password string `env:"PASSWORD" envDefault:"" json:"password"` // Basic Auth password. Required to enable Basic Auth
32
+ Headless bool `env:"HEADLESS" envDefault:"false" json:"headless"` // Enable website
33
+ Analytics string `env:"ANALYTICS" envDefault:"" json:"analytics"` // <script> tag for analytics (leave blank to disable)
34
+ Username string `env:"USERNAME" envDefault:"" json:"username"` // Basic Auth username. Required to enable Basic Auth
35
+ Password string `env:"PASSWORD" envDefault:"" json:"password"` // Basic Auth password. Required to enable Basic Auth
36
+ ContentSecurityPolicy string `env:"CSP" envDefault:"default-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';" json:"csp"` // Content Security Policy. Must be changed if you are using analytics.
36
37
37
38
// Document
38
39
IDLength int `env:"ID_LENGTH" envDefault:"8" json:"id_length"`
Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ func (s *Server) RegisterHeaders() {
124
124
s .Router .Use (middleware .SetHeader ("X-Content-Type-Options" , "nosniff" ))
125
125
s .Router .Use (middleware .SetHeader ("Referrer-Policy" , "no-referrer-when-downgrade" ))
126
126
s .Router .Use (middleware .SetHeader ("Strict-Transport-Security" , "max-age=31536000; includeSubDomains; preload" ))
127
- s .Router .Use (middleware .SetHeader ("Content-Security-Policy" , "default-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';" ))
127
+ s .Router .Use (middleware .SetHeader ("Content-Security-Policy" , config . Config . ContentSecurityPolicy ))
128
128
}
129
129
130
130
func (s * Server ) MountStatic () {
You can’t perform that action at this time.
0 commit comments