ParameterUtil.java

1
package com.jsql.util;
2
3
import com.jsql.model.InjectionModel;
4
import com.jsql.model.bean.util.Interaction;
5
import com.jsql.model.bean.util.Request;
6
import com.jsql.model.exception.InjectionFailureException;
7
import com.jsql.model.injection.method.AbstractMethodInjection;
8
import org.apache.commons.lang3.StringUtils;
9
import org.apache.logging.log4j.LogManager;
10
import org.apache.logging.log4j.Logger;
11
12
import java.net.IDN;
13
import java.net.MalformedURLException;
14
import java.net.URI;
15
import java.net.URISyntaxException;
16
import java.util.AbstractMap.SimpleEntry;
17
import java.util.ArrayList;
18
import java.util.Arrays;
19
import java.util.List;
20
import java.util.Objects;
21
import java.util.concurrent.CopyOnWriteArrayList;
22
import java.util.regex.Matcher;
23
import java.util.regex.Pattern;
24
import java.util.stream.Collectors;
25
26
public class ParameterUtil {
27
28
    /**
29
     * Log4j logger sent to view.
30
     */
31
    private static final Logger LOGGER = LogManager.getRootLogger();
32
33
    /**
34
     * Query string built from the URL submitted by user.
35
     */
36
    private List<SimpleEntry<String, String>> listQueryString = new CopyOnWriteArrayList<>();
37
38
    /**
39
     * Request submitted by user.
40
     */
41
    private List<SimpleEntry<String, String>> listRequest = new CopyOnWriteArrayList<>();
42
43
    /**
44
     * Header submitted by user.
45
     */
46
    private List<SimpleEntry<String, String>> listHeader = new CopyOnWriteArrayList<>();
47
48
    private String rawRequest = StringUtils.EMPTY;
49
    private String rawHeader = StringUtils.EMPTY;
50
    private boolean isMultipartRequest = false;
51
    private static final String FORMAT_KEY_VALUE = "%s=%s";
52
53
    private final InjectionModel injectionModel;
54
    
55
    public ParameterUtil(InjectionModel injectionModel) {
56
        this.injectionModel = injectionModel;
57
    }
58
    
59
    /**
60
     * Send each parameter from the GUI to the model in order to
61
     * start the preparation of injection, the injection process is
62
     * started in a new thread via model function inputValidation().
63
     */
64
    public void controlInput(
65
        String urlQuery,
66
        String rawRequest,
67
        String rawHeader,
68
        AbstractMethodInjection methodInjection,
69
        String typeRequest,
70
        boolean isScanning
71
    ) {
72
        try {
73
            String urlQueryFixed = urlQuery;
74
            // Keep single check
75 1 1. controlInput : negated conditional → NO_COVERAGE
            if (urlQueryFixed.isEmpty()) {
76
                throw new MalformedURLException("empty URL");
77 1 1. controlInput : negated conditional → NO_COVERAGE
            } else if (!urlQueryFixed.matches("(?i)^https?://.*")) {
78 1 1. controlInput : negated conditional → NO_COVERAGE
                if (!urlQueryFixed.matches("(?i)^\\w+://.*")) {
79
                    LOGGER.log(LogLevelUtil.CONSOLE_INFORM, "Undefined URL protocol, forcing to [http://]");
80
                    urlQueryFixed = "http://"+ urlQueryFixed;
81
                } else {
82
                    throw new MalformedURLException("unknown URL protocol");
83
                }
84
            }
85
86
            String authority = URI.create(urlQueryFixed).getAuthority();
87 1 1. controlInput : negated conditional → NO_COVERAGE
            if (authority == null) {
88
                throw new MalformedURLException("incorrect domain authority");
89
            }
90
            String authorityPunycode = IDN.toASCII(authority);
91 1 1. controlInput : negated conditional → NO_COVERAGE
            if (!authority.equals(authorityPunycode)) {
92
                LOGGER.log(LogLevelUtil.CONSOLE_INFORM, "Punycode domain detected, using [{}] instead of [{}]", authorityPunycode, authority);
93
                urlQueryFixed = urlQueryFixed.replace(authority, authorityPunycode);
94
            }
95
96 1 1. controlInput : removed call to com/jsql/util/ParameterUtil::initQueryString → NO_COVERAGE
            this.initQueryString(urlQueryFixed);
97 1 1. controlInput : removed call to com/jsql/util/ParameterUtil::initHeader → NO_COVERAGE
            this.initHeader(rawHeader);
98 1 1. controlInput : removed call to com/jsql/util/ParameterUtil::initRequest → NO_COVERAGE
            this.initRequest(rawRequest);
99
100 1 1. controlInput : removed call to com/jsql/util/ConnectionUtil::setMethodInjection → NO_COVERAGE
            this.injectionModel.getMediatorUtils().getConnectionUtil().setMethodInjection(methodInjection);
101 1 1. controlInput : removed call to com/jsql/util/ConnectionUtil::setTypeRequest → NO_COVERAGE
            this.injectionModel.getMediatorUtils().getConnectionUtil().setTypeRequest(typeRequest);
102
            
103 1 1. controlInput : negated conditional → NO_COVERAGE
            if (isScanning) {
104 1 1. controlInput : removed call to com/jsql/model/InjectionModel::beginInjection → NO_COVERAGE
                this.injectionModel.beginInjection();
105
            } else {
106 1 1. controlInput : removed call to java/lang/Thread::start → NO_COVERAGE
                new Thread(this.injectionModel::beginInjection, "ThreadBeginInjection").start();  // in thread
107
            }
108
        } catch (IllegalArgumentException | MalformedURLException | URISyntaxException e) {
109
            LOGGER.log(LogLevelUtil.CONSOLE_ERROR, "Incorrect Url: {}", e.getMessage());
110
            
111
            // Incorrect URL, reset the start button
112
            var request = new Request();
113 1 1. controlInput : removed call to com/jsql/model/bean/util/Request::setMessage → NO_COVERAGE
            request.setMessage(Interaction.END_PREPARATION);
114 1 1. controlInput : removed call to com/jsql/model/InjectionModel::sendToViews → NO_COVERAGE
            this.injectionModel.sendToViews(request);
115
        }
116
    }
117
118
    /**
119
     * Check integrity of parameters defined by user.
120
     * @throws InjectionFailureException when params integrity is failure
121
     */
122
    public void checkParametersFormat() throws InjectionFailureException {
123 1 1. checkParametersFormat : removed call to com/jsql/util/ParameterUtil::checkOneOrLessStar → SURVIVED
        this.checkOneOrLessStar();
124 1 1. checkParametersFormat : removed call to com/jsql/util/ParameterUtil::checkStarMatchMethod → SURVIVED
        this.checkStarMatchMethod();
125 1 1. checkParametersFormat : removed call to com/jsql/util/ParameterUtil::checkMethodNotEmpty → KILLED
        this.checkMethodNotEmpty();
126 1 1. checkParametersFormat : removed call to com/jsql/util/ParameterUtil::checkMultipart → NO_COVERAGE
        this.checkMultipart();
127 1 1. checkParametersFormat : negated conditional → NO_COVERAGE
        if (ParameterUtil.isInvalidName(this.injectionModel.getMediatorUtils().getConnectionUtil().getTypeRequest())) {
128
            throw new InjectionFailureException(String.format(
129
                "Illegal method: \"%s\"",
130
                this.injectionModel.getMediatorUtils().getConnectionUtil().getTypeRequest()
131
            ));
132
        }
133
    }
134
135
    // ABNF primitives defined in RFC 7230
136
    private static final boolean[] tchar = new boolean[256];
137
138
    static {
139
        char[] allowedTokenChars = (
140
            "!#$%&'*+-.^_`|~0123456789" +
141
            "abcdefghijklmnopqrstuvwxyz" +
142
            "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
143
        ).toCharArray();
144
        for (char c : allowedTokenChars) {
145
            ParameterUtil.tchar[c] = true;
146
        }
147
    }
148
149
    /*
150
     * Validates a RFC 7230 field-name.
151
     */
152
    public static boolean isInvalidName(String token) {
153 2 1. isInvalidName : negated conditional → NO_COVERAGE
2. isInvalidName : changed conditional boundary → NO_COVERAGE
        for (int i = 0 ; i < token.length() ; i++) {
154
            char c = token.charAt(i);
155 3 1. isInvalidName : negated conditional → NO_COVERAGE
2. isInvalidName : negated conditional → NO_COVERAGE
3. isInvalidName : changed conditional boundary → NO_COVERAGE
            if (c > 255 || !ParameterUtil.tchar[c]) {
156 1 1. isInvalidName : replaced boolean return with false for com/jsql/util/ParameterUtil::isInvalidName → NO_COVERAGE
                return true;
157
            }
158
        }
159 2 1. isInvalidName : replaced boolean return with true for com/jsql/util/ParameterUtil::isInvalidName → NO_COVERAGE
2. isInvalidName : replaced boolean return with false for com/jsql/util/ParameterUtil::isInvalidName → NO_COVERAGE
        return token.isEmpty();
160
    }
161
162
    private void checkMultipart() throws InjectionFailureException {
163
        this.isMultipartRequest = false;
164
165
        if (
166
            this.getListHeader()
167
            .stream()
168 2 1. lambda$checkMultipart$0 : replaced boolean return with true for com/jsql/util/ParameterUtil::lambda$checkMultipart$0 → NO_COVERAGE
2. lambda$checkMultipart$0 : replaced boolean return with false for com/jsql/util/ParameterUtil::lambda$checkMultipart$0 → NO_COVERAGE
            .filter(entry -> "Content-Type".equals(entry.getKey()))
169 1 1. checkMultipart : negated conditional → NO_COVERAGE
            .anyMatch(entry ->
170 2 1. lambda$checkMultipart$1 : replaced boolean return with true for com/jsql/util/ParameterUtil::lambda$checkMultipart$1 → NO_COVERAGE
2. lambda$checkMultipart$1 : negated conditional → NO_COVERAGE
                entry.getValue() != null
171 1 1. lambda$checkMultipart$1 : negated conditional → NO_COVERAGE
                && entry.getValue().contains("multipart/form-data")
172 1 1. lambda$checkMultipart$1 : negated conditional → NO_COVERAGE
                && entry.getValue().contains("boundary=")
173
            )
174
        ) {
175
            LOGGER.log(LogLevelUtil.CONSOLE_DEFAULT, "Multipart boundary found in header");
176
            Matcher matcherBoundary = Pattern.compile("boundary=([^;]*)").matcher(this.getHeaderFromEntries());
177 1 1. checkMultipart : negated conditional → NO_COVERAGE
            if (matcherBoundary.find()) {
178
                String boundary = matcherBoundary.group(1);
179 1 1. checkMultipart : negated conditional → NO_COVERAGE
                if (!this.rawRequest.contains(boundary)) {
180
                    throw new InjectionFailureException(
181
                        String.format("Incorrect multipart data, boundary not found in body: %s", boundary)
182
                    );
183
                } else {
184
                    this.isMultipartRequest = true;
185
                }
186
            }
187
        }
188
    }
189
190
    private void checkOneOrLessStar() throws InjectionFailureException {
191
        var nbStarInParameter = 0;
192
        
193 1 1. checkOneOrLessStar : negated conditional → SURVIVED
        if (this.getQueryStringFromEntries().contains(InjectionModel.STAR)) {
194 1 1. checkOneOrLessStar : Changed increment from 1 to -1 → SURVIVED
            nbStarInParameter++;
195
        }
196 1 1. checkOneOrLessStar : negated conditional → SURVIVED
        if (this.getRequestFromEntries().contains(InjectionModel.STAR)) {
197 1 1. checkOneOrLessStar : Changed increment from 1 to -1 → SURVIVED
            nbStarInParameter++;
198
        }
199 1 1. checkOneOrLessStar : negated conditional → SURVIVED
        if (this.getHeaderFromEntries().contains(InjectionModel.STAR)) {
200 1 1. checkOneOrLessStar : Changed increment from 1 to -1 → SURVIVED
            nbStarInParameter++;
201
        }
202
        
203
        // Injection Point
204 2 1. checkOneOrLessStar : negated conditional → SURVIVED
2. checkOneOrLessStar : changed conditional boundary → SURVIVED
        if (
205
            nbStarInParameter > 1
206 2 1. checkOneOrLessStar : negated conditional → SURVIVED
2. checkOneOrLessStar : changed conditional boundary → SURVIVED
            || StringUtils.countMatches(this.getQueryStringFromEntries(), "*") > 1
207 2 1. checkOneOrLessStar : negated conditional → SURVIVED
2. checkOneOrLessStar : changed conditional boundary → SURVIVED
            || StringUtils.countMatches(this.getRequestFromEntries(), "*") > 1
208 2 1. checkOneOrLessStar : negated conditional → SURVIVED
2. checkOneOrLessStar : changed conditional boundary → SURVIVED
            || StringUtils.countMatches(this.getHeaderFromEntries(), "*") > 1
209
        ) {
210
            throw new InjectionFailureException("Character insertion [*] must be used once in Query String, Request or Header parameters");
211
        }
212
    }
213
    
214
    public void checkStarMatchMethod() throws InjectionFailureException {
215
        AbstractMethodInjection methodInjection = this.injectionModel.getMediatorUtils().getConnectionUtil().getMethodInjection();
216
        boolean isCheckingAllParam = this.injectionModel.getMediatorUtils().getPreferencesUtil().isCheckingAllParam();
217
218
        if (
219 1 1. checkStarMatchMethod : negated conditional → SURVIVED
            this.getQueryStringFromEntries().contains(InjectionModel.STAR)
220 2 1. checkStarMatchMethod : negated conditional → SURVIVED
2. checkStarMatchMethod : negated conditional → SURVIVED
            && methodInjection != this.injectionModel.getMediatorMethod().getQuery()
221
            && !isCheckingAllParam
222
        ) {
223
            throw new InjectionFailureException("Select method GET to use character [*] or remove [*] from GET parameters");
224
        } else if (
225 1 1. checkStarMatchMethod : negated conditional → SURVIVED
            this.getRequestFromEntries().contains(InjectionModel.STAR)
226 2 1. checkStarMatchMethod : negated conditional → SURVIVED
2. checkStarMatchMethod : negated conditional → SURVIVED
            && methodInjection != this.injectionModel.getMediatorMethod().getRequest()
227
            && !isCheckingAllParam
228
        ) {
229
            throw new InjectionFailureException("Select a Request method (like POST) to use [*], or remove [*] from Request parameters");
230
        } else if (
231 1 1. checkStarMatchMethod : negated conditional → SURVIVED
            this.getHeaderFromEntries().contains(InjectionModel.STAR)
232 2 1. checkStarMatchMethod : negated conditional → SURVIVED
2. checkStarMatchMethod : negated conditional → SURVIVED
            && methodInjection != this.injectionModel.getMediatorMethod().getHeader()
233
            && !isCheckingAllParam
234
        ) {
235
            throw new InjectionFailureException("Select method Header to use character [*] or remove [*] from Header parameters");
236
        }
237
    }
238
    
239
    public void checkMethodNotEmpty() throws InjectionFailureException {
240
        AbstractMethodInjection methodInjection = this.injectionModel.getMediatorUtils().getConnectionUtil().getMethodInjection();
241
        boolean isCheckingAllParam = this.injectionModel.getMediatorUtils().getPreferencesUtil().isCheckingAllParam();
242
        
243
        if (
244 2 1. checkMethodNotEmpty : negated conditional → KILLED
2. checkMethodNotEmpty : negated conditional → KILLED
            methodInjection == this.injectionModel.getMediatorMethod().getQuery()
245
            && !isCheckingAllParam
246 1 1. checkMethodNotEmpty : negated conditional → KILLED
            && this.getListQueryString().isEmpty()
247 1 1. checkMethodNotEmpty : negated conditional → KILLED
            && !this.injectionModel.getMediatorUtils().getConnectionUtil().getUrlBase().contains(InjectionModel.STAR)
248
        ) {
249
            throw new InjectionFailureException("No query string");
250
        } else if (
251 1 1. checkMethodNotEmpty : negated conditional → KILLED
            methodInjection == this.injectionModel.getMediatorMethod().getRequest()
252 1 1. checkMethodNotEmpty : negated conditional → KILLED
            && this.getListRequest().isEmpty()
253
        ) {
254
            throw new InjectionFailureException("Incorrect Request format");
255
        } else if (
256 1 1. checkMethodNotEmpty : negated conditional → KILLED
            methodInjection == this.injectionModel.getMediatorMethod().getHeader()
257 1 1. checkMethodNotEmpty : negated conditional → KILLED
            && this.getListHeader().isEmpty()
258
        ) {
259
            throw new InjectionFailureException("Incorrect Header format");
260
        }
261
    }
262
    
263
    public String initStar(SimpleEntry<String, String> parameterToInject) {
264
        String characterInsertionByUser;
265 1 1. initStar : negated conditional → NO_COVERAGE
        if (parameterToInject == null) {
266
            characterInsertionByUser = InjectionModel.STAR;
267
        } else {
268
            characterInsertionByUser = parameterToInject.getValue();
269
            parameterToInject.setValue(InjectionModel.STAR);
270
        }
271 1 1. initStar : replaced return value with "" for com/jsql/util/ParameterUtil::initStar → NO_COVERAGE
        return characterInsertionByUser;
272
    }
273
274
    public void initQueryString(String urlQuery) throws MalformedURLException, URISyntaxException {
275
        // Format and get rid of anchor fragment using native URL
276
        var url = new URI(urlQuery).toURL();
277
        
278
        if (
279 1 1. initQueryString : negated conditional → KILLED
            StringUtils.isEmpty(urlQuery)
280 1 1. initQueryString : negated conditional → KILLED
            || StringUtils.isEmpty(url.getHost())
281
        ) {
282
            throw new MalformedURLException("empty URL");
283
        }
284
        
285 1 1. initQueryString : removed call to com/jsql/util/ConnectionUtil::setUrlByUser → SURVIVED
        this.injectionModel.getMediatorUtils().getConnectionUtil().setUrlByUser(urlQuery);
286 1 1. initQueryString : removed call to com/jsql/util/ConnectionUtil::setUrlBase → KILLED
        this.injectionModel.getMediatorUtils().getConnectionUtil().setUrlBase(urlQuery);
287 1 1. initQueryString : removed call to java/util/List::clear → SURVIVED
        this.listQueryString.clear();
288
        
289
        // Parse url and GET query string
290
        var regexQueryString = Pattern.compile("(.*\\?)(.*)").matcher(urlQuery);
291 1 1. initQueryString : negated conditional → KILLED
        if (!regexQueryString.find()) {
292
            return;
293
        }
294
        
295 1 1. initQueryString : removed call to com/jsql/util/ConnectionUtil::setUrlBase → SURVIVED
        this.injectionModel.getMediatorUtils().getConnectionUtil().setUrlBase(regexQueryString.group(1));
296
        
297 1 1. initQueryString : negated conditional → SURVIVED
        if (StringUtils.isNotEmpty(url.getQuery())) {
298
            this.listQueryString = Pattern.compile("&")
299
                .splitAsStream(url.getQuery())
300 1 1. lambda$initQueryString$2 : replaced return value with null for com/jsql/util/ParameterUtil::lambda$initQueryString$2 → KILLED
                .map(keyValue -> Arrays.copyOf(keyValue.split("="), 2))
301 1 1. lambda$initQueryString$3 : replaced return value with null for com/jsql/util/ParameterUtil::lambda$initQueryString$3 → SURVIVED
                .map(keyValue -> new SimpleEntry<>(
302
                    keyValue[0],
303 1 1. lambda$initQueryString$3 : negated conditional → SURVIVED
                    keyValue[1] == null ? StringUtils.EMPTY : keyValue[1]
304
                ))
305
                .collect(Collectors.toList());
306
        }
307
    }
308
309
    public void initRequest(String rawRequest) {
310
        this.rawRequest = rawRequest;
311 1 1. initRequest : removed call to java/util/List::clear → SURVIVED
        this.listRequest.clear();
312 1 1. initRequest : negated conditional → SURVIVED
        if (StringUtils.isNotEmpty(rawRequest)) {
313 1 1. initRequest : negated conditional → SURVIVED
            if (this.isMultipartRequest) {
314
                // Pass request containing star * param without any parsing
315
                this.listRequest = new ArrayList<>(List.of(new SimpleEntry<>(
316
                    rawRequest,
317
                    StringUtils.EMPTY
318
                )));
319
            } else {
320
                this.listRequest = Pattern.compile("&")
321
                    .splitAsStream(rawRequest)
322 1 1. lambda$initRequest$4 : replaced return value with null for com/jsql/util/ParameterUtil::lambda$initRequest$4 → KILLED
                    .map(keyValue -> Arrays.copyOf(keyValue.split("="), 2))
323 1 1. lambda$initRequest$5 : replaced return value with null for com/jsql/util/ParameterUtil::lambda$initRequest$5 → SURVIVED
                    .map(keyValue -> new SimpleEntry<>(
324
                        keyValue[0],
325 1 1. lambda$initRequest$5 : negated conditional → SURVIVED
                        keyValue[1] == null ? StringUtils.EMPTY : keyValue[1]
326
                    ))
327
                    .collect(Collectors.toList());
328
            }
329
        }
330
    }
331
332
    public void initHeader(String rawHeader) {
333
        this.rawHeader = rawHeader;
334 1 1. initHeader : removed call to java/util/List::clear → SURVIVED
        this.listHeader.clear();
335 1 1. initHeader : negated conditional → SURVIVED
        if (StringUtils.isNotEmpty(rawHeader)) {
336
            this.listHeader = Pattern.compile("\\\\r\\\\n")
337
                .splitAsStream(rawHeader)
338 1 1. lambda$initHeader$6 : replaced return value with null for com/jsql/util/ParameterUtil::lambda$initHeader$6 → KILLED
                .map(keyValue -> Arrays.copyOf(keyValue.split(":"), 2))
339 1 1. lambda$initHeader$7 : replaced return value with null for com/jsql/util/ParameterUtil::lambda$initHeader$7 → SURVIVED
                .map(keyValue -> new SimpleEntry<>(
340
                    keyValue[0],
341 1 1. lambda$initHeader$7 : negated conditional → SURVIVED
                    keyValue[1] == null ? StringUtils.EMPTY : keyValue[1]
342
                ))
343
                .collect(Collectors.toList());
344
        }
345
    }
346
    
347
    public String getQueryStringFromEntries() {
348 1 1. getQueryStringFromEntries : replaced return value with "" for com/jsql/util/ParameterUtil::getQueryStringFromEntries → SURVIVED
        return this.listQueryString.stream()
349
            .filter(Objects::nonNull)
350
            .map(entry -> {
351
                if (
352 1 1. lambda$getQueryStringFromEntries$8 : negated conditional → SURVIVED
                    this.injectionModel.getMediatorStrategy().getStrategy() == this.injectionModel.getMediatorStrategy().getMultibit()
353 1 1. lambda$getQueryStringFromEntries$8 : negated conditional → NO_COVERAGE
                    && entry.getValue() != null
354 1 1. lambda$getQueryStringFromEntries$8 : negated conditional → NO_COVERAGE
                    && entry.getValue().contains(InjectionModel.STAR)
355
                ) {
356 1 1. lambda$getQueryStringFromEntries$8 : replaced return value with "" for com/jsql/util/ParameterUtil::lambda$getQueryStringFromEntries$8 → NO_COVERAGE
                    return String.format(ParameterUtil.FORMAT_KEY_VALUE, entry.getKey(), InjectionModel.STAR);
357
                } else {
358 1 1. lambda$getQueryStringFromEntries$8 : replaced return value with "" for com/jsql/util/ParameterUtil::lambda$getQueryStringFromEntries$8 → SURVIVED
                    return String.format(ParameterUtil.FORMAT_KEY_VALUE, entry.getKey(), entry.getValue());
359
                }
360
            })
361
            .collect(Collectors.joining("&"));
362
    }
363
364
    public String getRequestFromEntries() {
365 1 1. getRequestFromEntries : replaced return value with "" for com/jsql/util/ParameterUtil::getRequestFromEntries → SURVIVED
        return this.listRequest.stream()
366
            .filter(Objects::nonNull)
367 1 1. lambda$getRequestFromEntries$9 : replaced return value with "" for com/jsql/util/ParameterUtil::lambda$getRequestFromEntries$9 → SURVIVED
            .map(entry -> String.format(
368
                ParameterUtil.FORMAT_KEY_VALUE,
369
                entry.getKey(),
370 1 1. lambda$getRequestFromEntries$9 : negated conditional → SURVIVED
                StringUtils.isEmpty(entry.getValue()) ? StringUtils.EMPTY : entry.getValue()
371
            ))
372
            .collect(Collectors.joining("&"));
373
    }
374
    
375
    public String getHeaderFromEntries() {
376 1 1. getHeaderFromEntries : replaced return value with "" for com/jsql/util/ParameterUtil::getHeaderFromEntries → SURVIVED
        return this.listHeader.stream()
377
            .filter(Objects::nonNull)
378 1 1. lambda$getHeaderFromEntries$10 : replaced return value with "" for com/jsql/util/ParameterUtil::lambda$getHeaderFromEntries$10 → SURVIVED
            .map(entry -> String.format("%s:%s", entry.getKey(), entry.getValue()))
379
            .collect(Collectors.joining("\\r\\n"));
380
    }
381
382
    public boolean isRequestSoap() {
383 2 1. isRequestSoap : replaced boolean return with false for com/jsql/util/ParameterUtil::isRequestSoap → NO_COVERAGE
2. isRequestSoap : replaced boolean return with true for com/jsql/util/ParameterUtil::isRequestSoap → NO_COVERAGE
        return this.rawRequest
384
            .trim()
385
            .matches("^(<soapenv:|<\\?xml).*");
386
    }
387
388
    
389
    // Getters / setters
390
    
391
    public String getRawRequest() {
392 1 1. getRawRequest : replaced return value with "" for com/jsql/util/ParameterUtil::getRawRequest → NO_COVERAGE
        return this.rawRequest;
393
    }
394
395
    public String getRawHeader() {
396 1 1. getRawHeader : replaced return value with "" for com/jsql/util/ParameterUtil::getRawHeader → NO_COVERAGE
        return this.rawHeader;
397
    }
398
399
    public List<SimpleEntry<String, String>> getListRequest() {
400 1 1. getListRequest : replaced return value with Collections.emptyList for com/jsql/util/ParameterUtil::getListRequest → SURVIVED
        return this.listRequest;
401
    }
402
403
    public List<SimpleEntry<String, String>> getListHeader() {
404 1 1. getListHeader : replaced return value with Collections.emptyList for com/jsql/util/ParameterUtil::getListHeader → SURVIVED
        return this.listHeader;
405
    }
406
407
    public List<SimpleEntry<String, String>> getListQueryString() {
408 1 1. getListQueryString : replaced return value with Collections.emptyList for com/jsql/util/ParameterUtil::getListQueryString → SURVIVED
        return this.listQueryString;
409
    }
410
    
411
    public boolean isMultipartRequest() {
412 2 1. isMultipartRequest : replaced boolean return with false for com/jsql/util/ParameterUtil::isMultipartRequest → NO_COVERAGE
2. isMultipartRequest : replaced boolean return with true for com/jsql/util/ParameterUtil::isMultipartRequest → NO_COVERAGE
        return this.isMultipartRequest;
413
    }
414
}

