How to keep user from manipulating URL?

I have a repeating group that shows a list of user profiles within a reusable element. When a specific record is selected, that RE profile shows the record via slug parameter. I want to keep my users from editing the URL to show another record - basically I want to redirect back to the current record or show an error message if they try to manipulate the URL.

This isn’t necessarily a privacy matter, but a user experience matter. I tried setting the state of the page to the selected profile on page load, but I think the state is getting cleared when the slug parameter loads, so I can’t show the error message by comparing the current page state to the current slug parameter. Any ideas?

I’ll use “client” as the example data type here with a field in client called “user” for who the “client” belongs to.

“Do only when” workflow. Do only when do search for “clients” constrained by user “ current user & ID = get data from url ?client:count is 0.

Run workflow to either send back to client list or search.

They can still manipulate to view their own clients but if the ID isn’t there’s then it’ll redirect. (This is to be stacked with privacy rules)

my search results will be displaying potentially hundreds of results that the user has no relationship with, so I’m not sure that will work for me

The results will be constrained by user = current user so it shouldn’t. (Or a similar style of what they should have access to)

Also, that’s where privacy rules come in. The server should NEVER return anything not affiliated with the current user.

Privacy rules are equally as valuable for security as they are for search/app speed at scale.

Ex) if you have 10,000 users with 1M records of let’s say “messages” in your database without any privacy rules when you do a search on the server or client side it’ll search all 1M that fit in your search constraints.

But if you have privacy rules saying “messages” user is current user and that user only has 300 messages then the server won’t need to search 1M records based on your constraints rather only search and return from those 300 based on your constraints.

Data searches work something like this:
1: privacy rules server side
2: search constraints
3: filters
4: advanced filters

Meaning the further you can cut down the lists in the lower steps the faster the later steps will run.

2 Likes

If you’ve set a data type for that parameter, you can compare it. I’m guessing you’re using text as the current data type.

If that’s the case, whether there’s a slug or not won’t make a difference because it will have a data type assigned to it.