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

[PE-D][Tester E] Possible to create duplicate persons by manipulating tags #143

Closed
nus-se-script opened this issue Nov 3, 2023 · 0 comments · Fixed by #151
Closed

[PE-D][Tester E] Possible to create duplicate persons by manipulating tags #143

nus-se-script opened this issue Nov 3, 2023 · 0 comments · Fixed by #151
Assignees

Comments

@nus-se-script
Copy link

Description

In the application, there is validation to ensure that the address book does not contain duplicate people (all with the same fields). However, through the tags, it is possible to bypass this.

Recording 2023-11-03 at 22.16.52.gif

Steps to reproduce

  1. Launch the application.
  2. Run clear to reset application data.
  3. Run add contact -n John Doe -p 98765432 -e [email protected] -a 311, Clementi Ave 2, #02-25 -t frontend
  4. Run add contact -n John Doe -p 98765432 -e [email protected] -a 311, Clementi Ave 2, #02-25 which is the same as above but without the tag
  5. Run add tag -id 2 -t frontend to make the second contact equivalent to the first
  6. Run exit to save the data
  7. Relaunch the application

Expected behaviour

At step 5, the application should let the user know that this command would result in a duplicate person, invalidating the command. Additionally, since the application allows for step 5 to carry on, it should update the UI to reflect the added tag to contact 2.

Actual behaviour

Step 5 carries on as usual, though without updating the UI and displaying the newly added tag to the second contact, allowing the application to store 2 duplicate people. The final state of data/addressbook.json file below that proves this.

{
  "persons" : [ {
    "name" : "John Doe",
    "phone" : "98765432",
    "email" : "[email protected]",
    "address" : "311, Clementi Ave 2, #02-25",
    "tags" : [ "frontend" ],
    "notes" : [ ],
    "events" : [ ]
  }, {
    "name" : "John Doe",
    "phone" : "98765432",
    "email" : "[email protected]",
    "address" : "311, Clementi Ave 2, #02-25",
    "tags" : [ "frontend" ],
    "notes" : [ ],
    "events" : [ ]
  } ]
}

This results in the application being launched at step 7 with no data as the storage detects duplicate people.

Ideas

Perhaps the add tag command could provide some validation to ensure that the edited person is not a duplicate.


Labels: severity.High type.FunctionalityBug
original: nathanielcalimag/ped#12

@AndrewJanong AndrewJanong self-assigned this Nov 8, 2023
@AndrewJanong AndrewJanong linked a pull request Nov 8, 2023 that will close this issue
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 a pull request may close this issue.

2 participants