Mutations

75

1.1
Location : controlInput
Killed by : none
negated conditional → NO_COVERAGE

77

1.1
Location : controlInput
Killed by : none
negated conditional → NO_COVERAGE

78

1.1
Location : controlInput
Killed by : none
negated conditional → NO_COVERAGE

87

1.1
Location : controlInput
Killed by : none
negated conditional → NO_COVERAGE

91

1.1
Location : controlInput
Killed by : none
negated conditional → NO_COVERAGE

96

1.1
Location : controlInput
Killed by : none
removed call to com/jsql/util/ParameterUtil::initQueryString → NO_COVERAGE

97

1.1
Location : controlInput
Killed by : none
removed call to com/jsql/util/ParameterUtil::initHeader → NO_COVERAGE

98

1.1
Location : controlInput
Killed by : none
removed call to com/jsql/util/ParameterUtil::initRequest → NO_COVERAGE

100

1.1
Location : controlInput
Killed by : none
removed call to com/jsql/util/ConnectionUtil::setMethodInjection → NO_COVERAGE

101

1.1
Location : controlInput
Killed by : none
removed call to com/jsql/util/ConnectionUtil::setTypeRequest → NO_COVERAGE

103

1.1
Location : controlInput
Killed by : none
negated conditional → NO_COVERAGE

