Skip to content

Add feature for storing flag in database - #23

Merged
SakiiR merged 3 commits into
TFNS:devfrom
JJ-8:store-flag
Mar 23, 2021
Merged

SakiiR merged 3 commits into
TFNS:devfrom
JJ-8:store-flag

Conversation

@JJ-8

@JJ-8 JJ-8 commented Mar 10, 2021 •

Copy link
Copy Markdown
Collaborator

After a task is marked as "Solved", the user is asked to enter the flag. The flag will be stored in the database and the user can open it using the context menu. If no flag is provided, nothing will be overwritten. Therefore, it is possible to solve and unsolve a task multiple times without overwriting the current flag.

A global option "store-flag" is added to enable/disable this feature. The default is true.
An API is introduced to query non-private settings, so it will also work for non-admin users.
The "store-flag" setting can also be overwritten by the environment variable CTFNOTE_STORE_FLAG.

For some more context:
We added this feature, because sometimes it is required to create a writeup with flags in order to claim a spot on the scoreboard. However, we sometimes forget to store the flags and when the challenge servers closes, we are in big trouble...
Therefore, we wanted to force our teammates to enter the flag when they mark it as solved so we will have the flag stored at least.

JJ-8 added 3 commits March 10, 2021 22:49
After a task is marked as "Solved", the user is asked to enter the flag.
The flag will be stored in the database and the user can open it using the
context menu. If no flag is provided, nothing will be overwritten.
Therefore, it is possible to solve and unsolve a task multiple times
without overwriting the current flag.

A global option "store-flag" is added to enable/disable this feature.
Default is true.
An API is introduced to query non-private settings, so it will also work
for non-admin users.
The "store-flag" setting can also be overwritten by the environment
variable CTFNOTE_STORE_FLAG.
The environment variables did not use the new private column, which caused
an exception. Now, a new argument is introduced to toggle this option.
Also, the INSERT INTO query is removed in order to let the
PersistentConfiguration.setIfNotSet
decide whether to use the env variables (with default values if not set)
or the current stored database option.
The button is not useful if there is no flag yet, so now we hide the button
until a flag is stored. After that, the button will stay there forever,
because it can not be set to null again.
Therefore, you also know when a flag was submitted in the past but was
overwritten with something else if the button is there but the flag is not.
@JJ-8

JJ-8 commented Mar 11, 2021

Copy link
Copy Markdown
Collaborator Author

Either this PR or #20 should be updated to fix any merge conflicts.

@SakiiR

SakiiR commented Mar 11, 2021

Copy link
Copy Markdown
Member

I think I am going to process #20 first (#fifo).

@SakiiR
SakiiR changed the base branch from main to dev March 23, 2021 09:36
@SakiiR

SakiiR commented Mar 23, 2021

Copy link
Copy Markdown
Member

LGTM for now.

Maybe we will add more fancy display for the flag in the UI.

Merge into dev :)

@SakiiR
SakiiR merged commit a15dadf into TFNS:dev Mar 23, 2021
@JJ-8
JJ-8 deleted the store-flag branch June 17, 2023 17:30
JJ-8 added a commit to woutvanderploeg/CTFNote that referenced this pull request Jun 17, 2023
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 this pull request may close these issues.

2 participants