News for hackers. Stuff that matters.
Re:Show HN: Password-protect a static HTML page by fredsted on Wednesday June 14, 2017 @01:34PM (#14554385)
Encrypted page includes javascript from 2 CDNs, one for jQuery and one for "crypto-js". The jQuery one has an integrity hash, but "crypto-js" does not. Granted, they both use HTTPS...

Doesn't seem very secure to include external JS on an encrypted page.

Why not include those things inline?

And why does it need jQuery for a simple 1-input form field that decrypts a string?!

Re:Show HN: Password-protect a static HTML page by acdha on Wednesday June 14, 2017 @01:44PM (#14554477)
Using a CDN is only a problem if it's compromised, which is unlikely to be a threat for most applications. You can avoid this entirely by using Subresource Integrity:

https://developer.mozilla.org/en-US/docs/Web/Security/Subres...

It looks like the developer for this page copied the CDNJS links at some point but didn't do so consistently and later commented out the SRI portion of the jQuery tag:

    <!--integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="-->
Re:Show HN: Password-protect a static HTML page by yoble on Wednesday June 14, 2017 @02:27PM (#14554838)
Oops thanks, that should be fixed - the generating page now gets its libraries from CDNs.

I'll probably look into adding Subressource Integrity checks for the other two as well.

Re:Show HN: Password-protect a static HTML page by joshu on Wednesday June 14, 2017 @02:56PM (#14555095)
It is also a threat if your DNS is compromised.
Re:Show HN: Password-protect a static HTML page by a3_nm on Wednesday June 14, 2017 @05:28PM (#14556266)
Not when fetching over HTTPS.
Re:Show HN: Password-protect a static HTML page by snakeanus on Wednesday June 14, 2017 @06:27PM (#14556605)
The CA system is extremely broken, it won't protect you from a state actor. Also TLS + DANE is useless if the DNS is compromised.
Re:Show HN: Password-protect a static HTML page by acdha on Wednesday June 14, 2017 @07:22PM (#14556800)
That's a bit too much hyperbole to be useful: yes, a state which runs a trusted CA is a threat (at least for sites which don't use key-pinning) but there are a ton of other things you're at risk for that way like SMS-based auth and the police or black bag squad paying you a visit. Describing the CA model as extremely broken because it doesn't handle an out-of-scope threat doesn't help anyone change their behavior to avoid it.
Re:Show HN: Password-protect a static HTML page by pc86 on Wednesday June 14, 2017 @01:45PM (#14554491)
Stack Overflow is riddled with questions from people asking how to do incredibly basic things "in jQuery."
Re:Show HN: Password-protect a static HTML page by wlesieutre on Wednesday June 14, 2017 @02:05PM (#14554663)
I think this one is satire, but you never know ;) http://i.imgur.com/Q3mkcnl.gif
Re:Show HN: Password-protect a static HTML page by Already__Taken on Thursday June 15, 2017 @06:51AM (#14559235)
Werry_Togan is an excellent username haha. There's a lot of subtlety to this.

https://en.wikipedia.org/wiki/Terry_Wogan

Re:Show HN: Password-protect a static HTML page by egeozcan on Wednesday June 14, 2017 @03:02PM (#14555158)
I especially like the creativity in the "related questions".
Re:Show HN: Password-protect a static HTML page by Cyphase on Thursday June 15, 2017 @01:57AM (#14558205)
"How can I use JavaScript to parse some HTML using regex?"

Priceless.

Re:Show HN: Password-protect a static HTML page by johnsonjo on Thursday June 15, 2017 @11:08AM (#14561072)
There's one that says "Where are my legs?" Took me a second to get but I think it's a reference to head and body in HTML.
Re:Show HN: Password-protect a static HTML page by steveadoo on Wednesday June 14, 2017 @03:04PM (#14555175)
That is definitely satire.
Re:Show HN: Password-protect a static HTML page by enobrev on Wednesday June 14, 2017 @02:35PM (#14554901)
My highest rated answer on Stack overflow, by an enormous margin, is a simple jquery question (How to get the value of a textarea).
Re:Show HN: Password-protect a static HTML page by pc86 on Wednesday June 14, 2017 @03:12PM (#14555232)
Is the answer "you don't need jQuery for this"? :)
Re:Show HN: Password-protect a static HTML page by yoble on Wednesday June 14, 2017 @02:21PM (#14554785)
I like the idea of the page relying as little as possible on my code (you have a better chance to trust a well known public CDN on HTTPS than some minified code inlined from an unknow github repo).

But I understand your point, plus it would be nice to have a page working completely offline. Will add the option to embed the needed library in the single file.

It definitely does not need jQuery :) The page was a POC, since it seems it might be useful to some I'll clean it up. Thanks for the feedback !

Re:Show HN: Password-protect a static HTML page by johnhenry on Wednesday June 14, 2017 @02:08PM (#14554693)
I don't mean this to sound sarcastic, but you seem to be knowledgable enough to make a pull request to the open source project?

[Edit: looks like this may already be on the way to addressing your issue https://github.com/robinmoisson/staticrypt/issues/1]

Re:Show HN: Password-protect a static HTML page by onion2k on Wednesday June 14, 2017 @06:05PM (#14556481)
Embedding the crypt.js library in the resulting page would essentially pin the page to the version that was current at the time the HTML was encrypted. That could be problematic if there's a bug in the library.
Re:Show HN: Password-protect a static HTML page by TeMPOraL on Wednesday June 14, 2017 @06:59PM (#14556711)
OTOH it makes the HTML file require an Internet connection to view.
Re:Show HN: Password-protect a static HTML page by sodafountan on Wednesday June 14, 2017 @04:24PM (#14555831)
While it's true that jQuery is unnecessary, why does it matter? For one this is just a simple example to show off something cool that's possible that many people wouldn't initially think would be, I highly doubt that this is meant to be used seriously but more importantly it re-writes the entire page once the passphrase is found which overrides the jquery dependency and all other dependencies.

Why do people like to complain so much?

Re:Show HN: Password-protect a static HTML page by Gaelan on Wednesday June 14, 2017 @10:36PM (#14557545)
jQuery stays in the JS namespace even after its <script> is gone.
Re:Show HN: Password-protect a static HTML page by sodafountan on Thursday June 15, 2017 @09:43AM (#14560246)
You're right, I looked back and it does in fact stay in the namespace.

Disregard my comment.