104

1.1
Location : controlInput
Killed by : none
removed call to com/jsql/model/InjectionModel::beginInjection → NO_COVERAGE

106

1.1
Location : controlInput
Killed by : none
removed call to java/lang/Thread::start → NO_COVERAGE

113

1.1
Location : controlInput
Killed by : none
removed call to com/jsql/model/bean/util/Request::setMessage → NO_COVERAGE

114

1.1
Location : controlInput
Killed by : none
removed call to com/jsql/model/InjectionModel::sendToViews → NO_COVERAGE

123

1.1
Location : checkParametersFormat
Killed by : none
removed call to com/jsql/util/ParameterUtil::checkOneOrLessStar → SURVIVED
Covering tests

124

1.1
Location : checkParametersFormat
Killed by : none
removed call to com/jsql/util/ParameterUtil::checkStarMatchMethod → SURVIVED
Covering tests

125

1.1
Location : checkParametersFormat
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
removed call to com/jsql/util/ParameterUtil::checkMethodNotEmpty → KILLED

126

1.1
Location : checkParametersFormat
Killed by : none
removed call to com/jsql/util/ParameterUtil::checkMultipart → NO_COVERAGE

127

1.1
Location : checkParametersFormat
Killed by : none
negated conditional → NO_COVERAGE

