imbajin commented on code in PR #3189:
URL: https://github.com/apache/hugegraph/pull/3189#discussion_r3965623057
##########
hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/interceptor/RestAuthentication.java:
##########
@@ -59,9 +59,18 @@ public boolean preHandle(HttpServletRequest request,
HttpServletResponse respons
authority = authority.replace("Basic ", "");
Review Comment:
Fixed in 3075487 and ee98ef9. Handled the Basic scheme prefix
case-insensitively via `regionMatches(true, 0, "Basic ", 0, 6)`, stripped the
prefix, refused unsupported schemes with `BadCredentialsException`, and added
comprehensive unit test assertions in `AuthenticationTest`.
##########
hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/config/PDConfig.java:
##########
@@ -85,6 +100,25 @@ public class PDConfig {
private ConfigService configService;
private IdService idService;
+ @Override
+ public void afterPropertiesSet() {
+ if (PUBLISHED_SECRET_KEY.equals(this.secretKey)) {
+ throw new IllegalStateException(
+ "auth.secret-key is set to the value published in the
HugeGraph source " +
+ "tree, which authenticates anyone who can read it. Set a "
+
+ "deployment-specific secret in conf/application.yml, or
through the " +
+ "HG_PD_AUTH_SECRET_KEY environment variable for the Docker
image.");
+ }
+ // The shipped configs leave this empty on purpose. Say so in the boot
log:
+ // the REST interceptor also logs it, but only on the first refused
request,
+ // and /v1/health keeps answering 200 in the meantime.
+ if (this.secretKey == null || this.secretKey.isEmpty()) {
Review Comment:
Thanks for the observation. To keep this PR minimal and strictly focused on
REST authentication and 401 handling (avoiding over-engineering / scope creep
into Actuator configuration auditing), we retain the Docker-level guard and
upgrade guidance in the docs. Bare-metal configuration governance can be
evaluated in follow-up tasks if needed.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]