-
Notifications
You must be signed in to change notification settings - Fork 644
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
Abstract typosquatting #9767
Abstract typosquatting #9767
Conversation
fbeb33a
to
1c4c856
Compare
a2b703f
to
3c28fba
Compare
@@ -1,213 +0,0 @@ | |||
// Copyright (c) .NET Foundation. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is moved to abstraction helper.
@@ -13,33 +13,29 @@ namespace NuGetGallery | |||
{ | |||
public class TyposquattingService : ITyposquattingService | |||
{ | |||
private static readonly IReadOnlyList<ThresholdInfo> ThresholdsList = new List<ThresholdInfo> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is moved to abstraction helper.
@@ -138,29 +134,5 @@ public bool IsUploadedPackageIdTyposquatting(string uploadedPackageId, User uplo | |||
|
|||
return wasUploadBlocked; | |||
} | |||
private static int GetThreshold(string packageId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is moved to abstraction helper.
@@ -1,86 +0,0 @@ | |||
// Copyright (c) .NET Foundation. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is moved to abstraction helper.
be92ced
to
9454866
Compare
tests/NuGetGallery.Core.Facts/TestUtils/TestTyposquattingServiceHelper.cs
Outdated
Show resolved
Hide resolved
@@ -137,93 +138,6 @@ public void CheckNotTyposquattingBySameOwnersTest() | |||
Assert.Equal(0, typosquattingCheckCollisionIds.Count); | |||
} | |||
|
|||
[Fact] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is moved to abstraction helper.
} | ||
|
||
[Theory] | ||
[InlineData("Microsoft_NetFramework_v1", "Microsoft.NetFramework.v1", 0)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is moved to abstraction helper.
c40c470
to
186a748
Compare
|
||
return typosquattingService; | ||
}) | ||
.AsSelf() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we plan to have that type resolved as self? Wouldn't .As<ITyposquattingServiceHelper>()
be enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tbh this method is new to me, I just copied from line 1570 above assuming how it's done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd guess, there is no need for it to be there as well :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed here, I think removing other instances are out of scope for this PR. If you wish I can create a tracking issue for those.
186a748
to
2f97833
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, make sure everything still works when deployed to dev environment before merging.
Tracking issue: https://github.com/NuGet/Engineering/issues/4815
See at tracking issue for related PRs.