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

feat: allow to set password-protected notes #1481

Open
wants to merge 1 commit into
base: v4
Choose a base branch
from

Conversation

dynamotn
Copy link

@dynamotn dynamotn commented Oct 6, 2024

This PR resolve #637.

Demo

https://notes.dynamotn.dev/01_Fleeting-Notes/20240505093315 with password 123451
image

How it works

  • Key Derivation: Utilizes PBKDF2 for generating secure encryption keys.
  • Unique Salt for Each Encryption: A unique salt is generated every time the encrypt method is used, enhancing security.
  • Encryption/Decryption: Implements AES-GCM for robust data encryption and decryption.
  • Encoding/Decoding: Use base64 to convert non-textual encrypted data in HTML

@dynamotn dynamotn force-pushed the v4 branch 2 times, most recently from 5a27b0a to bdc09c9 Compare October 6, 2024 18:49
quartz/i18n/locales/nl-NL.ts Outdated Show resolved Hide resolved
quartz/components/renderPage.tsx Outdated Show resolved Hide resolved
quartz/util/encrypt.ts Show resolved Hide resolved
quartz/i18n/locales/nl-NL.ts Outdated Show resolved Hide resolved
@saberzero1
Copy link
Collaborator

While I think this solution is great in what it does, I wouldn't recommend relying on it to keep anything safe. This is mostly for two reasons:

  1. Requires a plain-text password value in the frontmatter. This is poses risks for man-in-the-middle attacks if pushing to GitHub over HTTPS.
  2. Cross Fork Object Reference attacks. Most users use a fork, private or not, to host Quartz.

Having said all that, I do think that your solution has value, as password-encrypted static site can only get about as secure as your solution without external tooling/authentication. I feel like the documentation should reflect that, and I feel like we shouldn't be recommending users to deploy encrypted secret company documentation or medical records in the documentation.

@aarnphm
Copy link
Collaborator

aarnphm commented Oct 8, 2024

I just want to quickly chime in. For Quartz itself, I don't see any sort of SOC-2 compliant or adjacent security folks would use for hosting private and internal documentation (though we live in a society).

This is still a good POC imo.

@dynamotn dynamotn force-pushed the v4 branch 3 times, most recently from a9e390b to 18ded6d Compare October 10, 2024 16:22
@dynamotn
Copy link
Author

@saberzero1 @aarnphm I updated documentation and put some recommendations from you

@dynamotn dynamotn force-pushed the v4 branch 3 times, most recently from 440d910 to 717f2e4 Compare October 10, 2024 16:31
Copy link
Collaborator

@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

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

tbh this can also just be kept as reference for ppl who wants to add this to there vault.

Personally I don't really find a wide usage for this.

@jackyzha0
Copy link
Owner

im happy to include it, we have quite a few reqs for this feature

been swamped the last few days but can do a quick review later

Copy link
Collaborator

@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

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

To keep minimal change, I suggest we do locale in separate PR as follow up.

We can add support for Vietnamese and English should be good to start with

quartz.config.ts Outdated Show resolved Hide resolved
quartz/components/renderPage.tsx Outdated Show resolved Hide resolved
quartz/components/scripts/decrypt.inline.ts Outdated Show resolved Hide resolved
@dynamotn dynamotn force-pushed the v4 branch 5 times, most recently from e567d97 to 9f53862 Compare October 13, 2024 09:20
@dynamotn
Copy link
Author

dynamotn commented Nov 6, 2024

How about this PR @jackyzha0? Do you want to change anything?

@leikoilja
Copy link

came here through the search.
@dynamotn, thanks for adding this feature - i'd find it super useful.
This is not to keep smth very sensitive, but just another layer of protection for a note that i dont want to be publicly available, tho would like to be able to access from my own automation. So big kuddos to you @dynamotn for building it elegantly 🔥

@jackyzha0, let's get it in please 🙌

@sanjeed5
Copy link

sanjeed5 commented Dec 1, 2024

Came here via searching for this feature. Thanks @dynamotn

My use case is: sharing some notes with friends, but I don't want it to be accessible to everyone. I understand that if someone really wants to, they can get through, but that's okay. Won't put anything that sensitive here.

Looking forward to this!

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.

Password-protect notes
7 participants