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

Add ability to encrypt entire folders with the same password for deployment #47

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

souramoo
Copy link

@souramoo souramoo commented Aug 19, 2023

A few small tweaks to extend support to non-Single Page Applications, i.e. the ability to encrypt an entire folder of html pages, with the same password, and then to publish these encrypted html files such that the user only needs to enter the password once to then access the whole site.

The intention is to act similarly to a JS-version of HTTP basic auth-like behaviour (i.e. assumes that the client holding the password is trusted [kind of needs to be for any of this to work!], and so the security model is intentionally broken in a very specific way to enable this - by storing the password entered in localStorage, along with caching the different k's based on the URL in localStorage).

The idea is to be able to use pagecrypt as a drop-in replacement for situations where HTTP Basic auth is not possible (e.g. Google Cloud Storage, S3, Github Pages), in order to prevent access from strangers stumbling across a website.

These patches also mean that different pages with different passwords hosted on the same server do not log you out of the other pages once you enter a password for another page (by storing the k values separately per window.location.href) (e.g. in the verify:test suite, logging into one page and then another, and then going back to the first page will not reprompt for the password again as happens in the current master branch)

@AtrusRiven
Copy link

Thanks for the initiative! Sounds like an important use case and your description seems to me very good (although I cannot evaluate the implementation). I'd like to use that in my use case.

@souramoo
Copy link
Author

souramoo commented Sep 1, 2023

Thanks for the initiative! Sounds like an important use case and your description seems to me very good (although I cannot evaluate the implementation). I'd like to use that in my use case.

You're very welcome! You can use this straight away from my branch at https://github.com/souramoo/pagecrypt (upon which this pull request is based).

I have added some usage instructions for this use case in the readme file there, i.e. assuming a source folder src and an empty folder dest in the current working directory:

PASSWORD=hunter2
dir=$(pwd)
cd src
find . -name "*.html" -print -exec npx pagecrypt {} ${dir}/dist/{} ${PASSWORD} \;
cd ..

Will produce the encrypted version of the website in dest/

@AtrusRiven
Copy link

Thanks, sounds great. But I don't seem to get it running. I have created two folders src and dist. The site to be encrypted is located in src. I installed via npm i -D https://github.com/souramoo/pagecrypt/releases/download/6.2.1/pagecrypt-6.2.1.tgz. If the code block you provided is meant for CLI it does not work properly for me (the CLI complains...). Would you be so kind and provide a more detailled instruction for working with your implementation? That would be great. Thanks a lot!

@souramoo
Copy link
Author

Sure, what errors do you get?

@souramoo
Copy link
Author

bump @Greenheart

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.

2 participants