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 auditing for all user actions #3078 #3083

Merged
merged 1 commit into from
Jun 22, 2016
Merged

Add auditing for all user actions #3078 #3083

merged 1 commit into from
Jun 22, 2016

Conversation

maartenba
Copy link
Contributor

@maartenba maartenba commented Jun 17, 2016

Thuis PR ensures the following operations are audited:

  • User audit actions:
    • Registered
    • AddedCredential
    • RemovedCredential
    • RequestedPasswordReset
    • ChangeEmail
    • CancelChangeEmail
    • ConfirmEmail
    • Login
    • Failed logins
  • Package audit actions:
    • Deleted
    • SoftDeleted
    • Publish
    • List/Unlist
    • Edit metadata
    • Failed push due to invalid credential
  • Package registration audit actions:
    • Add/remove owner

Please have a look @skofman1 @xavierdecoster

@@ -26,6 +26,7 @@ public AuditActor(string machineName, string machineIP, string userName, string
public AuditActor(string machineName, string machineIP, string userName, string authenticationType, DateTime timeStampUtc, AuditActor onBehalfOf)
{
MachineName = machineName;
MachineIP = machineIP; // TODO: can we store this information?
Copy link
Member

Choose a reason for hiding this comment

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

None issue for server IPs. If client IP, this is PII, which means "to investigate" :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yishaigalatzer do you know if we can store client IP for auditing purposes?

Choose a reason for hiding this comment

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

Lets follow up offline with privacy/security folk

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems we can store it if we obfuscate the last octet. Updated the code to reflect this. (replace last octet with 0)

@skofman1
Copy link
Contributor

        // Track the value for credentials that are definitely revokable (API Key, etc.) and have been removed

I'm confused.. do we save the Api Key value? Why? Are we allowed?


Refers to: src/NuGetGallery.Core/Auditing/CredentialAuditRecord.cs:19 in d1d291b. [](commit_id = d1d291b, deletion_comment = False)

@yishaigalatzer
Copy link

Also add failed login attempts (if not there) and failed publish (because of ApiKey)

@@ -71,8 +68,8 @@ private class NullAuditingService : AuditingService
{
protected override Task<Uri> SaveAuditRecord(string auditData, string resourceType, string filePath, string action, DateTime timestamp)
{
var uriString = $"http://auditing.local/{resourceType}/{filePath}/{timestamp:s}-{action.ToLowerInvariant()}";
var uri = new Uri(uriString);
var uri = new Uri($"http://auditing.local/{resourceType}/{filePath}/{timestamp:s}-{action.ToLowerInvariant()}");

Choose a reason for hiding this comment

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

why the change? also can you break line 70 so it fits on the screen without scrolling?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@maartenba
Copy link
Contributor Author

@skofman RE:#3083 (comment) - the value is only stored when: 1) it is an API key and 2) it has just been replaced. Audits will never contain API keys that are in use. That said, this used to be the behavior and we're free to update if this makes no sense.

@maartenba
Copy link
Contributor Author

@yishaigalatzer Added additional audits re: #3083

@maartenba
Copy link
Contributor Author

Think we are good to merge. Can you have another pass?

* Remaining actions for Package: list/unlist, edit metadata
@maartenba maartenba merged commit b24c2ec into dev Jun 22, 2016
@maartenba maartenba deleted the feature/3078 branch June 22, 2016 07:30
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.

5 participants