Neat Technique For a (sort-of) Unforkable Repl

So, I came up and made this concept into a repl, and it works surprisingly well.
I have a 64-digit code, and I put it in as a secret. I then hid some code among core module files (of which there are several hundred python files in) and hid some code in several of the files. When the repl starts, if the secret doesn’t match a certain value, it deletes all the files. Though it’s technically doable to get it working still, most people won’t spend the time to scan several hundred files (which can contain tens of thousands of lines of code).

All in all, a fairly neat solution :slight_smile:

4 Likes

What if you just don’t start the Repl, and dig through the files?

Then no one can use it at all, Secrets only exist for your end of the Repl. (Cover page will shred itself too)

3 Likes

Then I can call it from a replit db instead ig.

2 Likes

That also doesn’t exist for anything but your end of the Repl, unless you put the URL to the DB in your code, or use a DB proxy. both methods which make it easier for someone to get the code.

3 Likes

Then is there a good way to verify the following?
A. The working user
B. The repl owner

1 Like

The REPL_OWNER secret/env var.

No, though you could check if it’s in the cover page or not.

2 Likes

see:
https://docs.replit.com/programming-ide/repl-env-metadata

2 Likes

Which env is that lol for the cover page

1 Like

For the cover page? It’s a function @bigminiboss wrote:

2 Likes

In my opinion this doesn’t work. The best you can do is use a server verification link in which you send someone to a website where you do a captcha and check the owner using replit auth and send the info back that way

2 Likes

When forking a repl, do the keys in the database copy over?

2 Likes

no they do not. However, any cover repl is forked so keep that in mind. That is, every time a repl is run, it is forked and put into a temp VM that gets deleted

4 Likes

Hold up… Then how do systems like highscore work? I thought the cover repl’s use the same database?

2 Likes

they don’t work like that. They send a https request to a global server which stores the scores. Otherwise, if it’s a repl that uses deployment THEN the db is global otherwise it needs an external server

3 Likes

So how can I track if it’s a main fork or not. I was thinking I could use the db to store a key or something, but clearly that’s not true.

1 Like

yeah sadly you can’t. You can know if it’s the cover repl or not but you can’t actually let it run normally on the cover page because replit doesn’t want to spend the afternoon adding proper security or even just deleting env vars after run + give some global ones ;-;

1 Like

If you want to authenticate a user from a console repl to an external leaderboard, you should use repl identity, that way you can ensure that a request came from an account. You have to use an external leaderboard, because replit ‘ghost forks’ non-server repls.

2 Likes

I don’t want to force them to login though, I’d rather just autocheck

1 Like

Repl identity is autocheck

I thought it requires you to sign in though?

1 Like