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

Feature: iCal link #216

Closed
wants to merge 35 commits into from
Closed

Feature: iCal link #216

wants to merge 35 commits into from

Conversation

JJ-8
Copy link
Collaborator

@JJ-8 JJ-8 commented May 9, 2023

This is a successor PR of #146. I modified two things:

  1. The UI for getting the link is changed: now you just click the button and the link is copied to your clipboard, confirmed with a checkmark.
  2. The URL in the iCal is the URL for the CTF itself, not the link from CTFNote (as stated in Add iCal link #146 (comment)).

Please note that this PR can NOT be merged before #214 is merged because of the order of the migrations.

BitK and others added 30 commits November 30, 2021 02:28
An ical link is now available on /calendar.ics.
It contains all the ctfs with their description and dates.
This endpoint is protected with a token by default,
the password can be changed/removed by the admin.
gen_random_bytes is more suited for crypto purpose
If it should be removed, this should be done in a seperate PR.
Adds /calendar.ics route to frontend
Fixes changing the ical key
slight frontend changes when displaying the ical link
This reduced code redundancy
* Fix eslint errors
* Fix insecure randomness in Registration.vue
Note: Users can still send requests which yield garbage responses, but this is
not a security vulnerability because these responses are only served to the requesting
user
The next page arrow did not work but is now fixed.
Also remove the sorting functionality since it does not work.
If you create a CTF which is in the past, it would appear at the bottom of
the past CTF table until you refresh the table.
Now the list is properly sorted which will place the CTF at
the expected place.
This was newly added to the challenge categories as listed at
https://ctf.hackthebox.com/api/public/challengeCategories
The graphql-upload packages has been swapped with graphql-upload-ts,
because it is not possible anymore to use graphql-upload due to import issues.
The SCSS variables are from quasarframework/quasar#15144 (comment)
This fixes the ugly dark shadows in dark mode but keeps the shadows in light mode.
This was added in Quasar 2.11 but reverted using the SCSS patch.

Due to an update of ESLint, it complains about single-word components.
Since this is used in CTFNote, this rule is disabeld.

Also some small (automatic) fixes.
It expects undefined officially, so we return that instead.
JJ-8 added 4 commits May 5, 2023 17:16
Now it uses the password-input just like the registration password.
The dialog UI is confusing because you think that the key is short
but actually it is out of view in the input field.
Since the only action is to get the link of the ical, we just copy it
to the clipboard immediately and show a confirmation checkmark.
@JJ-8 JJ-8 requested a review from XeR May 9, 2023 08:21
@JJ-8
Copy link
Collaborator Author

JJ-8 commented May 9, 2023

There were some merge conflicts with the yarn.lock files due to the new ical dependency. I have resolved them by removing the yarn.lock and running yarn again. This resulted in quite a big dependency update. I did a quick manual test of all the features and everything appears to still work fine.

@peace-maker
Copy link
Contributor

@XeR Can you have a look please? ❤️ We'd like to use this feature!

@XeR XeR self-assigned this Sep 1, 2023
Copy link
Contributor

@XeR XeR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice PR, but… 😄

I think we should not use a single shared token.
How do we invalidate a token when somebody leaves the team in bad terms?
Regenerating a token is doable, but it's a pain because everybody have to update everything.

What about $id:$hash instead ?
e.g. ?key=1337:deadbeefcafebabe… with the hash being e.g. a SHA-1 of the password's hash

SELECT * FROM ctfnote_private."user" WHERE id = 42 AND encode(digest(password, 'sha1'), 'hex') = '851f5ebcbf8cf861f274b11b0ee1766db91bfd91';
 id | login |                           password                           |    role
----+-------+--------------------------------------------------------------+------------
 42 | XeR   | $2a$10$XXXXXXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXX | user_admin
(1 row)

I propose using SHA-1 because it is faster than MD5.
CRC-32 would be better, but I'm afraid some maniac would try to bruteforce it.

If we agree with my proposal, it means your PR needs the following changes:

  • replace password with a "enable ical?" toggle in the admin interface
  • replace the password with a boolean in the database
  • change the verification logic

Keep in mind that this proposal might make it awkward when we implement #171.
We've been talking about that since 2020 (#20) so "whatever, we'll figure it out later" is a perfectly valid answer.


watch(
adminSettings,
(s) => {
registrationPassword.value = s.registrationPassword ?? '';
registrationPassword.value = s.registrationPassword;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure this NULL-coalescing was not needed ?

@@ -54,6 +54,7 @@ const ctfRoute: RouteRecordRaw = {
children: [
{
path: 'task/:taskId(\\d+)-:taskSlug',
alias: ['task/:taskId(\\d+)'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this? How is this related to iCal?

@JJ-8
Copy link
Collaborator Author

JJ-8 commented Apr 28, 2024

This is already included in #237

@JJ-8 JJ-8 closed this Apr 28, 2024
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.

4 participants