lus / pasty

pasty is a fast and lightweight code pasting server
https://pasty.lus.pm
MIT License
201 stars 29 forks source link

Custom share codes #55

Open zekroTJA opened 1 year ago

zekroTJA commented 1 year ago

It would be awesome if you could define a custom code for a created paste.

I think a good way to implement this would be to set an alias which points to the original paste, which still has the ID. This way, the custom code can be changed via the modification key.

lus commented 1 year ago

Hello. I thought about this a bit and I see several ways this can be exploited:

I would feel more safe if we would implement this feature but restrict it to admins only. Only admins can create and manage share codes that link to specific pastes, the public instance would very rarely provide these codes unless a trusted user requests them.

What do you think about this? Do you have other ideas on how to keep the risk of this as low as possible?

zekroTJA commented 1 year ago

Sure, didn't really thought about this beforehand.

To combat these issues, I would implement the following guardrails:

Also, the following options could be considered, but are not necessary.

That would be my idea. Just implementing the feature and locking it for a specific group of users all together would be a bit pointless in my opinion. But feel free to express your thoughts about these suggestions. :)

lus commented 1 year ago

Thank you for your thoughts.

I am still not sure whether I want users to be able to freely create such vanity URLs, I just think the potential of misuse is a bit too big. No other pastebins have this feature open to the public as far as I am aware and if we would do this, we should think twice about how we do it and how to protect it. I like your ideas on how to minimize the risks and I think there really is no other way that would align with the philosophy of this project, but in the end pasty is deployed by many users other than me and distributing a steadily expanded blacklist of vanity URLs across all of them could become quite a tricky task. I really like the feature though, so I am not going to deny it, but rather postpone its implementation. Maybe I can implement the admin-only version in an earlier version and carefully think about a public-ready version in the future.