Skip to content
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

Audit Log: Track RBAC changes #1610

Closed
wants to merge 24 commits into from

Conversation

AndrienkoAleksandr
Copy link
Collaborator

What does this pull request do

Implement audit logging for RBAC backend

Referenced issue:

https://issues.redhat.com/browse/RHIDP-2004

Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
Copy link

openshift-ci bot commented May 6, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from andrienkoaleksandr. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Contributor

github-actions bot commented May 6, 2024

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "Audit Log: Track RBAC changes". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat
 - fix
 - chore
 - docs
 - style
 - refactor
 - perf
 - test
 - revert

Copy link
Contributor

@Zaperex Zaperex left a comment

Choose a reason for hiding this comment

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

Upstream backstage is moving towards using their LoggerService (also refer to the implementation) instead of the winston Logger. The LoggerService does not contain this log function so we should be using the info and error functions instead to make migration to LoggerService in the future easier.

To get the same behavior as using log, you'll need to put the non message fields in the metadata argument of the info or error function. Otherwise, the object containing your audit log message will be logged as an object in the message field. This would result in [object Object] being printed if the logger format isn't JSON.

plugins/rbac-backend/src/audit-log/audit-logger.ts Outdated Show resolved Hide resolved
plugins/rbac-backend/src/audit-log/audit-logger.ts Outdated Show resolved Hide resolved
plugins/rbac-backend/src/audit-log/audit-logger.ts Outdated Show resolved Hide resolved
plugins/rbac-backend/src/audit-log/audit-logger.ts Outdated Show resolved Hide resolved
plugins/rbac-backend/src/audit-log/audit-logger.ts Outdated Show resolved Hide resolved
plugins/rbac-backend/src/audit-log/audit-logger.ts Outdated Show resolved Hide resolved
plugins/rbac-backend/src/audit-log/audit-logger.ts Outdated Show resolved Hide resolved
plugins/rbac-backend/src/audit-log/audit-logger.ts Outdated Show resolved Hide resolved
plugins/rbac-backend/src/audit-log/audit-logger.ts Outdated Show resolved Hide resolved
plugins/rbac-backend/src/audit-log/audit-logger.ts Outdated Show resolved Hide resolved
AndrienkoAleksandr and others added 7 commits May 7, 2024 10:44
Co-authored-by: Frank Kong <50030060+Zaperex@users.noreply.github.com>
Co-authored-by: Frank Kong <50030060+Zaperex@users.noreply.github.com>
Co-authored-by: Frank Kong <50030060+Zaperex@users.noreply.github.com>
Co-authored-by: Frank Kong <50030060+Zaperex@users.noreply.github.com>
Co-authored-by: Frank Kong <50030060+Zaperex@users.noreply.github.com>
Co-authored-by: Frank Kong <50030060+Zaperex@users.noreply.github.com>
Co-authored-by: Frank Kong <50030060+Zaperex@users.noreply.github.com>
AndrienkoAleksandr and others added 3 commits May 7, 2024 10:46
Co-authored-by: Frank Kong <50030060+Zaperex@users.noreply.github.com>
Co-authored-by: Frank Kong <50030060+Zaperex@users.noreply.github.com>
Co-authored-by: Frank Kong <50030060+Zaperex@users.noreply.github.com>
Copy link

sonarcloud bot commented May 7, 2024

Please retry analysis of this Pull-Request directly on SonarCloud

Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
@openshift-merge-robot
Copy link

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
Comment on lines 71 to 74
this.logger.info(
`${this.fmtToPastTime(operation)} '${metadata.roleEntityRef}'`
this.toLogMsgWithRoleInfo(logMsg, metadata)
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
this.logger.info(
`${this.fmtToPastTime(operation)} '${metadata.roleEntityRef}'`
this.toLogMsgWithRoleInfo(logMsg, metadata)
);
this.logger.info(
`${this.fmtToPastTime(operation)} '${metadata.roleEntityRef}'`,
this.toLogMsgWithRoleInfo(logMsg, metadata)
);

Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
Copy link

sonarcloud bot commented May 7, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

@AndrienkoAleksandr
Copy link
Collaborator Author

close on favour: #1694

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

Successfully merging this pull request may close these issues.

None yet

3 participants