Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Transform gitserver access logs to audit logs#41865

Merged
vrto merged 4 commits intomainfrom
mv/auditlog/gitserver-access
Sep 26, 2022
Merged

Transform gitserver access logs to audit logs#41865
vrto merged 4 commits intomainfrom
mv/auditlog/gitserver-access

Conversation

@vrto
Copy link
Contributor

@vrto vrto commented Sep 21, 2022

Description

Gitserver access logs will optionally be included in the audit log. This is controlled via log.auditLog.gitServerAccess setting in the site config.

@bobheadxi I made a couple of calls here, but nothing is set in the stone yet. Let's treat this PR as a conversation for what should happen:

  • Note that gitserver access logs may still be used by the log.gitserver.accessLogs setting as before (should we totally drop this?)
  • The logic for (not) logging git server access just got a little more complicated, as it can be controlled by either of the two settings (logical or)
  • This introduces a breaking change - the gitserver access log message is now a standard audit log message, which is slightly richer and contains all of the data before, but the field actor is now located in the audit.actor property

Test plan

  • Automated tests
  • Picture with the captured log (localhost)
    CleanShot 2022-09-21 at 16 55 48@2x

@cla-bot cla-bot bot added the cla-signed label Sep 21, 2022
@vrto vrto requested review from a team and bobheadxi September 21, 2022 15:26
Copy link
Member

@bobheadxi bobheadxi left a comment

Choose a reason for hiding this comment

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

Note that gitserver access logs may still be used by the log.gitserver.accessLogs setting as before (should we totally drop this?)

We should mark it as deprecated in the docstring and remove it in a future release

Regarding the change in fields, I think it should be fine as long as we mention it in the changelog

Comment on lines +45 to +46
disabled bool
callback func()
accessLogsDisabled bool
auditDisabled bool
Copy link
Member

Choose a reason for hiding this comment

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

Internally why do we need to distinguish between the two? The logic to set disabled should take into account the legacy access logs and the new audit logs setting - IMO we should keep this the same as before here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I needed it to test this bool logic but since we're dropping the older setting it might not be needed

Copy link
Member

Choose a reason for hiding this comment

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

Instead, we can write a unit test for just that logic and keep this simple :)

@vrto
Copy link
Contributor Author

vrto commented Sep 21, 2022

@bobheadxi

We should mark it as deprecated in the docstring and remove it in a future release

Are you OK if I do it as part of this PR? So the change will be effective, right after merging the PR? Follow-up question; do you know of any clients using this in prod?

Regarding the change in fields, I think it should be fine as long as we mention it in the changelog

Good idea!

@bobheadxi
Copy link
Member

Are you OK if I do it as part of this PR? So the change will be effective, right after merging the PR?

Absolutely! (not the removal yet though)

Follow-up question; do you know of any clients using this in prod?

I'm not entirely sure actually, original PR is here: https://github.com/sourcegraph/sourcegraph/pull/38798 searching for the PR reveals https://sourcegraph.slack.com/archives/C02UC4WUX1Q/p1657786740125169 which seems to indicate only 1 customer uses this at the moment

@vrto
Copy link
Contributor Author

vrto commented Sep 22, 2022

@bobheadxi changes pushed, I tihnk I addressed everything we discussed here!

Copy link
Member

@bobheadxi bobheadxi left a comment

Choose a reason for hiding this comment

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

Nice, thanks for the updates!!

@vrto vrto merged commit 6302865 into main Sep 26, 2022
@vrto vrto deleted the mv/auditlog/gitserver-access branch September 26, 2022 13:33
sashaostrikov pushed a commit that referenced this pull request Sep 29, 2022
* Transform gitserver access logs to audit logs
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants