codimd icon indicating copy to clipboard operation
codimd copied to clipboard

Feature Request: Make it possible to set a password for guests

Open miterion opened this issue 7 years ago • 26 comments

We currently use etherpad with a custom pad manager so we can set a password to view/edit a pad. This way the links can be shared and not be edited by anyone. Would it be possible to add this to hackmd?

miterion avatar Jun 21 '17 09:06 miterion

You can use the usual auth integrations + permission.

Set it to limited and only users that are able to authenticate to a pad, can edit or see it.

And sorry for the late response, we currently revisit all issues.

SISheogorath avatar Oct 06 '17 20:10 SISheogorath

Interesting idea:

You can set one password for a pad in the permission section and everyone who would find a 403 right now, like Guest when a note is marked as "Limited", "Protected" or "Private" or users in case of a "Private" one, will be prompted for the password. And additional checkbox, besides the password field should toggle write access to for these users.

It's a very basic feature, but should be enough.

SISheogorath avatar Oct 10 '17 11:10 SISheogorath

This would be very cool, would love to see this implemented or implement it myself

miterion avatar Oct 11 '17 10:10 miterion

We would very welcome a PR ❤️. Can't say when I'll get into this.

Feel free to ask if you have questions :smile:

Meet us in our Gitter-Space: Join the chat at https://gitter.im/hackmdio/hackmd

SISheogorath avatar Oct 11 '17 10:10 SISheogorath

From a UI perspective I did some experiments:

Note implementation

With label at the bottom:

image


Without at the bottom:

image


With label but over the deletion in between:

image


Without label but over the deletion in between:

image


403-page implementation

screen shot 2017-10-14 at 22 43 47-fullpage


Right now, I didn't do any server-side implementation. So there is no branch for testing right now. I wonder what is preferred.

Any additional/alternative ideas?

SISheogorath avatar Oct 14 '17 21:10 SISheogorath

I would add a submit button to the 403 page, since many people would expect this.

miterion avatar Oct 14 '17 21:10 miterion

regarding the different variants: I believe "note password" alone is not enough, it needs the extra label. Especially when something is already entered and the hint inside the input is no longer visible.

Also, input and label needs some margins left and right.

ccoenen avatar Oct 14 '17 21:10 ccoenen

Is this better?

image


image


403 with button

screen shot 2017-10-15 at 00 32 20-fullpage


For people who want to develop the backend part: https://github.com/SISheogorath/hackmd/tree/feature/guestPassword

Also an interesting question: Should the password be visible or not? Includes the question: do we store the password for the note as a real secret (hashed password) or as plaintext password

SISheogorath avatar Oct 14 '17 22:10 SISheogorath

Hints for the backend implementation:

https://github.com/hackmdio/hackmd/blob/ca959012047bef3c0b2dd6f2974a8373a6615125/lib/response.js#L154-L158

https://github.com/hackmdio/hackmd/blob/ea9b1557f9834b2b140bd9b07488b5fca3953791/lib/realtime.js#L804-L811

https://github.com/hackmdio/hackmd/blob/ca959012047bef3c0b2dd6f2974a8373a6615125/lib/response.js#L20-L22

SISheogorath avatar Oct 15 '17 00:10 SISheogorath

I have a few questions regarding the backend implementation:

  • When the password gets send to the server (from the 403 page), it has to be checked somewhere. I would implement it as a noteAction (see below) https://github.com/hackmdio/hackmd/blob/ca959012047bef3c0b2dd6f2974a8373a6615125/lib/response.js#L366 Would that be okay or is there a better place
  • My first idea for saving the password during a session is to save it with a cookie. The key would be the node id, the value the password.

Would love some feedback on these questions

miterion avatar Oct 16 '17 16:10 miterion

It's actually a good question how to store or save the password during this time. I didn't really think about that right now.

In general, we should do this by passport as every other auth before.

https://github.com/antgraf/passport-localapikey <-- seems to be good and maintained

Our note password would be the API key in this case. Means, we need to implement the authentication strategy but not for the usual user accounts. This answers your question where to send the password. The usual /auth/<something> URL. I guess /auth/api would be fine.

I'm not sure if this works, but that's my idea for now.

SISheogorath avatar Oct 16 '17 18:10 SISheogorath

I had an idea on how to make this without another authentication mechanism:

When a user sends the correct password for a note to the auth system the note id could be saved in the users session (when the password is correct). This way, the system only has to check whether the requested note id is in this session variable and grant/deny access to it.

Could this be done or are there problems with saving this into the session variable?

miterion avatar Oct 17 '17 10:10 miterion

Sounds fine, too. Can you provide some example code? I'm not completely sure how the implementation looks like, feel free to surprise me ^^

SISheogorath avatar Oct 17 '17 10:10 SISheogorath

If you can make it to land a PR until end of next week I'll review and merge it to 1.0.0-CE. Otherwise this Feature goes for next release

SISheogorath avatar Dec 07 '17 11:12 SISheogorath

Please push it back to a later release, have a lot assignements at university right now

miterion avatar Dec 07 '17 15:12 miterion

@Miterion hey, how is it going? Still interested in doing this?

SISheogorath avatar Mar 07 '18 12:03 SISheogorath

@SISheogorath I do not think that I am able to work on this currently. If someone else wants to do it I would be really happy

miterion avatar Mar 09 '18 17:03 miterion

I feel this is also related to #138, perhaps this is a way to have some notes encrypted?

ccoenen avatar Sep 05 '18 07:09 ccoenen

Hi, are there any update on this feature, to protect certain pads by password? By the way, the current permissions, are mostly concerning edit permissions, only "private" states that only myself can view the pad. However the usecase for me is that I want to have a private pad, where only users with the password can view and edit, regardless if they authenticated/logged in or not. As I am using the service in a mass-installation (gwdg), I don't want to share some sensitive pads with the whole community.

mgoldau avatar Apr 22 '20 08:04 mgoldau

Hi, are there any update on this feature, to protect certain pads by password? By the way, the current permissions, are mostly concerning edit permissions, only "private" states that only myself can view the pad. However the usecase for me is that I want to have a private pad, where only users with the password can view and edit, regardless if they authenticated/logged in or not. As I am using the service in a mass-installation (gwdg), I don't want to share some sensitive pads with the whole community.

Absolutely agree with the suggestion!

This is a necessary feature, especially in large installations (k-range).

mz83ude avatar Apr 30 '20 11:04 mz83ude

+1

janit42 avatar Apr 30 '20 12:04 janit42

Also expressing interest in this.

alexpovel avatar Jul 30 '20 08:07 alexpovel

This feature is really necessary for me

VaalaCat avatar Nov 04 '20 13:11 VaalaCat

+1

asakura42 avatar Jul 16 '21 21:07 asakura42

+1

jmsjsph avatar Dec 23 '21 04:12 jmsjsph

+1

zubair1024 avatar Mar 18 '22 09:03 zubair1024