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

Required challenge cannot be removed #66

Closed
152334H opened this issue Aug 24, 2021 · 1 comment
Closed

Required challenge cannot be removed #66

152334H opened this issue Aug 24, 2021 · 1 comment

Comments

@152334H
Copy link
Member

152334H commented Aug 24, 2021

steps to reproduce:

  1. login to account with permissions >= 2
  2. create a challenge with a required challenge
  3. try to remove that requirement

bug source

In step 2, the frontend will fetch /v1/challenge/edit over here:

https://github.com/IRS-Cybersec/ctf_platform/blob/master/client/src/AdminPanel/adminChallengeEdit.js#L93-L111

When the value of an attribute is undefined, JSON.stringify will remove the attribute altogether.

https://github.com/IRS-Cybersec/ctf_platform/blob/master/api/api.js#L1022-L1025

The backend calls updateOne() with $set; because updateObj contains no requires attribute, the challenge requirement remains in the db

@Tkaixiang
Copy link
Contributor

Fixed in 245d0f2

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

No branches or pull requests

2 participants