-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CredentialsUseListener to improve tracking of Credentials usage #295
Add CredentialsUseListener to improve tracking of Credentials usage #295
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a downstream PR in some plugin showing what this would be used for?
src/main/java/com/cloudbees/plugins/credentials/CredentialsUseListener.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cloudbees/plugins/credentials/CredentialsUseListener.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cloudbees/plugins/credentials/CredentialsUseListener.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cloudbees/plugins/credentials/CredentialsUseListener.java
Outdated
Show resolved
Hide resolved
Thanks for your review, @jglick! I implemented all suggestions.
I am trying to track all objects that access credentials in an audit log (See downstream PR jenkinsci/audit-trail-plugin#68). This works well for most cases, but not all. For example, the GitHub Branch Source plugin accesses credentials via CredentialMatchers as seen in the class GitHubSCMBuilder. If anyone has an idea how to track that kind of access, please let me know. |
src/main/java/com/cloudbees/plugins/credentials/CredentialsUseListener.java
Outdated
Show resolved
Hide resolved
Best to move |
src/main/java/com/cloudbees/plugins/credentials/CredentialsUseListener.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cloudbees/plugins/credentials/CredentialsUseListener.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cloudbees/plugins/credentials/CredentialsUseListener.java
Outdated
Show resolved
Hide resolved
…eiswjn/credentials-plugin into feature/credential-usage-event
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me. Did you successfully use this API revision in the downstream PR?
Yes, the new API revision works perfectly. |
If all goes well, a new release should appear shortly. |
This change will allow tracking Credentials usage much easier, independent from Fingerprints. So far it was necessary to use the SaveableListener provided by the Fingerprints to subscribe to Credentials usage. Because certain credential consumers do not create fingerprints, this approach is flawed.
Creating the listener gives a lightweight method of tracking Credentials usage, improving overall security.
Tests are not provided, as the logic of the abstract functions is to be implemented by plugins using this approach. Tests are included in the plugin mentioned below.
Usecase: jenkinsci/audit-trail-plugin#68