Skip to content

Commit

Permalink
feat: set CSP header value
Browse files Browse the repository at this point in the history
  • Loading branch information
macrat committed Jan 27, 2024
1 parent 44c9b92 commit 17fc295
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions builder/autoindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,10 @@ func (g *IndexGenerator) generateConfig(dst fs.Writable, as ArticleList, conf Co
})

for _, a := range as {
if len(a.Headers) == 0 {
continue
}

h := make(map[string]string)

for k, v := range conf.Headers {
Expand Down
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"headers": {
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "deny",
"Content-Security-Policy": "default-src 'self'; frame-ancestors 'none'"
"Content-Security-Policy": "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; frame-ancestors 'none'"
},
"redirects": [
{"source": "/about.html", "destination": "/about"},
Expand Down
2 changes: 2 additions & 0 deletions pages/blog/2020/05/gandi-redirect-to-na-gcsip-com.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ image: [/blog/2020/05/gandi-na-gcsip-com.png]
faq:
- question: Gandi.netにクレジットカードを登録するときに出てくる「na.gcsip.com」は安全?
answer: Gandi.netが使用している正規の決済サービスのようです。なので多分大丈夫。
headers:
Content-Security-Policy: "default-src 'self'; script-src 'self' 'unsafe-inline' https://platform.twitter.com/; style-src 'self' 'unsafe-inline' https://*.twitter.com/; img-src 'self' https://*.twitter.com/ https://*.twimg.com/; frame-src https://platform.twitter.com/ https://syndication.twitter.com/; frame-ancestors 'none'"
---

# TL;DR
Expand Down
2 changes: 2 additions & 0 deletions pages/blog/2020/11/powershell-use-generic-class.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ faq:
answer: 引数の型を丁寧に明示してあげると上手くいくことがあるようです。
- question: 'HashSet::newするときに「MethodException: Cannot find an overload for "new" and the argument count: "1".」ってエラーが出た。これは何?'
answer: もしかしたら、引数の型が正しくないエラーかもしれません。
headers:
Content-Security-Policy: "default-src 'self'; script-src 'self' 'unsafe-inline' https://platform.twitter.com/; style-src 'self' 'unsafe-inline' https://*.twitter.com/; img-src 'self' https://*.twitter.com/ https://*.twimg.com/; frame-src https://platform.twitter.com/ https://syndication.twitter.com/; frame-ancestors 'none'"
---

[昨日の記事](/blog/2020/11/powershell-unique-value-count)の中で[System.Collections.Generic.HashSet<T>](https://docs.microsoft.com/ja-jp/dotnet/api/system.collections.generic.hashset-1)というクラスを使いました。
Expand Down

0 comments on commit 17fc295

Please sign in to comment.