Earlier quoted context omitted.
A static site generator can be used to create an .html file that's dependent on the user to execute a javscript web application to show the content. That makes that generated page dynamic. It doesn't change the nature of the static site generator.
What if the user uses curl to view the page. Is it now static?
Password protect a static HTML page
281–290 of 294 posts
Re: Password protect a static HTML page
#282Then could use basic auth to protect access from outside and a tool like this to protect access from inside.
Re: Password protect a static HTML page
#283My recent solution to this problem -- for an entire static site -- was to use HTTP Basic authentication with CloudFlare Pages: https://github.com/garrison/cloudflare-pages-shared-password
I was digging through the comments for someone to point this out. I’m honestly curious why people are using these overly complex options when a solution has been built into the HTTP standard for decades (and, in fact, is heavily abused for many APIs). And it’s superior in many ways, since the file is never delivered until authentication has been completed.
Re: Password protect a static HTML page
#284Earlier quoted context omitted.
Exactly. I don't know where the confusion is, but I'm saying that it doesn't matter how the page is generated. It is sent to the website visitor as just HTML. When the user views it it is all there, just html. No changes. For example, I have a perl script that generates a set of .html files every night to show new additions to my library. They are static .html files on disk and never modified before the user views th…
Everyone is allowed to give their own meaning to words, but you can't expect to just change a widely agreed meaning to match it. "Static" means it is just a set of files. Not that the page is stationary. Do you think that a blink tag in a HTML page makes it non-static? A hover effect? An :after pseudoelement in CSS? If your perl script is saving the HTML to the disk, then yeah, your website is static. If it's generat…
Re: Password protect a static HTML page
#285Gad! I have spent all morning trying to --- password protect a static html page. How in the hell does HN have a story about the exact topic I've been struggling with appear just a dozen or so hours after I started working on it. Wow. I was _extremely_ happy to see this posted. However when I click the link I am taken to the library I had initially tried and had to reject. Without getting into the crypto side of thing…
Re: Password protect a static HTML page
#286I just finished building a similar tool: https://utiliti.dev/private-note/ Currently it’s just for plaintext, but might allow for more complex things like the website. The password is stored in the url after the # so it’s never sent to the server. I was going to post this project after I build some more utilities.
Is the note supposed to self-destruct even when it's attempted to be opened with incorrect data in the URL hash? (so it hasn't actually been read yet)
Re: Password protect a static HTML page
#287I just finished building a similar tool: https://utiliti.dev/private-note/ Currently it’s just for plaintext, but might allow for more complex things like the website. The password is stored in the url after the # so it’s never sent to the server. I was going to post this project after I build some more utilities.
It will leak all over browser's history, though.
Re: Password protect a static HTML page
#288Can someone explain a bit more how “remember me” works? If symmetric encryption requires a “key” to decrypt - one might expect that you will need to store that key to auto-decrypt. But here it claims that the key is stored salted and hashed. But to auto-decrypt - you need to reverse that salt and hash because you need that key back. How would that work?
The passphrase+salt get hashed. This hashed-passphrase is what decrypts the file. You can store the hashed-passphrase in local storage. This means you can auto-decrypt again. You don't need the original passphrase. If bad guys get your computer, they can read the file. However, they cannot trivially work out what your original passphrase was, so it protects you a little if you reused your passphrase elsewhere.
Re: Password protect a static HTML page
#289Earlier quoted context omitted.
I designed a similar tool with that threat model in mind: the resulting HTML/JS is as minimal as possible so it’s possible to inspect before entering the password. Of course assumes safe browser and client machine.. https://github.com/dividuum/html-vault
Kind of possible. With enough content, would you actually spot a "}; and some highly obfuscated code in the middle of the blob? (My guess is a no)
Re: Password protect a static HTML page
#290Earlier quoted context omitted.
But then it's not self contained and every time you want to access the archive you also need a program that can decrypt/encrypt that format. Using a self-contained HTML file means it's currently the most portable way to encrypt something and have it available anywhere you can get the file on. By the way, I don't advocate for this idea. But still, I find it a pretty ingenious way to store encrypted data portably. Esse…
> you also need a program that can decrypt/encrypt that format that's just a self-extracting archive, which is a very common idea and easily created as well (very popular with both shareware distribution). The problem is that you have to trust the extracting code to not install anything else malicious. The browser provides the perfect sandbox - you cannot install malware into the system via javascript in the browser,…