153

1.1
Location : isInvalidName
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : isInvalidName
Killed by : none
changed conditional boundary → NO_COVERAGE

155

1.1
Location : isInvalidName
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : isInvalidName
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : isInvalidName
Killed by : none
changed conditional boundary → NO_COVERAGE

156

1.1
Location : isInvalidName
Killed by : none
replaced boolean return with false for com/jsql/util/ParameterUtil::isInvalidName → NO_COVERAGE

159

1.1
Location : isInvalidName
Killed by : none
replaced boolean return with true for com/jsql/util/ParameterUtil::isInvalidName → NO_COVERAGE

2.2
Location : isInvalidName
Killed by : none
replaced boolean return with false for com/jsql/util/ParameterUtil::isInvalidName → NO_COVERAGE

168

1.1
Location : lambda$checkMultipart$0
Killed by : none
replaced boolean return with true for com/jsql/util/ParameterUtil::lambda$checkMultipart$0 → NO_COVERAGE

2.2
Location : lambda$checkMultipart$0
Killed by : none
replaced boolean return with false for com/jsql/util/ParameterUtil::lambda$checkMultipart$0 → NO_COVERAGE

169

1.1
Location : checkMultipart
Killed by : none
negated conditional → NO_COVERAGE

170

1.1
Location : lambda$checkMultipart$1
Killed by : none
replaced boolean return with true for com/jsql/util/ParameterUtil::lambda$checkMultipart$1 → NO_COVERAGE

