Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

cool-ant
Copy link
Member

No description provided.

@@ -11,7 +11,13 @@ namespace psibase
{
std::string name;
std::string value;

friend bool operator==(const HttpHeader& lhs, const HttpHeader& rhs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use = default

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"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really mean starts_with? ends_with or == would make more sense to me.

Comment on lines +91 to +92
HttpHeader frameAncestorHeader = {"Content-Security-Policy", "frame-ancestors 'none';"};
auto pos = std::find(result->headers.begin(), result->headers.end(), frameAncestorHeader);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will miss many valid ways to spell the header.
Also, if the service has already provided a different value of frame-ancestors, do we still want to add frame-ancestors 'none'?

Base automatically changed from dev/plugins to main March 8, 2024 21:06
@James-Mart
Copy link
Member

No longer needed.

@James-Mart James-Mart closed this Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants