this post was submitted on 19 Jan 2024
10 points (72.7% liked)

Web Development

3434 readers
1 users here now

Welcome to the web development community! This is a place to post, discuss, get help about, etc. anything related to web development

What is web development?

Web development is the process of creating websites or web applications

Rules/Guidelines

Related Communities

Wormhole

Some webdev blogsNot sure what to post in here? Want some web development related things to read?

Heres a couple blogs that have web development related content

CreditsIcon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 1 year ago
MODERATORS
 

Is there a way to develop and website using JS (and perhaps PHP) to create an E2EE website. Were all packets sent between the server and the userw device are E2EE, wrapped in a layer of encryption?

I know there is HTTPS but I am looking for something stronger than HTTPS.

By using some JS or PHP E2EE package, would I have to write or structure the website code very differently than you normally would?

you are viewing a single comment's thread
view the rest of the comments
[–] trymeout@lemmy.world 0 points 9 months ago (3 children)

I may at times only have access to HTTP only (No HTTPS) which is one of the reasons why I want another form of encryption.

Encryption with most VPNs are more secure than HTTPS. Yes, the connection between the VPN server and the web server is not encrypted with the VPN and only HTTPS. However the encryption between the VPN and personal device is superior, not because it is relayed. My understanding is that HTTPS is "secure" for basic use, just like Windows 11 is secure. But not secure from five eye agencies unlike VPNs and other like systems like Tor and I2P.

My goal is to have a user connect to a web server and have it not possible for the web server to know what is going on, nor can anyone snooping the packets in transit know what is going on. Not know the HTML structure, form field data, etc.

[–] Max_P@lemmy.max-p.me 4 points 9 months ago

That's a completely different use case then, and the solution is Tor, proxies, ShadowSocks, vpn-ws.

But if you can't HTTPS, it's weird that you'd be able to do a VPN in the first place. HTTP only is super rare outside of China, and most places HTTPS would be blocked, VPNs are even more blocked

I mean technically you could encrypt most of the stuff client-side but you have to keep in mind the browser loading JavaScript over HTTP is still insecure and it would be easy to modify the script to also send the key to your attacker. There's nothing you can do that would be better than what the browser can do.

The only way to make it safe is to not have a web application. The code must already be on your device in a state you trust to be able to trust anything else that depends on it.

An easy fix might be to configure your browser to use your server as a plain HTTP proxy, which will issue CONNECT commands for HTTPS automatically, and now you're in HTTPS world and you're good.

[–] JakenVeina@lemm.ee 2 points 9 months ago (1 children)

You're really kinda conflating a bunch of different problems here, so I think you need to focus down what you're really interested in accomplishing.

I may at times only have access to HTTP only (No HTTPS)

If you don't have access to HTTPS, you can maybe make something to fill that gap through JS, but it's gonna involve hijacking and re-implementing MOST of the functionality of the browser. There is almost certainly a more-effective solution to solve the lack of HTTPS.

My understanding is that HTTPS is "secure" for basic use ... But not secure from five eye agencies

I think the point you're trying to get at here is that the encrypted connection is only as secure as its endpoints. Traffic encrypted over HTTPS is no less "secure" in itself than traffic over a VPN, but the security ends at the HTTP server, and you may or may not trust the owner of that server to keep your data secure from outside parties. There really isn't any difference between an HTTP server and a VPN server in this context, except that VPN providers tend to care about privacy more than general-purpose web host providers, because that's kinda the selling point of VPNs for most people. A VPN provider could still be vulnerable to a legal request to collect and/or hand over data they have on you.

My goal is to have a user connect to a web server and have it not possible for the web server to know what is going on

Sure, you're basically describing an E2EE messaging app, and this is different than HTTPS and VPNs, because the server sitting between two clients isn't an endpoint of the encryption, only the two clients are. Private keys are stored on client devices, public keys are exchanged, and all "data" moving out of the client is encrypted to be only decryptable by the client intended to receive it. The server doesn't have any of the private keys, so can't decrypt anything.

nor can anyone snooping the packets in transit know what is going on

This is what HTTPS and VPN connections provide already.

Not know the HTML structure, form field data, etc.

In theory, you could accomplish this by delivering an initial payload of a mostly-empty HTML document, and some JS capable of bootstrapping an encrypted "connection" to the server, using only low-level browser network APIs. You likely wouldn't be able to encrypt most of the traffic, just the HTTP data payloads. Once the initial "connection" is established, then the server delivers the rest of the app itself, mainly JS SPA that renders everything locally.

In practice, you've basically just re-invented HTTPS, but worse.

[–] Max_P@lemmy.max-p.me 4 points 9 months ago

And it's useless anyway because if the connection is unsafe, the script that does the client side encryption is already assumed compromised as well. It could be altered in transit to use a weak or known key. Or send back the keys to the attacker.

[–] Lmaydev@programming.dev 1 points 9 months ago (1 children)

Why do you only have access to http? Knowing that would help guide answers.

[–] trymeout@lemmy.world 0 points 9 months ago (2 children)

I may not have a domain name, and therefore no HTTPS, just HTTP only and can only connect by knowing the IP address and port number.

[–] Lmaydev@programming.dev 1 points 9 months ago* (last edited 9 months ago)

I feel like you should just use a reverse proxy tbh.

Is it internal? Because otherwise this is a super bad plan

[–] towerful@programming.dev 1 points 9 months ago

And you cant use self signed certificates because?
They provide the same level of encryption. The benefit of a domain and a trusted CA issued cert is that browsers/os will automatically trust that the server is who its said it is (ie you dont get a warning).

But if you import your servers root CA to your OS, then your OS (and browser) will automatically trust any cert issued using that root cert, thus you dont get a warning.

With or without a warning, it will still encrypt at TLS1.3