2.2
Location : lambda$checkMultipart$1
Killed by : none
negated conditional → NO_COVERAGE

171

1.1
Location : lambda$checkMultipart$1
Killed by : none
negated conditional → NO_COVERAGE

172

1.1
Location : lambda$checkMultipart$1
Killed by : none
negated conditional → NO_COVERAGE

177

1.1
Location : checkMultipart
Killed by : none
negated conditional → NO_COVERAGE

179

1.1
Location : checkMultipart
Killed by : none
negated conditional → NO_COVERAGE

193

1.1
Location : checkOneOrLessStar
Killed by : none
negated conditional → SURVIVED
Covering tests

194

1.1
Location : checkOneOrLessStar
Killed by : none
Changed increment from 1 to -1 → SURVIVED
Covering tests

196

1.1
Location : checkOneOrLessStar
Killed by : none
negated conditional → SURVIVED
Covering tests

197

1.1
Location : checkOneOrLessStar
Killed by : none
Changed increment from 1 to -1 → SURVIVED
Covering tests

199

1.1
Location : checkOneOrLessStar
Killed by : none
negated conditional → SURVIVED
Covering tests

200

1.1
Location : checkOneOrLessStar
Killed by : none
Changed increment from 1 to -1 → SURVIVED
Covering tests

204

