-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmissing-httponly-java-test.yml
90 lines (75 loc) · 2.5 KB
/
missing-httponly-java-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
id: missing-httponly-java
valid:
- |
package com.example;
import io.micronaut.http.*;
import io.micronaut.http.cookie.Cookie;
import io.micronaut.http.netty.cookies.NettyCookie;
import io.micronaut.http.simple.cookies.SimpleCookie;
import java.io.*;
@Controller("/hello")
public class HelloController {
@Post("/test1")
public MutableHttpMessage<Object> postTest1() throws FileNotFoundException {
SimpleCookie s = new SimpleCookie("foo", "bar").httpOnly();
}
}
invalid:
- |
package com.example;
import io.micronaut.http.*;
import io.micronaut.http.cookie.Cookie;
import io.micronaut.http.netty.cookies.NettyCookie;
import io.micronaut.http.simple.cookies.SimpleCookie;
import java.io.*;
@Controller("/hello")
public class HelloController {
@Post("/test1")
public MutableHttpMessage<Object> postTest1() throws FileNotFoundException {
SimpleCookie s = new SimpleCookie("foo", "bar");
}
}
- |
package com.example;
import io.micronaut.http.*;
import io.micronaut.http.cookie.Cookie;
import io.micronaut.http.netty.cookies.NettyCookie;
import io.micronaut.http.simple.cookies.SimpleCookie;
import java.io.*;
@Controller("/hello")
public class HelloController {
@Post("/test1")
public MutableHttpMessage<Object> postTest1() throws FileNotFoundException {
Cookie cookie = request.getCookies()
.findCookie( "foobar" )
.orElse( new NettyCookie( "foo", "bar" ) );
}
}
- |
package com.example;
import io.micronaut.http.*;
import io.micronaut.http.cookie.Cookie;
import io.micronaut.http.netty.cookies.NettyCookie;
import io.micronaut.http.simple.cookies.SimpleCookie;
import java.io.*;
@Controller("/hello")
public class HelloController {
@Post("/test1")
public MutableHttpMessage<Object> postTest1() throws FileNotFoundException {
Cookie z = new NettyCookie("foo", "bar");
}
}
- |
package com.example;
import io.micronaut.http.*;
import io.micronaut.http.cookie.Cookie;
import io.micronaut.http.netty.cookies.NettyCookie;
import io.micronaut.http.simple.cookies.SimpleCookie;
import java.io.*;
@Controller("/hello")
public class HelloController {
@Post("/test1")
public MutableHttpMessage<Object> postTest1() throws FileNotFoundException {
return HttpResponse.ok().cookie(Cookie.of("zzz", "ddd"));
}
}