-
Notifications
You must be signed in to change notification settings - Fork 352
Correcting multiple X-Frame-Options header #50
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
Changes from 2 commits
d20956a
3048853
46bb648
f7a6ea7
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 |
---|---|---|
|
@@ -104,7 +104,11 @@ public TagBuilder GetFormInputElement(HttpContextBase httpContext) | |
// Adding X-Frame-Options header to prevent ClickJacking. See | ||
// http://tools.ietf.org/html/draft-ietf-websec-x-frame-options-10 | ||
// for more information. | ||
httpContext.Response.AddHeader("X-Frame-Options", "SAMEORIGIN"); | ||
const string xFrameHeaderName = "X-Frame-Options"; | ||
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. Name will still fail a build with the SA130 error. (Might be worth setting up AppVeyor for this repo.) 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. @dougbu I uploaded the Do you need further changes to get past the SA130 error? 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. Yes, please renamed the 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. All set, let me know if you need anything else. Thanks. |
||
if (httpContext.Response.Headers[xFrameHeaderName] == null) | ||
{ | ||
httpContext.Response.AddHeader(xFrameHeaderName, "SAMEORIGIN"); | ||
} | ||
} | ||
|
||
// <input type="hidden" name="__AntiForgeryToken" value="..." /> | ||
|
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.
Should this instead just be changed to:
This would make sure that anti-forgery gets the header it wants by overwriting any existing value.
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.
Thanks for getting back to me Eilon. The "If"/Add check was to ensure that say if an administrator in IIS forced this header to a setting other than SAMEORIGIN (e.g. DENY or ALLOW FROM) it would allow them to. If you always just set it to SAMEORIGIN you are not giving the admin the option to override it.
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.
I was just checking back in, does the above comment make sense?
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.
Ok this makes sense. I guess it's debatable which one should win over the other but I don't feel strongly about that, so this should be fine.