You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "Technoboy- (via GitHub)" <gi...@apache.org> on 2026/02/06 06:59:51 UTC
[PR] [improve][broker] Give the detail msg when authencate error [pulsar]
Technoboy- opened a new pull request, #25221:
URL: https://github.com/apache/pulsar/pull/25221
### Motivation
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Give the detail msg when authencate error [pulsar]
Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- commented on code in PR #25221:
URL: https://github.com/apache/pulsar/pull/25221#discussion_r2781183480
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/web/AuthenticationFilter.java:
##########
@@ -60,9 +60,13 @@
try {
doFilter = authenticationService.authenticateHttpRequest(httpRequest, httpResponse);
} catch (Exception e) {
- httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Authentication required");
+ String msg = e.getMessage();
+ if (msg == null) {
+ msg = "Authentication required";
+ }
+ httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, msg);
Review Comment:
Only exceptions of type javax.naming.AuthenticationException are passed to the client. These exceptions typically contain a clear reason for authentication failure (such as "Token expired"), and are secure and useful to the user.
For all other types of Exceptions (such as NullPointerException, IOException, etc.), the system will uniformly return a generic "Authentication required" error message, without including the specific exception stack trace or message.
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Give the detail msg when authencate error [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on PR #25221:
URL: https://github.com/apache/pulsar/pull/25221#issuecomment-3858835927
/pulsarbot rerun-failure-checks
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Give the detail msg when authencate error [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on code in PR #25221:
URL: https://github.com/apache/pulsar/pull/25221#discussion_r2773479544
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/web/AuthenticationFilter.java:
##########
@@ -60,9 +60,13 @@ public void doFilter(
try {
doFilter = authenticationService.authenticateHttpRequest(httpRequest, httpResponse);
} catch (Exception e) {
- httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Authentication required");
+ String msg = e.getMessage();
+ if (msg == null) {
+ msg = "Authentication required";
+ }
+ httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, msg);
Review Comment:
CodeQL flags a security issue here.
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Give the detail msg when authencate error [pulsar]
Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- commented on code in PR #25221:
URL: https://github.com/apache/pulsar/pull/25221#discussion_r2781168780
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/web/AuthenticationFilter.java:
##########
@@ -60,9 +60,13 @@ public void doFilter(
try {
doFilter = authenticationService.authenticateHttpRequest(httpRequest, httpResponse);
} catch (Exception e) {
- httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Authentication required");
+ String msg = e.getMessage();
+ if (msg == null) {
+ msg = "Authentication required";
+ }
+ httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, msg);
Review Comment:
addressed
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Give the detail error msg when authenticate failed with AuthenticationException [pulsar]
Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #25221:
URL: https://github.com/apache/pulsar/pull/25221#discussion_r2781740186
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/web/AuthenticationFilter.java:
##########
@@ -60,10 +60,15 @@
try {
doFilter = authenticationService.authenticateHttpRequest(httpRequest, httpResponse);
} catch (Exception e) {
- httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Authentication required");
if (e instanceof AuthenticationException) {
- LOG.warn("[{}] Failed to authenticate HTTP request: {}", request.getRemoteAddr(), e.getMessage());
+ String msg = e.getMessage();
+ if (msg == null) {
+ msg = "Authentication required";
+ }
+ httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, msg);
Review Comment:
## Information exposure through an error message
[Error information](1) can be exposed to an external user.
[Show more details](https://github.com/apache/pulsar/security/code-scanning/185)
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Give the detail msg when authencate error [pulsar]
Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #25221:
URL: https://github.com/apache/pulsar/pull/25221#discussion_r2773155560
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/web/AuthenticationFilter.java:
##########
@@ -60,9 +60,13 @@
try {
doFilter = authenticationService.authenticateHttpRequest(httpRequest, httpResponse);
} catch (Exception e) {
- httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Authentication required");
+ String msg = e.getMessage();
+ if (msg == null) {
+ msg = "Authentication required";
+ }
+ httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, msg);
Review Comment:
## Information exposure through an error message
[Error information](1) can be exposed to an external user.
[Show more details](https://github.com/apache/pulsar/security/code-scanning/184)
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Give the detail msg when authencate error [pulsar]
Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- commented on code in PR #25221:
URL: https://github.com/apache/pulsar/pull/25221#discussion_r2781182320
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/web/AuthenticationFilter.java:
##########
@@ -60,9 +60,13 @@ public void doFilter(
try {
doFilter = authenticationService.authenticateHttpRequest(httpRequest, httpResponse);
} catch (Exception e) {
- httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Authentication required");
+ String msg = e.getMessage();
+ if (msg == null) {
+ msg = "Authentication required";
+ }
+ httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, msg);
Review Comment:
- Only exceptions of type javax.naming.AuthenticationException are passed to the client. These exceptions typically contain a clear reason for authentication failure (such as "Token expired"), and are secure and useful to the user.
- For all other types of Exceptions (such as NullPointerException, IOException, etc.), the system will uniformly return a generic "Authentication required" error message, without including the specific exception stack trace or message.
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Give the detail error msg when authenticate failed with AuthenticationException [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on code in PR #25221:
URL: https://github.com/apache/pulsar/pull/25221#discussion_r2781793039
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/web/AuthenticationFilter.java:
##########
@@ -60,10 +60,15 @@
try {
doFilter = authenticationService.authenticateHttpRequest(httpRequest, httpResponse);
} catch (Exception e) {
- httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Authentication required");
if (e instanceof AuthenticationException) {
- LOG.warn("[{}] Failed to authenticate HTTP request: {}", request.getRemoteAddr(), e.getMessage());
+ String msg = e.getMessage();
+ if (msg == null) {
+ msg = "Authentication required";
+ }
+ httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, msg);
Review Comment:
response: https://github.com/apache/pulsar/pull/25221#discussion_r2781182320
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Give the detail error msg when authenticate failed with AuthenticationException [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari merged PR #25221:
URL: https://github.com/apache/pulsar/pull/25221
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org