Optimizing Security Checks in Web Apps: Seeking Expert Advice

I have a series of security measures that I want to load and test on some random pages, perhaps on all pages. These tests must be conducted before other data is fetched in my app.

Currently, I have created a component that performs these security tests, and if everything is okay, the only thing that happens is that the page loads all data. However, if there is a problem, I redirect the user to a new page.

Is this the most optimal way to do this, or do you have a better solution?

Updated: I'm using Supabase.

7 replies