mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
java: Inline expectation should have space before $
This commit is contained in:
@@ -14,63 +14,63 @@ class B {
|
||||
|
||||
class Test1 implements HttpRequestHandler {
|
||||
public void handle(ClassicHttpRequest req, ClassicHttpResponse res, HttpContext ctx) throws IOException, ParseException {
|
||||
B.sink(req.getAuthority().getHostName()); //$hasTaintFlow
|
||||
B.sink(req.getAuthority().toString()); //$hasTaintFlow
|
||||
B.sink(req.getMethod()); //$hasTaintFlow
|
||||
B.sink(req.getPath()); //$hasTaintFlow
|
||||
B.sink(req.getScheme());
|
||||
B.sink(req.getRequestUri()); //$hasTaintFlow
|
||||
B.sink(req.getAuthority().getHostName()); // $ hasTaintFlow
|
||||
B.sink(req.getAuthority().toString()); // $ hasTaintFlow
|
||||
B.sink(req.getMethod()); // $ hasTaintFlow
|
||||
B.sink(req.getPath()); // $ hasTaintFlow
|
||||
B.sink(req.getScheme());
|
||||
B.sink(req.getRequestUri()); // $ hasTaintFlow
|
||||
RequestLine line = new RequestLine(req);
|
||||
B.sink(line.getUri()); //$hasTaintFlow
|
||||
B.sink(line.getMethod()); //$hasTaintFlow
|
||||
B.sink(req.getHeaders()); //$hasTaintFlow
|
||||
B.sink(req.headerIterator()); //$hasTaintFlow
|
||||
B.sink(line.getUri()); // $ hasTaintFlow
|
||||
B.sink(line.getMethod()); // $ hasTaintFlow
|
||||
B.sink(req.getHeaders()); // $ hasTaintFlow
|
||||
B.sink(req.headerIterator()); // $ hasTaintFlow
|
||||
Header h = req.getHeaders("abc")[3];
|
||||
B.sink(h.getName()); //$hasTaintFlow
|
||||
B.sink(h.getValue()); //$hasTaintFlow
|
||||
B.sink(req.getFirstHeader("abc")); //$hasTaintFlow
|
||||
B.sink(req.getLastHeader("abc")); //$hasTaintFlow
|
||||
B.sink(h.getName()); // $ hasTaintFlow
|
||||
B.sink(h.getValue()); // $ hasTaintFlow
|
||||
B.sink(req.getFirstHeader("abc")); // $ hasTaintFlow
|
||||
B.sink(req.getLastHeader("abc")); // $ hasTaintFlow
|
||||
HttpEntity ent = req.getEntity();
|
||||
B.sink(ent.getContent()); //$hasTaintFlow
|
||||
B.sink(ent.getContentEncoding()); //$hasTaintFlow
|
||||
B.sink(ent.getContentType()); //$hasTaintFlow
|
||||
B.sink(ent.getTrailerNames()); //$hasTaintFlow
|
||||
B.sink(ent.getTrailers().get()); //$hasTaintFlow
|
||||
B.sink(EntityUtils.toString(ent)); //$hasTaintFlow
|
||||
B.sink(EntityUtils.toByteArray(ent)); //$hasTaintFlow
|
||||
B.sink(EntityUtils.parse(ent)); //$hasTaintFlow
|
||||
res.setEntity(new StringEntity("<a href='" + req.getRequestUri() + "'>a</a>")); //$hasTaintFlow
|
||||
res.setEntity(new ByteArrayEntity(EntityUtils.toByteArray(ent), ContentType.TEXT_HTML)); //$hasTaintFlow
|
||||
res.setEntity(HttpEntities.create("<a href='" + req.getRequestUri() + "'>a</a>")); //$hasTaintFlow
|
||||
res.setHeader("Location", req.getRequestUri()); //$hasTaintFlow
|
||||
res.setHeader(new BasicHeader("Location", req.getRequestUri())); //$hasTaintFlow
|
||||
B.sink(ent.getContent()); // $ hasTaintFlow
|
||||
B.sink(ent.getContentEncoding()); // $ hasTaintFlow
|
||||
B.sink(ent.getContentType()); // $ hasTaintFlow
|
||||
B.sink(ent.getTrailerNames()); // $ hasTaintFlow
|
||||
B.sink(ent.getTrailers().get()); // $ hasTaintFlow
|
||||
B.sink(EntityUtils.toString(ent)); // $ hasTaintFlow
|
||||
B.sink(EntityUtils.toByteArray(ent)); // $ hasTaintFlow
|
||||
B.sink(EntityUtils.parse(ent)); // $ hasTaintFlow
|
||||
res.setEntity(new StringEntity("<a href='" + req.getRequestUri() + "'>a</a>")); // $ hasTaintFlow
|
||||
res.setEntity(new ByteArrayEntity(EntityUtils.toByteArray(ent), ContentType.TEXT_HTML)); // $ hasTaintFlow
|
||||
res.setEntity(HttpEntities.create("<a href='" + req.getRequestUri() + "'>a</a>")); // $ hasTaintFlow
|
||||
res.setHeader("Location", req.getRequestUri()); // $ hasTaintFlow
|
||||
res.setHeader(new BasicHeader("Location", req.getRequestUri())); // $ hasTaintFlow
|
||||
}
|
||||
}
|
||||
|
||||
void test2() {
|
||||
ByteArrayBuffer bbuf = new ByteArrayBuffer(42);
|
||||
bbuf.append((byte[]) taint(), 0, 3);
|
||||
sink(bbuf.array()); //$hasTaintFlow
|
||||
sink(bbuf.toByteArray()); //$hasTaintFlow
|
||||
sink(bbuf.toString());
|
||||
bbuf.append((byte[]) taint(), 0, 3);
|
||||
sink(bbuf.array()); // $ hasTaintFlow
|
||||
sink(bbuf.toByteArray()); // $ hasTaintFlow
|
||||
sink(bbuf.toString());
|
||||
|
||||
CharArrayBuffer cbuf = new CharArrayBuffer(42);
|
||||
cbuf.append(bbuf.toByteArray(), 0, 3);
|
||||
sink(cbuf.toCharArray()); //$hasTaintFlow
|
||||
sink(cbuf.toString()); //$hasTaintFlow
|
||||
sink(cbuf.subSequence(0, 3)); //$hasTaintFlow
|
||||
sink(cbuf.substring(0, 3)); //$hasTaintFlow
|
||||
sink(cbuf.substringTrimmed(0, 3)); //$hasTaintFlow
|
||||
cbuf.append(bbuf.toByteArray(), 0, 3);
|
||||
sink(cbuf.toCharArray()); // $ hasTaintFlow
|
||||
sink(cbuf.toString()); // $ hasTaintFlow
|
||||
sink(cbuf.subSequence(0, 3)); // $ hasTaintFlow
|
||||
sink(cbuf.substring(0, 3)); // $ hasTaintFlow
|
||||
sink(cbuf.substringTrimmed(0, 3)); // $ hasTaintFlow
|
||||
|
||||
sink(Args.notNull(taint(), "x")); //$hasTaintFlow
|
||||
sink(Args.notEmpty((String) taint(), "x")); //$hasTaintFlow
|
||||
sink(Args.notBlank((String) taint(), "x")); //$hasTaintFlow
|
||||
sink(Args.notNull("x", (String) taint()));
|
||||
sink(Args.notNull(taint(), "x")); // $ hasTaintFlow
|
||||
sink(Args.notEmpty((String) taint(), "x")); // $ hasTaintFlow
|
||||
sink(Args.notBlank((String) taint(), "x")); // $ hasTaintFlow
|
||||
sink(Args.notNull("x", (String) taint()));
|
||||
}
|
||||
|
||||
class Test3 implements HttpServerRequestHandler {
|
||||
public void handle(ClassicHttpRequest req, HttpServerRequestHandler.ResponseTrigger restr, HttpContext ctx) throws HttpException, IOException {
|
||||
B.sink(req.getEntity()); //$hasTaintFlow
|
||||
B.sink(req.getEntity()); // $ hasTaintFlow
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user