1.1
Location : checkOneOrLessStar
Killed by : none
negated conditional → SURVIVED
Covering tests

2.2
Location : checkOneOrLessStar
Killed by : none
changed conditional boundary → SURVIVED Covering tests

206

1.1
Location : checkOneOrLessStar
Killed by : none
negated conditional → SURVIVED
Covering tests

2.2
Location : checkOneOrLessStar
Killed by : none
changed conditional boundary → SURVIVED Covering tests

207

1.1
Location : checkOneOrLessStar
Killed by : none
negated conditional → SURVIVED
Covering tests

2.2
Location : checkOneOrLessStar
Killed by : none
changed conditional boundary → SURVIVED Covering tests

208

1.1
Location : checkOneOrLessStar
Killed by : none
negated conditional → SURVIVED
Covering tests

2.2
Location : checkOneOrLessStar
Killed by : none
changed conditional boundary → SURVIVED Covering tests

219

1.1
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED
Covering tests

220

1.1
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED
Covering tests

2.2
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED Covering tests

225

1.1
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED
Covering tests

226

1.1
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED
Covering tests

2.2
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED Covering tests

231

1.1
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED
Covering tests

232

1.1
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED
Covering tests

2.2
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED Covering tests

244

1.1
Location : checkMethodNotEmpty
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

