Skip to content

Conversation

@sgscheffler
Copy link

Description

Adds source IP address and hostname to authentication failure log messages to help administrators identify which Jenkins node/agent is attempting to authenticate with incorrect credentials.

Changes

  • Add getSourceInfo() helper method to capture request source information
  • Include remote address and hostname in credential exception warnings
  • Helps administrators identify which node/agent is using wrong credentials
  • Uses Jakarta servlet API (non-deprecated)
  • Gracefully handles cases where request context is unavailable

Example Output

Before:

WARNING: Credential exception trying to authenticate against XXX.YYY domain

After:

WARNING: Credential exception trying to authenticate against XXX.YYY domain from 192.168.1.100 (hostname.domain.com)

Fixes JENKINS-76220

Testing done

  • Compiled successfully with mvn clean compile
  • All existing tests pass with mvn clean test
  • Manual code review: The getSourceInfo() method safely handles null request contexts by returning an empty string
  • The change only affects log output and does not modify authentication behavior
  • Tested local build with mvn hpi:run to verify plugin loads correctly

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

- Add getSourceInfo() helper method to capture request source information
- Include remote address and hostname in credential exception warnings
- Helps administrators identify which node/agent is using wrong credentials
- Uses Jakarta servlet API
- Gracefully handles cases where request context is unavailable

Fixes JENKINS-76220
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