github-advanced-security[bot] commented on code in PR #22690:
URL: https://github.com/apache/pulsar/pull/22690#discussion_r1596912791
##########
pulsar-broker/src/test/java/org/apache/pulsar/utils/auth/tokens/TokensCliUtilsTest.java:
##########
@@ -31,6 +36,37 @@
*/
public class TokensCliUtilsTest {
+ @Test
+ public void testCreateToken() {
+ PrintStream oldStream = System.out;
+ try {
+ ByteArrayOutputStream baoStream = new ByteArrayOutputStream();
+ System.setOut(new PrintStream(baoStream));
+
+ new TokensCliUtils().execute(new String[]{"create-secret-key",
"--base64"});
+ String secretKey = baoStream.toString();
+
+ baoStream.reset();
+
+ new TokensCliUtils().execute(new String[]{"create",
"--secret-key", "data:;base64," + secretKey, "--subject", "test", "--headers",
"kid=test"});
+ String token = baoStream.toString();
+
+ Jwt<?, ?> jwt = Jwts.parserBuilder()
+ .setSigningKey(Decoders.BASE64.decode(secretKey))
+ .build()
Review Comment:
## Missing JWT signature check
This parser sets a [JWT signing key](1), but the signature is not verified.
[Show more
details](https://github.com/apache/pulsar/security/code-scanning/119)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]