You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "rmannibucau (via GitHub)" <gi...@apache.org> on 2025/12/15 21:30:55 UTC

[PR] Ensure client_id/client_secret patterns are configurable [polaris]

rmannibucau opened a new pull request, #3276:
URL: https://github.com/apache/polaris/pull/3276

   <!--
   ๐Ÿ“ Describe what changes you're proposing, especially breaking or user-facing changes. 
   ๐Ÿ“– See https://github.com/apache/polaris/blob/main/CONTRIBUTING.md for more.
   -->
   
   client_id/client_secret patterns are validated when calling reset endpoint but the pattern is hardcoded which can be too rigid.
   this PR just enables to configure it. 
   
   ## Checklist
   - [X] ๐Ÿ›ก๏ธ Don't disclose security issues! (contact security@apache.org)
   - [X] ๐Ÿ”— Clearly explained why the changes are needed, or linked related issues: Fixes #
   - [X] ๐Ÿงช Added/updated tests with good coverage, or manually tested (and explained how)
   - [X] ๐Ÿ’ก Added comments for complex logic
   - [X] ๐Ÿงพ Updated `CHANGELOG.md` (if needed)
   - [X] ๐Ÿ“š Updated documentation in `site/content/in-dev/unreleased` (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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Relax `client_id`, `client_secret` regex/pattern validation on reset endpoint call [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on PR #3276:
URL: https://github.com/apache/polaris/pull/3276#issuecomment-3769494503

   @rmannibucau : sorry that this PR got forgotten. I think it still makes sense to merge it. Could you resolve conflicts, please?


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ensure client_id/client_secret patterns are not enforced as before [polaris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #3276:
URL: https://github.com/apache/polaris/pull/3276#issuecomment-3762508519

   This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ensure client_id/client_secret patterns are configurable [polaris]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #3276:
URL: https://github.com/apache/polaris/pull/3276#discussion_r2623573980


##########
runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java:
##########
@@ -137,13 +137,15 @@ public Response createCatalog(
   }
 
   private void validateClientId(String clientId) {
-    if (!clientId.matches("^[0-9a-f]{16}$")) {
+    if (!clientId.matches(
+        realmConfig.getConfig(FeatureConfiguration.CREDENTIAL_RESET_CLIENT_ID_PATTERN))) {
       throw new IllegalArgumentException("Invalid clientId format");
     }
   }
 
   private void validateClientSecret(String clientSecret) {
-    if (!clientSecret.matches("^[0-9a-f]{32}$")) {
+    if (!clientSecret.matches(
+        realmConfig.getConfig(FeatureConfiguration.CREDENTIAL_RESET_CLIENT_SECRET_PATTERN))) {

Review Comment:
   +1 to @dimas-b suggestion.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Relax `client_id`, `client_secret` regex/pattern validation on reset endpoint call [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b merged PR #3276:
URL: https://github.com/apache/polaris/pull/3276


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ensure client_id/client_secret patterns are configurable [polaris]

Posted by "rmannibucau (via GitHub)" <gi...@apache.org>.
rmannibucau commented on code in PR #3276:
URL: https://github.com/apache/polaris/pull/3276#discussion_r2624243196


##########
runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java:
##########
@@ -137,13 +137,15 @@ public Response createCatalog(
   }
 
   private void validateClientId(String clientId) {
-    if (!clientId.matches("^[0-9a-f]{16}$")) {
+    if (!clientId.matches(
+        realmConfig.getConfig(FeatureConfiguration.CREDENTIAL_RESET_CLIENT_ID_PATTERN))) {

Review Comment:
   hmm, not sure i'm a fan of this one, feature is quite specific and we would make the realm down for it? :thinking: 
   
   let's drop the validation for now then



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Relax `client_id`, `client_secret` regex/pattern validation on reset endpoint call [polaris]

Posted by "rmannibucau (via GitHub)" <gi...@apache.org>.
rmannibucau commented on PR #3276:
URL: https://github.com/apache/polaris/pull/3276#issuecomment-3770298414

   @dimas-b sure, done


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ensure client_id/client_secret patterns are configurable [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3276:
URL: https://github.com/apache/polaris/pull/3276#discussion_r2623586282


##########
runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java:
##########
@@ -137,13 +137,15 @@ public Response createCatalog(
   }
 
   private void validateClientId(String clientId) {
-    if (!clientId.matches("^[0-9a-f]{16}$")) {
+    if (!clientId.matches(
+        realmConfig.getConfig(FeatureConfiguration.CREDENTIAL_RESET_CLIENT_ID_PATTERN))) {
       throw new IllegalArgumentException("Invalid clientId format");
     }
   }
 
   private void validateClientSecret(String clientSecret) {
-    if (!clientSecret.matches("^[0-9a-f]{32}$")) {
+    if (!clientSecret.matches(
+        realmConfig.getConfig(FeatureConfiguration.CREDENTIAL_RESET_CLIENT_SECRET_PATTERN))) {

Review Comment:
   Let's try removing the checks completely and get some more reviews. If people raise concerns we can add an on/off flag then.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ensure client_id/client_secret patterns are configurable [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3276:
URL: https://github.com/apache/polaris/pull/3276#discussion_r2621042079


##########
runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java:
##########
@@ -137,13 +137,15 @@ public Response createCatalog(
   }
 
   private void validateClientId(String clientId) {
-    if (!clientId.matches("^[0-9a-f]{16}$")) {
+    if (!clientId.matches(
+        realmConfig.getConfig(FeatureConfiguration.CREDENTIAL_RESET_CLIENT_ID_PATTERN))) {
       throw new IllegalArgumentException("Invalid clientId format");
     }
   }
 
   private void validateClientSecret(String clientSecret) {
-    if (!clientSecret.matches("^[0-9a-f]{32}$")) {
+    if (!clientSecret.matches(
+        realmConfig.getConfig(FeatureConfiguration.CREDENTIAL_RESET_CLIENT_SECRET_PATTERN))) {

Review Comment:
   If validating client ID/secret format is becoming a nuisance to users, from my POV this check can just be removed completely. I do not think Polaris code relies on these values following a particular format.
   
   If backward compatibility is a concern, I'd rather add a simple boolean flag to _disable_ these checks (defaulting to enabled). WDYT?



##########
polaris-core/src/main/java/org/apache/polaris/core/config/PolarisConfiguration.java:
##########
@@ -34,9 +32,6 @@
  * @param <T> The type of the configuration
  */
 public abstract class PolarisConfiguration<T> {
-
-  private static final Logger LOGGER = LoggerFactory.getLogger(PolarisConfiguration.class);

Review Comment:
   nit: if you find "dead code", it's generally preferable to cleanup in a dedicated PR and avoid mixing cleanup with feature changes :)



##########
runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java:
##########
@@ -137,13 +137,15 @@ public Response createCatalog(
   }
 
   private void validateClientId(String clientId) {
-    if (!clientId.matches("^[0-9a-f]{16}$")) {
+    if (!clientId.matches(
+        realmConfig.getConfig(FeatureConfiguration.CREDENTIAL_RESET_CLIENT_ID_PATTERN))) {

Review Comment:
   we should validate the value of `CREDENTIAL_RESET_CLIENT_ID_PATTERN` on startup to avoid deferred RegEx syntax errors (it's an admin mistake, not the API client's mistake)



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ensure client_id/client_secret patterns are configurable [polaris]

Posted by "rmannibucau (via GitHub)" <gi...@apache.org>.
rmannibucau commented on code in PR #3276:
URL: https://github.com/apache/polaris/pull/3276#discussion_r2622765532


##########
runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java:
##########
@@ -137,13 +137,15 @@ public Response createCatalog(
   }
 
   private void validateClientId(String clientId) {
-    if (!clientId.matches("^[0-9a-f]{16}$")) {
+    if (!clientId.matches(
+        realmConfig.getConfig(FeatureConfiguration.CREDENTIAL_RESET_CLIENT_ID_PATTERN))) {
       throw new IllegalArgumentException("Invalid clientId format");
     }
   }
 
   private void validateClientSecret(String clientSecret) {
-    if (!clientSecret.matches("^[0-9a-f]{32}$")) {
+    if (!clientSecret.matches(
+        realmConfig.getConfig(FeatureConfiguration.CREDENTIAL_RESET_CLIENT_SECRET_PATTERN))) {

Review Comment:
   I'm fine dropping the feature (the two validateClientX methods) too



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ensure client_id/client_secret patterns are configurable [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3276:
URL: https://github.com/apache/polaris/pull/3276#discussion_r2624574506


##########
runtime/service/src/test/java/org/apache/polaris/service/admin/PolarisServiceImplTest.java:
##########
@@ -237,4 +240,27 @@ private void invokeValidateExternalCatalog(PolarisServiceImpl service, Catalog c
       }
     }
   }
+
+  private PolarisServiceImpl noAdminResetCredentialPolarisService() {

Review Comment:
   Is this method still used?



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ensure client_id/client_secret patterns are configurable [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3276:
URL: https://github.com/apache/polaris/pull/3276#discussion_r2623592466


##########
runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java:
##########
@@ -137,13 +137,15 @@ public Response createCatalog(
   }
 
   private void validateClientId(String clientId) {
-    if (!clientId.matches("^[0-9a-f]{16}$")) {
+    if (!clientId.matches(
+        realmConfig.getConfig(FeatureConfiguration.CREDENTIAL_RESET_CLIENT_ID_PATTERN))) {

Review Comment:
   Cf. https://github.com/apache/polaris/blob/1aa95deb75b9f16c871fb8140576d7026471b2b1/runtime/service/src/main/java/org/apache/polaris/service/config/ProductionReadinessChecks.java#L142



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ensure client_id/client_secret patterns are configurable [polaris]

Posted by "rmannibucau (via GitHub)" <gi...@apache.org>.
rmannibucau commented on code in PR #3276:
URL: https://github.com/apache/polaris/pull/3276#discussion_r2622762224


##########
runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java:
##########
@@ -137,13 +137,15 @@ public Response createCatalog(
   }
 
   private void validateClientId(String clientId) {
-    if (!clientId.matches("^[0-9a-f]{16}$")) {
+    if (!clientId.matches(
+        realmConfig.getConfig(FeatureConfiguration.CREDENTIAL_RESET_CLIENT_ID_PATTERN))) {

Review Comment:
   Hmm, it will be per realm so no sure it can be done at startup properly, do you have a code pointer in mind? would bootstrap realm fulfill your expectation?
   
   default is known valid - same as before, it is hardcoded
   



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org