(Translated by https://www.hiragana.jp/)
automatically create hedgedoc user accounts so that edits are no longer anonymous by lanjelot · Pull Request #2 · hugsy/ctfhub · GitHub
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

automatically create hedgedoc user accounts so that edits are no longer anonymous #2

Merged
merged 2 commits into from
Nov 18, 2020
Merged

automatically create hedgedoc user accounts so that edits are no longer anonymous #2

merged 2 commits into from
Nov 18, 2020

Conversation

lanjelot
Copy link
Collaborator

This allows "authorship highlightiing", we can now see who made what changes to a note.

Copy link
Owner

@hugsy hugsy left a comment

Choose a reason for hiding this comment

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

Awesome idea to better integrate hedgedoc, let's use the info already collected by ctfpad via the User model to make it a bit more secure (because the hedgedoc has to be exposed by ctfpad)

cache: 'no-cache',
credentials: 'include',
headers: { 'Content-Type': 'application/x-www-form-urlencoded'},
body: "email={{request.user}}%40localhost.localdomain&password=hedgedoc"});
Copy link
Owner

Choose a reason for hiding this comment

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

why not use request.user.email ?

Copy link
Collaborator Author

@lanjelot lanjelot Nov 17, 2020

Choose a reason for hiding this comment

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

Because if I register lanjelot on ctfpad using hahanfiwhothisis@gmail.com and we use request.user.email instead of request.user then hedgedoc will use hahanfiwhothisis as the username and we'll have no idea that it is actually me (hedgedoc uses everything before @ as the username)

cache: 'no-cache',
credentials: 'include',
headers: { 'Content-Type': 'application/x-www-form-urlencoded'},
body: "email={{request.user}}%40localhost.localdomain&password=hedgedoc"});
Copy link
Owner

Choose a reason for hiding this comment

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

Also not a fan of static password: we have access to request.user object, that leaves room for crafting unique password per users.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah i just wanted to have a quick PoC working, feel free to use request.user.password or whatever instead. Also I didn't want to bother with what if the user resets or updates their password in ctfpad, then we need to update it in hedgedoc as well etc.

@@ -70,6 +71,17 @@ def form_valid(self, form):
messages.error(self.request, "Username already exists, try logging in instead")
return redirect("ctfpad:home")

# create the hedgedoc user
email = form.cleaned_data["username"] + '@localhost.localdomain'
Copy link
Owner

Choose a reason for hiding this comment

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

Same remarks as above

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

same reply as above ;)

@hugsy hugsy merged commit fd8b1c4 into hugsy:main Nov 18, 2020
@lanjelot lanjelot deleted the force-hedgedoc-auth branch November 19, 2020 17:00
@hugsy hugsy added this to the 0.1 milestone Jun 21, 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.

None yet

2 participants