opendevstack / opendevstack/ods-provisioning-app

The API endpoint /project/validate?projectName=xxxx searches by project key instead of project name

Open
#698 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
14
Forks
20
Avg merge
3h 35m
Merged PRs (30d)
1

Description

Describe the bug
When calling the API endpoint /project/validate?projectName=xxxx, the project is searched by key and not by name.
The behaviour is exactly the same as that of the endpoint /project/key/validate?projectKey=xxxx

To Reproduce
Please recall that this endpoint's functionality is checking whether the specified project name is available (no project exists with that name). In case the name is available, a 200 status code should be returned. In case a project with that name already exists, a 406 status code should be returned.

Steps to reproduce the behavior:

  1. Login into de prov app using a browser
  2. In the browser, enter the endpoint /api/v2/project/validate?projectName=xxxx using an existing project key which is not also a project name.
  3. A 406 status response is received with an XML body with the error message "A project with this name exists". This is mistaken: a project with that key exists, but not with that name.
  4. Enter the endpoint /api/v2/project/validate?projectName=xxxx using an existing project name which is not also a project key.
  5. A 200 status response is received and the browser shows a blank screen. This is mistaken: a project with that name already exists.

Expected behavior
3. No project with the given name is found. A 200 status response is received and the browser shows a blank screen.
5. A project with the given name is found. A 406 status response is received with an XML body with the error message "A project with this name exists".

Screenshots
In the following example, TMEDP is the key of an existing project, but no project with name TMEDP exists.
image

Affected version (please complete the following information):

  • OpenShift: 3.11
  • OpenDevStack 1.1, 1.2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the handler for /api/v2/project/validate?projectName and compare its lookup with /api/v2/project/key/validate?projectKey. Reproduce the two cases using a project key and a project name, then verify that matching names return 406 with the stated XML message and non-matching names return 200.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.