public void GetMissingRequiredPoliciesShouldBeEmptyWhenAllRequiredKnown()
        {
            var serverPoliciesAllRequiredKnown = new Dictionary <string, SecurityPolicyState>
            {
                { "record_sql", DisabledRequiredState },
                { "attributes_include", DisabledRequiredState },
                { "allow_raw_exception_messages", DisabledRequiredState },
                { "custom_events", DisabledRequiredState },
                { "custom_parameters", DisabledRequiredState },
                { "custom_instrumentation_editor", DisabledRequiredState },
                { "dotnet_unknown_setting", DisabledOptionalState }
            };

            var missingRequiredPolicies = SecurityPoliciesConfiguration.GetMissingRequiredPolicies(serverPoliciesAllRequiredKnown);

            Assert.IsEmpty(missingRequiredPolicies);
        }
        public void GetMissingExpectedSeverPolicyNamesShouldContainMissingPolicies()
        {
            var serverPoliciesWithMissing = new Dictionary <string, SecurityPolicyState>
            {
                { "record_sql", DisabledOptionalState },
                { "attributes_include", DisabledOptionalState },
                { "allow_raw_exception_messages", DisabledOptionalState },
                { "custom_events", DisabledOptionalState }
            };

            var expectedMissing = new List <string> {
                "custom_parameters", "custom_instrumentation_editor"
            };

            var missingExpectedPolicies = SecurityPoliciesConfiguration.GetMissingExpectedSeverPolicyNames(serverPoliciesWithMissing);

            Assert.AreEqual(expectedMissing, missingExpectedPolicies);
        }
        public void GetMissingRequiredPoliciesShouldContainMissingRequiredPolicies()
        {
            var serverPoliciesAllRequiredKnown = new Dictionary <string, SecurityPolicyState>
            {
                { "record_sql", DisabledRequiredState },
                { "attributes_include", DisabledRequiredState },
                { "allow_raw_exception_messages", DisabledRequiredState },
                { "custom_events", DisabledRequiredState },
                { "custom_parameters", DisabledRequiredState },
                { "custom_instrumentation_editor", DisabledRequiredState },
                { "dotnet_unknown_setting", DisabledRequiredState }
            };

            var expectedMissing = new List <string> {
                "dotnet_unknown_setting"
            };

            var missingRequiredPolicies = SecurityPoliciesConfiguration.GetMissingRequiredPolicies(serverPoliciesAllRequiredKnown);

            Assert.AreEqual(expectedMissing, missingRequiredPolicies);
        }
Пример #4
0
 public InternalConfiguration(IEnvironment environment, configuration localConfiguration, ServerConfiguration serverConfiguration, RunTimeConfiguration runTimeConfiguration, SecurityPoliciesConfiguration securityPoliciesConfiguration, IProcessStatic processStatic, IHttpRuntimeStatic httpRuntimeStatic, IConfigurationManagerStatic configurationManagerStatic, IDnsStatic dnsStatic) :
     base(environment, localConfiguration, serverConfiguration, runTimeConfiguration, securityPoliciesConfiguration, processStatic, httpRuntimeStatic, configurationManagerStatic, dnsStatic)
 {
 }
 private void OnSecurityPoliciesUpdated(SecurityPoliciesConfigurationUpdatedEvent securityPoliciesConfigurationUpdatedEvent)
 {
     _securityPoliciesConfiguration = securityPoliciesConfigurationUpdatedEvent.Configuration;
     UpdateAndPublishConfiguration(ConfigurationUpdateSource.SecurityPolicies);
 }