public CspOptions() { Script = new CspScriptSrcOptions(); Style = new CspStyleSrcOptions(); Default = new CspDefaultSrcOptions(); #pragma warning disable CS0618 // Type or member is obsolete Child = new CspChildSrcOptions(); #pragma warning restore CS0618 // Type or member is obsolete Connect = new CspConnectSrcOptions(); Manifest = new CspManifestSrcOptions(); Font = new CspFontSrcOptions(); FormAction = new CspFormActionOptions(); Img = new CspImgSrcOptions(); Media = new CspMediaSrcOptions(); Object = new CspObjectSrcOptions(); FrameAncestors = new CspFrameAncestorsOptions(); PluginTypes = new CspPluginTypesOptions(); Sandbox = new CspSandboxOptions(); RequireSri = new CspRequireSriOptions(); Frame = new CspFrameSrcOptions(); Worker = new CspWorkerSrcOptions(); Prefetch = new CspPrefetchSrcOptions(); BaseUri = new CspBaseUriOptions(); OnSendingHeader = context => Task.CompletedTask; }
public void WithoutWithStrictDynamic_LeavesStrictDynamicToFalse() { var builder = new CspScriptsBuilder(); CspScriptSrcOptions options = builder.BuildOptions(); Assert.False(options.StrictDynamic); }
public void AllowUnsafeInline_SetsUnsafeInlineToTrue() { var builder = new CspScriptsBuilder(); builder.AllowUnsafeInline(); CspScriptSrcOptions options = builder.BuildOptions(); Assert.True(options.AllowUnsafeInline); }
public void From_AddsUrlToAllowedSources() { var builder = new CspScriptsBuilder(); builder.From("www.google.com"); CspScriptSrcOptions options = builder.BuildOptions(); Assert.Equal("www.google.com", options.AllowedSources.Single()); }
public void FromSelf_SetsAllowSelfToTrue() { var builder = new CspScriptsBuilder(); builder.FromSelf(); CspScriptSrcOptions options = builder.BuildOptions(); Assert.True(options.AllowSelf); }
public void WithStrictDynamic_SetsStrictDynamicToTrue() { var builder = new CspScriptsBuilder(); builder.WithStrictDynamic(); CspScriptSrcOptions options = builder.BuildOptions(); Assert.True(options.StrictDynamic); }
public void FromNowhere_SetsAllowNoneToTrue() { var builder = new CspScriptsBuilder(); builder.FromNowhere(); CspScriptSrcOptions options = builder.BuildOptions(); Assert.True(options.AllowNone); }
public void OnlyOverHttps_SetsAllowOnlyHttpsToTrue() { var builder = new CspScriptsBuilder(); builder.OnlyOverHttps(); CspScriptSrcOptions options = builder.BuildOptions(); Assert.True(options.AllowOnlyHttps); }
public void AddNonce_SetsAddNonceToTrue() { var builder = new CspScriptsBuilder(); builder.AddNonce(); CspScriptSrcOptions options = builder.BuildOptions(); Assert.True(options.AddNonce); }
public CspOptions() { Script = new CspScriptSrcOptions(); Style = new CspStyleSrcOptions(); Default = new CspDefaultSrcOptions(); Child = new CspChildSrcOptions(); Connect = new CspConnectSrcOptions(); Font = new CspFontSrcOptions(); FormAction = new CspFormActionOptions(); Img = new CspImgSrcOptions(); Media = new CspMediaSrcOptions(); Object = new CspObjectSrcOptions(); FrameAncestors = new CspFrameAncestorsOptions(); PluginTypes = new CspPluginTypesOptions(); Sandbox = new CspSandboxOptions(); }