Skip to content

Security logs: delete old user security logs #8620

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

Merged
merged 9 commits into from
Aug 31, 2022
Merged

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Oct 26, 2021

Delete all logs that aren't attached to an organization, this is since those logs should be deleted according to their plan on .com.

Logs that aren't attached to an organization are logs from authentication to the dashboard, aka user security logs.

@stsewd stsewd force-pushed the delete-user-audit-logs branch from 8c8d945 to 50a9a94 Compare October 27, 2021 20:49
@stsewd stsewd marked this pull request as ready for review October 27, 2021 20:52
@stsewd stsewd requested a review from a team as a code owner October 27, 2021 20:52
@stsewd stsewd force-pushed the delete-user-audit-logs branch from 50a9a94 to e117e07 Compare October 27, 2021 21:07
Copy link
Member

@humitos humitos 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 to me! I just want to be sure if we don't want to save audit logs for different periods of time based on the organization's plan the user belongs to.

"""
Delete personal security logs older than `days`.

If `days` isn't given, default to ``RTD_AUDITLOGS_DEFAULT_RETENTION_DAYS``.
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we keep audit logs longer for users belonging to organizations with bigger plans?

Copy link
Member Author

Choose a reason for hiding this comment

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

The logs we are deleting are related to actions of the user outside the organization, especially auth and auth failures to the dashboard. This type of information isn't visible to the organization owners currently.

We could show this type of activity to the org owners (just of members of the org), but those are outside the organization, so not sure if that makes sense to show to org owners since it isn't related to activity done on the organization.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's important to keep this data in the database. It could be useful for organization's owners, in particular, if they think they are being attacked and trying to log in with different accounts from their employees to gain access to unauthorized documentation.

Also, if the organization wants to audit when they users logging for the last time or similar, it's data they should have access to.

So, I'd personally tie these retention days to the same day of the plan the organization is paying for.

Copy link
Member

Choose a reason for hiding this comment

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

Yea, I'd be 👍 on using the organization plan here, so users get the benefit of the organization's longer subscription time. I think this makes the most sense.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have overridden this task on .com, since there is code there that I'm using, but I'll move that code to .org soon. This PR still needs to be merged, it does the deletion for logs from .org where we don't have organizations, the other PR on .com overrides this.

Copy link
Member

Choose a reason for hiding this comment

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

Cool! I think we should have all the code in just one project (here) and check for RTD_ALLOW_ORGANIZATION to decide what's the logic to run on each case.

@ericholscher
Copy link
Member

Moving to next release. @stsewd looks like this just needs a small update.

@stsewd stsewd marked this pull request as draft January 17, 2022 23:04
@stsewd stsewd force-pushed the delete-user-audit-logs branch from dd6b5b8 to d4ee0cd Compare January 19, 2022 21:49
@stsewd stsewd marked this pull request as ready for review January 19, 2022 21:58
@stsewd stsewd requested review from ericholscher and a team January 20, 2022 22:51
"""
Delete personal security logs older than `days`.

If `days` isn't given, default to ``RTD_AUDITLOGS_DEFAULT_RETENTION_DAYS``.
Copy link
Member

Choose a reason for hiding this comment

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

Cool! I think we should have all the code in just one project (here) and check for RTD_ALLOW_ORGANIZATION to decide what's the logic to run on each case.

@stsewd stsewd merged commit b55f3d6 into main Aug 31, 2022
@stsewd stsewd deleted the delete-user-audit-logs branch August 31, 2022 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants