Skip to content

Commit fc2ace5

Browse files
committed
Add info about pre-loading to the Sec-Fetch-Dest GET check
We check that the page is not being loaded with JS, which should prevent attackers from scraping all other pages if they gain access to one. It seems that this check is incompatible with Chrome prefetching (and obviously also any JS-based prefetching). The issue seems to be that Chrome does not know how will the prefetched document be used. According to their documentation, it should ignore prefetch requests with non-2XX status code. Our rejections are 403, so it should not display them to the user.
1 parent 8827eea commit fc2ace5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Framework/Framework/Hosting/DotvvmPresenter.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,11 @@ Cross site iframe are disabled in this application.
537537
if (context.RequestType is not DotvvmRequestType.SpaNavigate)
538538
await context.RejectRequest($"""
539539
Pages can not be loaded using Javascript for security reasons.
540+
540541
Try refreshing the page to get rid of the error.
541-
If you are the developer, you can disable this check by setting DotvvmConfiguration.Security.VerifySecFetchForPages.ExcludeRoute("{route}"). [dest: {dest}, site: {site}]
542+
543+
If you are the developer, you can disable this check by setting DotvvmConfiguration.Security.VerifySecFetchForPages.ExcludeRoute("{route}").
544+
Note that this security check is not compatible with page preloading, such as TurboLinks, Cloudflare Speed Brain, or similar. You'll need to disable one of these. The check is "only" a deference-in-depth measure against XSS and disabling it is perfectly safe in the absence of other vulnerabilities.
542545
""");
543546
if (site != "same-origin")
544547
await context.RejectRequest($"Cross site SPA requests are disabled.");

0 commit comments

Comments
 (0)