-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding no-ancestor http header to apps (so they're guaranteed to be at _top) #591
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,10 +79,23 @@ namespace SystemService | |
// TODO: avoid repacking (both directions) | ||
psibase::Actor<ServerInterface> iface(act.service, service); | ||
|
||
auto reqTarget = req.target; | ||
|
||
auto result = iface.serveSys(std::move(req)); | ||
if (result && !result->headers.empty() && serviceName != "common-sys") | ||
abortMessage("service " + service.str() + " attempted to set an http header"); | ||
|
||
if (reqTarget.size() == 0 || reqTarget.starts_with("/index.html")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you really mean |
||
{ | ||
// Check if the target header is already in the vector; if the header was not found, add it | ||
HttpHeader frameAncestorHeader = {"Content-Security-Policy", "frame-ancestors 'none';"}; | ||
auto pos = std::find(result->headers.begin(), result->headers.end(), frameAncestorHeader); | ||
Comment on lines
+91
to
+92
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will miss many valid ways to spell the header. |
||
if (pos == result->headers.end()) | ||
{ | ||
result->headers.push_back(frameAncestorHeader); | ||
} | ||
} | ||
|
||
setRetval(result); | ||
} // serve() | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
= default