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

Network Security : Implement StrictOrigin and StrictOriginWhenCrossOr… #14059

Merged
merged 4 commits into from Nov 7, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Code review comments and upstream merge conflicts

Incorporated code review comments in components/net/http_loader.rs
Resolved merge conflicts in cargo.lock file. Updated ReferrerPolicy in
lib.rs
  • Loading branch information
nmvk committed Nov 4, 2016
commit 26dac9854633ea765430021ef99edb431bdf24b7
@@ -305,17 +305,3 @@ pub enum FrameType {
IFrame,
MozBrowserIFrame,
}

/// [Policies](https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-states)
/// for providing a referrer header for a request
#[derive(Clone, Copy, Debug, Deserialize, HeapSizeOf, Serialize)]
pub enum ReferrerPolicy {
NoReferrer,
NoReferrerWhenDowngrade,
Origin,
SameOrigin,
OriginWhenCrossOrigin,
UnsafeUrl,
StrictOrigin,
StrictOriginWhenCrossOrigin
}
@@ -447,15 +447,11 @@ fn strict_origin(referrer_url: Url, url: Url) -> Option<Url> {

/// https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-strict-origin-when-cross-origin
fn strict_origin_when_cross_origin(referrer_url: Url, url: Url) -> Option<Url> {
let cross_origin = referrer_url.origin() != url.origin();
if referrer_url.scheme() == "https" && url.scheme() != "https" {
return None;
} else {
if cross_origin {
return strip_url(referrer_url, true);
}
return strip_url(referrer_url, false);
}
let cross_origin = referrer_url.origin() != url.origin();
return strip_url(referrer_url, cross_origin);
}

/// https://w3c.github.io/webappsec-referrer-policy/#strip-url
@@ -125,6 +125,10 @@ pub enum ReferrerPolicy {
OriginWhenCrossOrigin,
/// "unsafe-url"
UnsafeUrl,
/// "strict-origin"
StrictOrigin,
/// "strict-origin-when-cross-origin"
StrictOriginWhenCrossOrigin,
}

#[derive(Clone, Deserialize, Serialize, HeapSizeOf)]

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

You are viewing a condensed version of this merge commit. You can view the full changes here.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.