File tree Expand file tree Collapse file tree 2 files changed +58
-5
lines changed
query-tests/security/CWE-347
stubs/jwtk-jjwt-0.11.2/io/jsonwebtoken/impl Expand file tree Collapse file tree 2 files changed +58
-5
lines changed Original file line number Diff line number Diff line change 1
- import io .jsonwebtoken .Jwts ;
2
- import io .jsonwebtoken .JwtParser ;
3
- import io .jsonwebtoken .Jwt ;
4
- import io .jsonwebtoken .Jws ;
5
1
import io .jsonwebtoken .Header ;
6
- import io .jsonwebtoken .JwtParserBuilder ;
2
+ import io .jsonwebtoken .Jws ;
3
+ import io .jsonwebtoken .Jwt ;
7
4
import io .jsonwebtoken .JwtHandlerAdapter ;
5
+ import io .jsonwebtoken .JwtParser ;
6
+ import io .jsonwebtoken .Jwts ;
8
7
import io .jsonwebtoken .impl .DefaultJwtParser ;
8
+ import io .jsonwebtoken .impl .DefaultJwtParserBuilder ;
9
9
10
10
public class MissingJWTSignatureCheckTest {
11
11
@@ -110,6 +110,10 @@ private void badJwtOnParserBuilder(String token) {
110
110
Jwts .parserBuilder ().setSigningKey ("someBase64EncodedKey" ).build ().parse (token ); // $hasMissingJwtSignatureCheck
111
111
}
112
112
113
+ private void badJwtOnDefaultParserBuilder (String token ) {
114
+ new DefaultJwtParserBuilder ().setSigningKey ("someBase64EncodedKey" ).build ().parse (token ); // $hasMissingJwtSignatureCheck
115
+ }
116
+
113
117
private void badJwtHandlerOnParser (String token ) {
114
118
Jwts .parser ().setSigningKey ("someBase64EncodedKey" ).parse (token , // $hasMissingJwtSignatureCheck
115
119
new JwtHandlerAdapter <Jwt <Header , String >>() {
Original file line number Diff line number Diff line change
1
+
2
+ /*
3
+ * Copyright (C) 2019 jsonwebtoken.io
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License. You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
11
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12
+ * or implied. See the License for the specific language governing permissions and limitations under
13
+ * the License.
14
+ */
15
+ package io .jsonwebtoken .impl ;
16
+
17
+ import java .security .Key ;
18
+ import io .jsonwebtoken .JwtParser ;
19
+ import io .jsonwebtoken .JwtParserBuilder ;
20
+ import io .jsonwebtoken .SigningKeyResolver ;
21
+
22
+
23
+ public class DefaultJwtParserBuilder implements JwtParserBuilder {
24
+
25
+ @ Override
26
+ public JwtParserBuilder setSigningKey (byte [] key ) {
27
+ return this ;
28
+ }
29
+
30
+ @ Override
31
+ public JwtParserBuilder setSigningKey (String base64EncodedSecretKey ) {
32
+ return this ;
33
+ }
34
+
35
+ @ Override
36
+ public JwtParserBuilder setSigningKey (Key key ) {
37
+ return this ;
38
+ }
39
+
40
+ @ Override
41
+ public JwtParserBuilder setSigningKeyResolver (SigningKeyResolver signingKeyResolver ) {
42
+ return this ;
43
+ }
44
+
45
+ @ Override
46
+ public JwtParser build () {
47
+ return null ;
48
+ }
49
+ }
You can’t perform that action at this time.
0 commit comments