File tree Expand file tree Collapse file tree
query-tests/security/CWE-347
stubs/jwtk-jjwt-0.11.2/io/jsonwebtoken/impl Expand file tree Collapse file tree 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 ;
51import io .jsonwebtoken .Header ;
6- import io .jsonwebtoken .JwtParserBuilder ;
2+ import io .jsonwebtoken .Jws ;
3+ import io .jsonwebtoken .Jwt ;
74import io .jsonwebtoken .JwtHandlerAdapter ;
5+ import io .jsonwebtoken .JwtParser ;
6+ import io .jsonwebtoken .Jwts ;
87import io .jsonwebtoken .impl .DefaultJwtParser ;
8+ import io .jsonwebtoken .impl .DefaultJwtParserBuilder ;
99
1010public class MissingJWTSignatureCheckTest {
1111
@@ -110,6 +110,10 @@ private void badJwtOnParserBuilder(String token) {
110110 Jwts .parserBuilder ().setSigningKey ("someBase64EncodedKey" ).build ().parse (token ); // $hasMissingJwtSignatureCheck
111111 }
112112
113+ private void badJwtOnDefaultParserBuilder (String token ) {
114+ new DefaultJwtParserBuilder ().setSigningKey ("someBase64EncodedKey" ).build ().parse (token ); // $hasMissingJwtSignatureCheck
115+ }
116+
113117 private void badJwtHandlerOnParser (String token ) {
114118 Jwts .parser ().setSigningKey ("someBase64EncodedKey" ).parse (token , // $hasMissingJwtSignatureCheck
115119 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