2.2
Location : checkMethodNotEmpty
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

246

1.1
Location : checkMethodNotEmpty
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

247

1.1
Location : checkMethodNotEmpty
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

251

1.1
Location : checkMethodNotEmpty
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

252

1.1
Location : checkMethodNotEmpty
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

256

1.1
Location : checkMethodNotEmpty
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

257

1.1
Location : checkMethodNotEmpty
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

265

1.1
Location : initStar
Killed by : none
negated conditional → NO_COVERAGE

271

1.1
Location : initStar
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::initStar → NO_COVERAGE

279

1.1
Location : initQueryString
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_2]
negated conditional → KILLED

280

1.1
Location : initQueryString
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_2]
negated conditional → KILLED

285

1.1
Location : initQueryString
Killed by : none
removed call to com/jsql/util/ConnectionUtil::setUrlByUser → SURVIVED
Covering tests

286

1.1
Location : initQueryString
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
removed call to com/jsql/util/ConnectionUtil::setUrlBase → KILLED

287

1.1
Location : initQueryString
Killed by : none
removed call to java/util/List::clear → SURVIVED
Covering tests

291

1.1
Location : initQueryString
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

295

1.1
Location : initQueryString
Killed by : none
removed call to com/jsql/util/ConnectionUtil::setUrlBase → SURVIVED
Covering tests

