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

Abstract typosquatting #9767

Merged
merged 2 commits into from
Jan 8, 2024
Merged

Abstract typosquatting #9767

merged 2 commits into from
Jan 8, 2024

Conversation

erdembayar
Copy link
Contributor

@erdembayar erdembayar commented Dec 22, 2023

Tracking issue: https://github.com/NuGet/Engineering/issues/4815
See at tracking issue for related PRs.

@erdembayar erdembayar force-pushed the dev-eryondon-abstracttyposq1 branch from fbeb33a to 1c4c856 Compare December 22, 2023 19:42
@erdembayar erdembayar marked this pull request as ready for review December 26, 2023 17:50
@erdembayar erdembayar requested a review from a team as a code owner December 26, 2023 17:50
@erdembayar erdembayar force-pushed the dev-eryondon-abstracttyposq1 branch 2 times, most recently from a2b703f to 3c28fba Compare December 27, 2023 03:14
@@ -1,213 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
Copy link
Contributor Author

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>
Copy link
Contributor Author

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)
Copy link
Contributor Author

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.
Copy link
Contributor Author

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.

@erdembayar erdembayar force-pushed the dev-eryondon-abstracttyposq1 branch 2 times, most recently from be92ced to 9454866 Compare December 27, 2023 03:22
@@ -137,93 +138,6 @@ public void CheckNotTyposquattingBySameOwnersTest()
Assert.Equal(0, typosquattingCheckCollisionIds.Count);
}

[Fact]
Copy link
Contributor Author

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)]
Copy link
Contributor Author

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.

@erdembayar erdembayar force-pushed the dev-eryondon-abstracttyposq1 branch 4 times, most recently from c40c470 to 186a748 Compare December 27, 2023 03:34
drewgillies
drewgillies previously approved these changes Dec 27, 2023

return typosquattingService;
})
.AsSelf()
Copy link
Contributor

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?

Copy link
Contributor Author

@erdembayar erdembayar Jan 3, 2024

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.

Copy link
Contributor

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 :)

Copy link
Contributor Author

@erdembayar erdembayar Jan 3, 2024

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.

Copy link
Contributor

@agr agr left a 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.

@erdembayar erdembayar merged commit c1115f8 into dev Jan 8, 2024
2 checks passed
@erdembayar erdembayar deleted the dev-eryondon-abstracttyposq1 branch January 8, 2024 18: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.

3 participants