Skip to content

added throttling for register method to prevent batch e-mail checks +…#154

Merged
idormenco merged 6 commits intocode4romania:developfrom
Alexei000:feature/61-email-already-used-response
Oct 28, 2021
Merged

added throttling for register method to prevent batch e-mail checks +…#154
idormenco merged 6 commits intocode4romania:developfrom
Alexei000:feature/61-email-already-used-response

Conversation

@Alexei000
Copy link
Copy Markdown
Contributor

… return http error status code on already existing e-mail

What does it fix?

Closes #61

This tries to allow the API to inform the client(s) that an e-mail is already used, but prevent a malicious actor from checking many e-mail addresses. This is done by using IP rate-limiting via AspNetCoreRateLimit library.

However, I am not sure about returning a Conflict response for existing e-mails. The alternative would be returning OK, but this requires a breaking change for the response payload model since now it is just a string.

How has it been tested?

Currently, I have performed only some manual checks and it works as expected.

… return http error status code on already existing e-mail
Comment thread Src/DeUrgenta.User.Api/Controller/AuthController.cs
Comment thread Src/DeUrgenta.Api/Startup.cs Outdated
</ItemGroup>

<ItemGroup>
<Folder Include="Models\DTOs\Responses\" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

delete folder Models\DTOs\Responses

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread Src/DeUrgenta.Api/Startup.cs Outdated
private static Assembly[] GetAssemblies() => new[]
{
Assembly.GetAssembly(typeof(Startup)),
{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you please keep original formating for this method

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sorry, I think Resharper tried to be smart. I have reverted the change.

Copy link
Copy Markdown
Member

@idormenco idormenco left a comment

Choose a reason for hiding this comment

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

lgtm

@idormenco idormenco merged commit cbf3d39 into code4romania:develop Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Throw proper error in case the user tries to register again with the same email address

2 participants