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

Add: audit event to GET /roles/:account/:kind/*identifier?memberships #2693

Merged
merged 1 commit into from
Jan 10, 2023

Conversation

yoavgeva
Copy link
Contributor

@yoavgeva yoavgeva commented Dec 29, 2022

Desired Outcome

This PR adds an audit log message for list members using the API endpoint GET /roles/{account}/{kind}/{identifier}?memberships

Implemented Changes

Describe how the desired outcome above has been achieved with this PR. In
particular, consider:

  • Example audit message

Audit Example:

<86>1 2022-12-29T21:56:07.426Z - conjur 74681 memberships [auth@43868 user="cucumber:user:admin"][subject@43868 role="cucumber:user:alice"][client@43868 ip="127.0.0.1"][action@43868 result="success" operation="list"] cucumber:user:admin successfully listed memberships with parameters: {:account=>"cucumber", :kind=>"user"}

Connected Issue/Story

Resolves ONYX-26177

Definition of Done

At least 1 todo must be completed in the sections below for the PR to be
merged.

Changelog

  • The CHANGELOG has been updated, or
  • This PR does not include user-facing changes and doesn't require a
    CHANGELOG update

Test coverage

  • This PR includes new unit and integration tests to go with the code
    changes, or
  • The changes in this PR do not require tests

Documentation

  • Docs (e.g. READMEs) were updated in this PR
  • A follow-up issue to update official docs has been filed here: [insert issue ID]
  • This PR does not require updating any documentation

Behavior

  • This PR changes product behavior and has been reviewed by a PO, or
  • These changes are part of a larger initiative that will be reviewed later, or
  • No behavior was changed with this PR

Security

  • Security architect has reviewed the changes in this PR,
  • These changes are part of a larger initiative with a separate security review, or
  • There are no security aspects to these changes

@yoavgeva yoavgeva requested a review from a team as a code owner December 29, 2022 22:01
app/models/audit/event/memberships.rb Outdated Show resolved Hide resolved
app/models/audit/event/memberships.rb Outdated Show resolved Hide resolved
app/models/audit/event/memberships.rb Show resolved Hide resolved
app/models/audit/event/memberships.rb Show resolved Hide resolved
app/controllers/roles_controller.rb Outdated Show resolved Hide resolved
@yoavgeva yoavgeva changed the title Add: audit event to GET /roles/:account/:kind/*identifier Add: audit event to GET /roles/:account/:kind/*identifier?memberships Jan 1, 2023
@yoavgeva yoavgeva force-pushed the audit-list-memberships branch 4 times, most recently from d06df5f to eb12ca7 Compare January 1, 2023 16:32
app/controllers/roles_controller.rb Outdated Show resolved Hide resolved
app/models/audit/event/memberships.rb Show resolved Hide resolved
app/controllers/roles_controller.rb Outdated Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
jvanderhoof
jvanderhoof previously approved these changes Jan 4, 2023
Copy link
Contributor

@jvanderhoof jvanderhoof left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for getting this functional gap filled!

@yoavgeva yoavgeva force-pushed the audit-list-memberships branch 2 times, most recently from d41a8b8 to f909e65 Compare January 5, 2023 15:23
@@ -0,0 +1,89 @@
module Audit
module Event
Copy link

Choose a reason for hiding this comment

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

Similar blocks of code found in 2 locations. Consider refactoring.

@yoavgeva yoavgeva force-pushed the audit-list-memberships branch 2 times, most recently from 64465e1 to 93c3b84 Compare January 8, 2023 06:34
@yoavgeva yoavgeva requested a review from oburstein-hub January 8, 2023 10:51
@jvanderhoof jvanderhoof self-requested a review January 9, 2023 18:19
jvanderhoof
jvanderhoof previously approved these changes Jan 9, 2023
Add: audit event to GET /roles/:account/:kind/*identifier
@codeclimate
Copy link

codeclimate bot commented Jan 9, 2023

Code Climate has analyzed commit 8e6a0f4 and detected 4 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 2
Style 1
Complexity 1

The test coverage on the diff in this pull request is 81.2% (50% is the threshold).

This pull request will bring the total coverage in the repository to 90.0% (-1.7% change).

View more on Code Climate.

@yoavgeva yoavgeva merged commit 5c99194 into master Jan 10, 2023
@yoavgeva yoavgeva deleted the audit-list-memberships branch January 10, 2023 15:19
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.

3 participants