Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"Bash(dotnet test:*)",
"Bash(dotnet build:*)",
"Bash(dotnet pack:*)"
],
"additionalDirectories": [
"D:\\Code\\GitHub\\migration-validator"
]
}
}
4 changes: 2 additions & 2 deletions src/PSW/Controllers/CommunityTemplatesApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public async Task<IActionResult> GetIndex()
{
cacheEntry.AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(CacheTimeInMinutes);

var indexPath = Path.Combine(_webHostEnvironment.WebRootPath,
"community-templates",
var indexPath = Path.Combine(_webHostEnvironment.WebRootPath,
"community-templates",
"index.json");

if (!System.IO.File.Exists(indexPath))
Expand Down
16 changes: 14 additions & 2 deletions src/PSW/Middleware/SecurityHeadersMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,20 @@ public Task Invoke(HttpContext context)
context.Response.Headers.Append("X-Xss-Protection", "0");
context.Response.Headers.Append("Referrer-Policy", "no-referrer");
context.Response.Headers.Append("X-Permitted-Cross-Domain-Policies", "none");
context.Response.Headers.Append("X-Powered-By", "");
//context.Response.Headers.Add("Content-Security-Policy", "default-src 'self';script-src 'self' code.jquery.com;style-src 'self' cdn.rawgit.com cdn.jsdelivr.net;img-src 'self' our.umbraco.com;font-src 'self';connect-src 'self'");
context.Response.OnStarting(() =>
{
context.Response.Headers.Remove("X-Powered-By");
context.Response.Headers.Remove("Server");
return Task.CompletedTask;
});
context.Response.Headers.Append("Content-Security-Policy",
"default-src 'self'; " +
"script-src 'self' 'unsafe-inline' www.googletagmanager.com cdnjs.cloudflare.com cdn.jsdelivr.net; " +
"style-src 'self' 'unsafe-inline' cdnjs.cloudflare.com cdn.jsdelivr.net; " +
"img-src 'self' data:; " +
"font-src 'self'; " +
"connect-src 'self' *.google-analytics.com *.analytics.google.com *.googletagmanager.com; " +
"frame-ancestors 'self'");
context.Response.Headers.Append("Permissions-Policy", "fullscreen=(), geolocation=()");
return _next(context);
}
Expand Down
7 changes: 6 additions & 1 deletion src/PSW/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,18 @@
builder.Services.Configure<PSWConfig>(
builder.Configuration.GetSection(PSWConfig.SectionName));

builder.Services.AddHsts(options =>
{
options.MaxAge = TimeSpan.FromDays(365);
options.IncludeSubDomains = true;
});

var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}

Expand Down