# Bug OP-18511 - Race condition allows to create resurces with the same name, bypassing our uniqueness validation

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-18511

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 17.0.0 |
| Observed in versions |  |
| Sprint | 17.0.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers | Klaus Zanders |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Affected resources

  - Role

  - Status

  - Type

### Steps to reproduce

1.  With a tool like Burp or any other Client that generates HTTP requests, send in a burst to create new resources at the same time.

### What is the buggy behavior?

  - As the validation is only done in Rails code, there is a possibility that 2 requests arrive at the same time and multiple resource with the same name are created.

### What is the expected behavior?

1.  The database also validates uniqueness of the entry.

2.  It is best practice to back up the rails uniqueness constraint with a database one as well. There's even a [RuboCop](https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsuniquevalidationwithoutindex) that checks for this.

### 

###
