|
|
|
@ -13,12 +13,14 @@ mod passing {
|
|
|
|
|
fn isolated() {
|
|
|
|
|
let opt_isolate: bool = true;
|
|
|
|
|
let opt_no_css: bool = false;
|
|
|
|
|
let opt_no_fonts: bool = false;
|
|
|
|
|
let opt_no_frames: bool = false;
|
|
|
|
|
let opt_no_js: bool = false;
|
|
|
|
|
let opt_no_images: bool = false;
|
|
|
|
|
let csp_content = html::csp(
|
|
|
|
|
opt_isolate,
|
|
|
|
|
opt_no_css,
|
|
|
|
|
opt_no_fonts,
|
|
|
|
|
opt_no_frames,
|
|
|
|
|
opt_no_js,
|
|
|
|
|
opt_no_images,
|
|
|
|
@ -31,12 +33,14 @@ mod passing {
|
|
|
|
|
fn no_css() {
|
|
|
|
|
let opt_isolate: bool = false;
|
|
|
|
|
let opt_no_css: bool = true;
|
|
|
|
|
let opt_no_fonts: bool = false;
|
|
|
|
|
let opt_no_frames: bool = false;
|
|
|
|
|
let opt_no_js: bool = false;
|
|
|
|
|
let opt_no_images: bool = false;
|
|
|
|
|
let csp_content = html::csp(
|
|
|
|
|
opt_isolate,
|
|
|
|
|
opt_no_css,
|
|
|
|
|
opt_no_fonts,
|
|
|
|
|
opt_no_frames,
|
|
|
|
|
opt_no_js,
|
|
|
|
|
opt_no_images,
|
|
|
|
@ -45,16 +49,38 @@ mod passing {
|
|
|
|
|
assert_eq!(csp_content, "style-src 'none';");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn no_fonts() {
|
|
|
|
|
let opt_isolate: bool = false;
|
|
|
|
|
let opt_no_css: bool = false;
|
|
|
|
|
let opt_no_fonts: bool = true;
|
|
|
|
|
let opt_no_frames: bool = false;
|
|
|
|
|
let opt_no_js: bool = false;
|
|
|
|
|
let opt_no_images: bool = false;
|
|
|
|
|
let csp_content = html::csp(
|
|
|
|
|
opt_isolate,
|
|
|
|
|
opt_no_css,
|
|
|
|
|
opt_no_fonts,
|
|
|
|
|
opt_no_frames,
|
|
|
|
|
opt_no_js,
|
|
|
|
|
opt_no_images,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
assert_eq!(csp_content, "font-src 'none';");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn no_frames() {
|
|
|
|
|
let opt_isolate: bool = false;
|
|
|
|
|
let opt_no_css: bool = false;
|
|
|
|
|
let opt_no_fonts: bool = false;
|
|
|
|
|
let opt_no_frames: bool = true;
|
|
|
|
|
let opt_no_js: bool = false;
|
|
|
|
|
let opt_no_images: bool = false;
|
|
|
|
|
let csp_content = html::csp(
|
|
|
|
|
opt_isolate,
|
|
|
|
|
opt_no_css,
|
|
|
|
|
opt_no_fonts,
|
|
|
|
|
opt_no_frames,
|
|
|
|
|
opt_no_js,
|
|
|
|
|
opt_no_images,
|
|
|
|
@ -67,12 +93,14 @@ mod passing {
|
|
|
|
|
fn no_js() {
|
|
|
|
|
let opt_isolate: bool = false;
|
|
|
|
|
let opt_no_css: bool = false;
|
|
|
|
|
let opt_no_fonts: bool = false;
|
|
|
|
|
let opt_no_frames: bool = false;
|
|
|
|
|
let opt_no_js: bool = true;
|
|
|
|
|
let opt_no_images: bool = false;
|
|
|
|
|
let csp_content = html::csp(
|
|
|
|
|
opt_isolate,
|
|
|
|
|
opt_no_css,
|
|
|
|
|
opt_no_fonts,
|
|
|
|
|
opt_no_frames,
|
|
|
|
|
opt_no_js,
|
|
|
|
|
opt_no_images,
|
|
|
|
@ -85,12 +113,14 @@ mod passing {
|
|
|
|
|
fn no_image() {
|
|
|
|
|
let opt_isolate: bool = false;
|
|
|
|
|
let opt_no_css: bool = false;
|
|
|
|
|
let opt_no_fonts: bool = false;
|
|
|
|
|
let opt_no_frames: bool = false;
|
|
|
|
|
let opt_no_js: bool = false;
|
|
|
|
|
let opt_no_images: bool = true;
|
|
|
|
|
let csp_content = html::csp(
|
|
|
|
|
opt_isolate,
|
|
|
|
|
opt_no_css,
|
|
|
|
|
opt_no_fonts,
|
|
|
|
|
opt_no_frames,
|
|
|
|
|
opt_no_js,
|
|
|
|
|
opt_no_images,
|
|
|
|
@ -103,17 +133,19 @@ mod passing {
|
|
|
|
|
fn all() {
|
|
|
|
|
let opt_isolate: bool = true;
|
|
|
|
|
let opt_no_css: bool = true;
|
|
|
|
|
let opt_no_fonts: bool = true;
|
|
|
|
|
let opt_no_frames: bool = true;
|
|
|
|
|
let opt_no_js: bool = true;
|
|
|
|
|
let opt_no_images: bool = true;
|
|
|
|
|
let csp_content = html::csp(
|
|
|
|
|
opt_isolate,
|
|
|
|
|
opt_no_css,
|
|
|
|
|
opt_no_fonts,
|
|
|
|
|
opt_no_frames,
|
|
|
|
|
opt_no_js,
|
|
|
|
|
opt_no_images,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
assert_eq!(csp_content, "default-src 'unsafe-inline' data:; style-src 'none'; frame-src 'none'; child-src 'none'; script-src 'none'; img-src data:;");
|
|
|
|
|
assert_eq!(csp_content, "default-src 'unsafe-inline' data:; style-src 'none'; font-src 'none'; frame-src 'none'; child-src 'none'; script-src 'none'; img-src data:;");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|