297

1.1
Location : initQueryString
Killed by : none
negated conditional → SURVIVED
Covering tests

300

1.1
Location : lambda$initQueryString$2
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_2]
replaced return value with null for com/jsql/util/ParameterUtil::lambda$initQueryString$2 → KILLED

301

1.1
Location : lambda$initQueryString$3
Killed by : none
replaced return value with null for com/jsql/util/ParameterUtil::lambda$initQueryString$3 → SURVIVED
Covering tests

303

1.1
Location : lambda$initQueryString$3
Killed by : none
negated conditional → SURVIVED
Covering tests

311

1.1
Location : initRequest
Killed by : none
removed call to java/util/List::clear → SURVIVED
Covering tests

312

1.1
Location : initRequest
Killed by : none
negated conditional → SURVIVED
Covering tests

313

1.1
Location : initRequest
Killed by : none
negated conditional → SURVIVED
Covering tests

322

1.1
Location : lambda$initRequest$4
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_2]
replaced return value with null for com/jsql/util/ParameterUtil::lambda$initRequest$4 → KILLED

323

1.1
Location : lambda$initRequest$5
Killed by : none
replaced return value with null for com/jsql/util/ParameterUtil::lambda$initRequest$5 → SURVIVED
Covering tests

325

1.1
Location : lambda$initRequest$5
Killed by : none
negated conditional → SURVIVED
Covering tests

334

1.1
Location : initHeader
Killed by : none
removed call to java/util/List::clear → SURVIVED
Covering tests

335

1.1
Location : initHeader
Killed by : none
negated conditional → SURVIVED
Covering tests

338

1.1
Location : lambda$initHeader$6
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_2]
replaced return value with null for com/jsql/util/ParameterUtil::lambda$initHeader$6 → KILLED

339

1.1
Location : lambda$initHeader$7
Killed by : none
replaced return value with null for com/jsql/util/ParameterUtil::lambda$initHeader$7 → SURVIVED
Covering tests

341

1.1
Location : lambda$initHeader$7
Killed by : none
negated conditional → SURVIVED
Covering tests

348

1.1
Location : getQueryStringFromEntries
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::getQueryStringFromEntries → SURVIVED
Covering tests

352

1.1
Location : lambda$getQueryStringFromEntries$8
Killed by : none
negated conditional → SURVIVED
Covering tests

353

1.1
Location : lambda$getQueryStringFromEntries$8
Killed by : none
negated conditional → NO_COVERAGE

354

1.1
Location : lambda$getQueryStringFromEntries$8
Killed by : none
negated conditional → NO_COVERAGE

356

1.1
Location : lambda$getQueryStringFromEntries$8
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::lambda$getQueryStringFromEntries$8 → NO_COVERAGE

358

1.1
Location : lambda$getQueryStringFromEntries$8
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::lambda$getQueryStringFromEntries$8 → SURVIVED
Covering tests

365

1.1
Location : getRequestFromEntries
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::getRequestFromEntries → SURVIVED
Covering tests

367

1.1
Location : lambda$getRequestFromEntries$9
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::lambda$getRequestFromEntries$9 → SURVIVED
Covering tests

370

1.1
Location : lambda$getRequestFromEntries$9
Killed by : none
negated conditional → SURVIVED
Covering tests

376

1.1
Location : getHeaderFromEntries
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::getHeaderFromEntries → SURVIVED
Covering tests

378

1.1
Location : lambda$getHeaderFromEntries$10
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::lambda$getHeaderFromEntries$10 → SURVIVED
Covering tests

383

1.1
Location : isRequestSoap
Killed by : none
replaced boolean return with false for com/jsql/util/ParameterUtil::isRequestSoap → NO_COVERAGE

2.2
Location : isRequestSoap
Killed by : none
replaced boolean return with true for com/jsql/util/ParameterUtil::isRequestSoap → NO_COVERAGE

392

1.1
Location : getRawRequest
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::getRawRequest → NO_COVERAGE

396

1.1
Location : getRawHeader
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::getRawHeader → NO_COVERAGE

400

1.1
Location : getListRequest
Killed by : none
replaced return value with Collections.emptyList for com/jsql/util/ParameterUtil::getListRequest → SURVIVED
Covering tests

404

1.1
Location : getListHeader
Killed by : none
replaced return value with Collections.emptyList for com/jsql/util/ParameterUtil::getListHeader → SURVIVED
Covering tests

408

1.1
Location : getListQueryString
Killed by : none
replaced return value with Collections.emptyList for com/jsql/util/ParameterUtil::getListQueryString → SURVIVED
Covering tests

412

1.1
Location : isMultipartRequest
Killed by : none
replaced boolean return with false for com/jsql/util/ParameterUtil::isMultipartRequest → NO_COVERAGE

2.2
Location : isMultipartRequest
Killed by : none
replaced boolean return with true for com/jsql/util/ParameterUtil::isMultipartRequest → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.19.1