Skip to content

Conversation

@hisanhunais
Copy link
Contributor

Purpose

  • The following changes are done to the SP app configuration section when multiple client secret support is enabled
    • Mask the secret value
    • Hide the "regenerate" button

Copilot AI review requested due to automatic review settings January 7, 2026 08:30
@coderabbitai
Copy link

coderabbitai bot commented Jan 7, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modifies the Service Provider configuration section in the Management Console to support multiple client secrets. When the multiple client secrets feature is enabled, the UI masks the secret value with asterisks and hides the "Regenerate" button to prevent conflicts with the new multi-secret management approach.

Key Changes:

  • Add configuration constant for checking if multiple client secrets are enabled
  • Mask OAuth consumer secrets with asterisks when multiple secrets feature is active
  • Conditionally hide the Show/Hide toggle and Regenerate button based on the feature flag

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
ApplicationMgtUIConstants.java Adds MULTIPLE_CLIENT_SECRETS_ENABLED constant to store the configuration property name for the multiple client secrets feature
configure-service-provider.jsp Implements UI logic to mask secrets and hide regenerate functionality when multiple client secrets are enabled, including conditional rendering of Show/Hide button and Regenerate action link

value="<%=Encode.forHtmlAttribute(oauthConsumerSecret)%>"
value="<%=Encode.forHtmlAttribute(displayValue)%>"
readonly="readonly">
<%-- Show/Hide button only if multiple Secrets is NOT allowed --%>
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment has two issues: 1) "Secrets" should not be capitalized mid-sentence as it's not a proper noun, and 2) grammatically it should be "are NOT allowed" not "is NOT allowed" (plural subject requires plural verb).

Suggested change
<%-- Show/Hide button only if multiple Secrets is NOT allowed --%>
<%-- Show/hide button only if multiple secrets are NOT allowed. --%>

Copilot uses AI. Check for mistakes.
Comment on lines 2314 to 2317
// If multiple secrets is allowed, mask the secret
String displayValue = oauthConsumerSecret;
if (multipleSecretsAllowed) {
displayValue = "*".repeat(16);
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The masking implementation uses a fixed length of 16 asterisks regardless of the actual secret length. This could leak information about the secret length. Consider either: 1) masking with asterisks that match the actual secret length to maintain consistency, or 2) consistently using a standard fixed length across the application for all masked secrets to avoid leaking any information.

Suggested change
// If multiple secrets is allowed, mask the secret
String displayValue = oauthConsumerSecret;
if (multipleSecretsAllowed) {
displayValue = "*".repeat(16);
// If multiple secrets are allowed, mask the secret by preserving its length.
String displayValue = oauthConsumerSecret;
if (multipleSecretsAllowed && oauthConsumerSecret != null) {
displayValue = "*".repeat(oauthConsumerSecret.length());

Copilot uses AI. Check for mistakes.
<div>
<input style="border: none; background: white;"
type="password" autocomplete="off"
type="<%= multipleSecretsAllowed ? "text" : "password" %>"
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When multiple secrets are allowed, the input type is changed from "password" to "text" while displaying masked asterisks. This approach might confuse users and could expose the field to browser password managers or autofill features that typically ignore text fields. Consider keeping the input type as "password" and using the value attribute with masked asterisks, or add appropriate autocomplete attributes to prevent unintended behavior.

Copilot uses AI. Check for mistakes.
Comment on lines 376 to 378
boolean multipleSecretsAllowed =
IdentityUtil.getProperty(ApplicationMgtUIConstants.MULTIPLE_CLIENT_SECRETS_ENABLED) != null &&
Boolean.parseBoolean(IdentityUtil.getProperty(ApplicationMgtUIConstants.MULTIPLE_CLIENT_SECRETS_ENABLED));
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IdentityUtil.getProperty() method is called twice in this expression - once for the null check and once for parsing. Consider storing the result in a local variable first to avoid the redundant call.

Copilot uses AI. Check for mistakes.
%>
<% if (!(appBean.getOauthConsumerSecret() == null || "false".equals(isHashDisabled))) { %>
<% if (!(appBean.getOauthConsumerSecret() == null || "false".equals(isHashDisabled))) {
// If multiple secrets is allowed, mask the secret
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment has two issues according to coding guidelines: 1) grammatically it should be "are allowed" not "is allowed" (plural subject requires plural verb), and 2) comments should end with a period.

Copilot generated this review using guidance from repository custom instructions.
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant