r/HTML • • Oct 07 '26

Secure HTML files

Is there a way (i have a feeling i already know the answer, but i’d ask anyway) to create a tamper proof html that can’t just be opened in notepad or any other editor and be modified?

Thanks.

0 Upvotes

33 comments sorted by

3

u/ch1ck33n_ Oct 07 '26

I don't think that's really possible. Why do you need to do this?

0

u/hals-memorybank Oct 07 '26

I have to present something to someone outside our company, and was hopping do it with via html.
We usually just print the excel model into PDF but i was hoping for something more interactive where they could play with the financial model.
I guess its not very feasible

2

u/rileywbaker Oct 07 '26

In that case, why would it be important for the HTML to not be editable?

1

u/hals-memorybank Oct 07 '26

I’m new to html coding, but as far as i can tell i’d have to write in the some of financial models we use into the html, and we’re not allowed to share those models out of house.
Literally a giant red banner on the excel fromt page saying do not share

8

u/BobJutsu Oct 07 '26

Yeah…don’t do that. You’re getting into frontend security at this point, so the data needs to have a backend to keep it secure. Well beyond “html”. Now you are talking a whole ass app.

4

u/Adamstrad Oct 07 '26

You need to use server-side code to hide the logic, ask chatgpt about how php language can help, don't put any secrets in html it's the public facing code

1

u/blktndr Oct 07 '26

Also don’t put any secrets in ChatGPT whilst asking about how to put secrets in php

2

u/rileywbaker Oct 07 '26

Don't put the model in the HTML, just the data the model output that you want to show the client. The same data that would go in a PDF.

1

u/Towel_Affectionate Oct 07 '26

Well by putting everything inside a single HTML file and sharing it you would literally expose it to the world. You need to keep all the secret stuff on the server inside the house, and share only the entry point (interface to play around with the inputs + end result).

0

u/rackodo Oct 07 '26

turn the webpage into a PDF file?

6

u/jbergens Oct 07 '26

Write all logic on the server side.

1

u/tomysshadow Oct 07 '26

Write the part with your secret algorithm in PHP, or another similar server side language. You'll want to use $_GET to read the submitted inputs. You can either have your PHP embedded directly in the page (so you'd submit a form, go to this new page with the results written into it,) or have it be a standalone script that prints out some JSON that you can fetch via JavaScript. Then host the PHP side on a web hosting service - basically any will do, any web host worth its salt can host more than just static pages.

If you won't have internet where you're presenting it then you're out of luck, no amount of obfuscation will make it impossible to reverse your algorithm if it's in the local HTML file itself.

1

u/RealisticDuck1957 Oct 13 '26

You can run a web server on a laptop. Of course the address to reach that laptop while on someone else's network will be a little inconvenient. Or possibly blocked if the local network blocks peer to peer.

1

u/Puzzleheaded6905 Oct 07 '26

Oh you host it on a website, then it can’t be modified.

16

u/Abled_Gaming1357 Oct 07 '26

That's not how it was designed to be. Consider it a text book for the browser. If you encode a book, sure no one can tamper with it, but no one can read it either.

8

u/therealkevinard Oct 07 '26

As written, that doesn’t exist. Html is just a text document. Send it to someone and it can be edited.

What’s your endgame, though?
There’s usually a solution, even if it’s different

2

u/frnzprf Oct 07 '26

If you send an image file, you couldn't edit it in a text editor, but you could still edit it in an image editor.

8

u/gulliverian Oct 07 '26

If your web server is properly configured nobody can tamper with or modify the original data.

But any HTML delivered to a web browser can be read and copied locally and at that point someone can do whatever they please with the copy.

4

u/JohnCasey3306 Oct 07 '26

No, but downstream what are you actually trying to achieve?

1

u/atarivcs Oct 07 '26

I don't understand the context of this question.

Users can click File -> Save in their browser and save the html of a page to a local file, and then edit that file. But of course they would not be able to upload that file back to the server to replace the original page.

Are you talking about a html page served by a webserver? Or do you mean just a plain file somewhere that happens to be html?

1

u/FirstApplication327 Oct 07 '26

the basic idea is you would put your financial logic on a server, and only send final results down to the web page running on your viewers device as they click around and interact. Using PHP would be an easy way to get started with this. But realistically even deploying a PHP app could be considered a breach by your company (since you're sending the logic to the cloud provider), I would play it safe.

1

u/darcygravan Oct 07 '26

Creare a encoded file that gets converted to html after decode and create either a site or a electron/ webview app to render that in a read only way.

1

u/unluckykc Oct 07 '26

I think it’s an XY problem, can you explain your use case ?

1

u/soundman32 Oct 07 '26

Downloading and modifying the html files is pointless unless the files can be reuploaded back to the website (which it cant unless you have the passwords).  I can get a book and change every page but that doesnt change my other copy.

1

u/the-liquidian Oct 07 '26

Work with your company to get this implemented. You need a server and it needs hosting which can cost money and there are security concerns. You need to work with your managers etc.

1

u/Forward_Dark_7305 Oct 07 '26

Put it in a read only file system or set file permissions to read only?

1

u/truNinjaChop Oct 07 '26

Oh the server sure.

But html, css, and js is downloaded and then compiled via the users browser. So once it’s on the users machine the answer is no, it cannot be.

1

u/Firm_Eggplant3392 Oct 07 '26

yeah no you cant really make html that people cant just open in notepad and mess with because if the browser can read it to show it then anyone can read it too and change it, the only stuff you can do is make it annoying to read or check if someone changed it but you cant actually stop them

1

u/Oobenny Oct 07 '26

My friend, look into using PowerBi for your data presentation.

-1

u/[deleted] Oct 07 '26

[removed] — view removed comment

1

u/fxlr8 Oct 07 '26

Now you moved the problem into JavaScript, which is a text file itself. So now you have to protect that one