Search in sources :

Example 6 with ScanFilter

use of org.zaproxy.zap.extension.ascan.filters.ScanFilter in project zaproxy by zaproxy.

the class HostProcessUnitTest method shouldHandleExceptionsThrownByFilters.

@Test
void shouldHandleExceptionsThrownByFilters() {
    // Given
    ScanFilter scanFilter = mock(ScanFilter.class);
    given(scanFilter.isFiltered(any())).willThrow(RuntimeException.class);
    given(scanner.getScanFilters()).willReturn(asList(scanFilter));
    StructuralNode node = createLeafNode("GET:file", "GET", "http://localhost/file");
    hostProcess.setStartNode(node);
    // When
    hostProcess.run();
    // Then
    assertThat(hostProcess.getTestTotalCount(), is(equalTo(1)));
    verify(scanFilter).isFiltered(node);
    verify(scanner, times(0)).notifyFilteredMessage(any(), any());
}
Also used : StructuralNode(org.zaproxy.zap.model.StructuralNode) ScanFilter(org.zaproxy.zap.extension.ascan.filters.ScanFilter) Test(org.junit.jupiter.api.Test)

Aggregations

ScanFilter (org.zaproxy.zap.extension.ascan.filters.ScanFilter)6 Test (org.junit.jupiter.api.Test)3 StructuralNode (org.zaproxy.zap.model.StructuralNode)3 ArrayList (java.util.ArrayList)2 DatabaseException (org.parosproxy.paros.db.DatabaseException)2 HttpMalformedHeaderException (org.parosproxy.paros.network.HttpMalformedHeaderException)2 HttpMessage (org.parosproxy.paros.network.HttpMessage)2 FilterResult (org.zaproxy.zap.extension.ascan.filters.FilterResult)2 IOException (java.io.IOException)1 BadLocationException (javax.swing.text.BadLocationException)1 Highlight (javax.swing.text.Highlighter.Highlight)1 ConfigurationException (org.apache.commons.configuration.ConfigurationException)1 Alert (org.parosproxy.paros.core.scanner.Alert)1 ScannerParam (org.parosproxy.paros.core.scanner.ScannerParam)1 Session (org.parosproxy.paros.model.Session)1 ExtensionAlert (org.zaproxy.zap.extension.alert.ExtensionAlert)1 ExtensionRuleConfig (org.zaproxy.zap.extension.ruleconfig.ExtensionRuleConfig)1 RuleConfigParam (org.zaproxy.zap.extension.ruleconfig.RuleConfigParam)1 ScriptCollection (org.zaproxy.zap.extension.script.ScriptCollection)1 TechSet (org.zaproxy.zap.model.TechSet)1