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

Mutations

72

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

74

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

75

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

84

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

88

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

93

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

94

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

95

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

97

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

98

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

100

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

101

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

103

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

110

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

111

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

120

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

121

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

122

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

123

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

124

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

150

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

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

152

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

153

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

156

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

165

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

166

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

167

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

168

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

169

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

174

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

176

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

190

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

191

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

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

201

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

203

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

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

205

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

216

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

217

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

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

222

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

223

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

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

228

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

229

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

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

241

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

243

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

244

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

248

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

249

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

253

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

254

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

262

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

268

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

276

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

277

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

282

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

283

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

284

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

288

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

292

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

294

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

297

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

298

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

300

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

308

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

309

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

310

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

319

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

320

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

322

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

331

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

332

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

335

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

336

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

338

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

345

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

349

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

350

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

351

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

353

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

355

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

362

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

364

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

367

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

373

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

375

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

380

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

389

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

393

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

397

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

401

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

405

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

409

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