Skip to content

Improve secret detection with caching and setter support#2824

Merged
timja merged 1 commit intojenkinsci:masterfrom
somiljain2006:Attribute-secret-handling
Apr 11, 2026
Merged

Improve secret detection with caching and setter support#2824
timja merged 1 commit intojenkinsci:masterfrom
somiljain2006:Attribute-secret-handling

Conversation

@somiljain2006
Copy link
Copy Markdown
Contributor

@somiljain2006 somiljain2006 commented Apr 10, 2026

Optimize secret detection and add ClassValue cache

  • Introduce a ClassValue-backed cache to avoid repeated reflection, improving performance and preventing ClassLoader memory leaks.
  • Enhance secret detection by checking for setters that accept hudson.util.Secret.
  • Make calculateIfSecret return a primitive boolean (defaulting to false) to ensure safe handling without nullable states.
  • Reduce log noise by removing repeated logging for null targetClass cases.

Add tests covering:

  • getter, field, and setter-based secret detection
  • inheritance scenarios
  • non-secret cases
  • cache consistency (idempotency)

Manual verification performed:

  • confirmed cache effectiveness via logging
  • verified secrets are masked in exported YAML
  • validated no ClassLoader leaks via plugin install/uninstall cycle

Your checklist for this pull request

🚨 Please review the guidelines for contributing to this repository.

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or in Jenkins JIRA
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Did you provide a test case? That demonstrates a feature works or fixes the issue.

@somiljain2006 somiljain2006 requested a review from a team as a code owner April 10, 2026 19:16
@timja timja added the feature A PR that adds a feature - used by Release Drafter label Apr 11, 2026
Copy link
Copy Markdown
Member

@timja timja left a comment

Choose a reason for hiding this comment

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

looks fine

@timja timja merged commit ba36d7a into jenkinsci:master Apr 11, 2026
17 checks passed
@somiljain2006 somiljain2006 deleted the Attribute-secret-handling branch April 11, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A PR that adds a feature - used by Release Drafter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants