r/Backend • u/Fun_Moose_5307 • 4d ago
Standard server security measures
I've recently gotten into fullstack, after constructing an iOS app and looking to expand functionality into The Internet. I don't wish to give details on the project, however it involves large high-sensitivity databases and communication both from an administrator's frontend and the user's iOS app etc.
- An administrator signs up their organisation and connects an external service (which is given an ID, username and password to identify itself) which then POSTs the data to my server. The org. admin also is given a log list of pushes from the external service, as well as logs when a new user subscribes to the dataset.
- The app users can access parts of the data belonging to them, but not write.
- The administrator has a username and password.
- The app user's credential is linked to their email address, which is present in the database so can be used to determine their identity once verified.
- The app users do not use the web frontend interface. They interact through the app, which regularly pulls a filtered set of only that user's data to store locally.
- I'm using NodeJS and SQLite. And yes, I've hashed the passwords properly.
What are the standard security measures that I need incorporate into this type of database project—and then some? E.g, HTTPS, some form of database encryption.
That is to say, what are the industry standard security measures in a web application/server?
Edit: My usage of the word 'administrator' may be misleading. I mean that an organisation looking to use my software would nominate a person to administrate the org.'s usage of the software. Not an administrator within the team maiantaining the software.
Edit x2: Wonderful to see everyone building on each other's suggestions, filling in gaps others haven't addressed etc. Looks like an excellent community here!
4
u/Sylverio_Bezouaoui 4d ago
beyond TLS in transit and disk encryption at rest, focus heavily on your token lifecycle. since mobile apps stay logged in forever, youll want short-lived access tokens paired with refresh tokens that you can actually revoke server-side if a device gets lost
3
u/chmod777 4d ago
https://top10.owasp.org/2025/
2
u/sereikis 4d ago
test authorization with two organisations and two users: swapping a record ID or email in any request must never expose another user's data, and an external service's credentials must only permit writes to its own organisation. derive those permissions from the authenticated identity on the server, not from client-supplied fields; encryption at rest doesn't prevent an authenticated request from reading the wrong rows.
2
u/Ronin-s_Spirit 4d ago
Do you need the admin panel to be public or can you distribute it locally? Imagine a pice of fontend that isn't actually on the Internet so it can hold a secret key for signing requests.
1
u/Used_Criticism_4631 4d ago
Good that you are thinking about security early and already hashing passwords properly. Beyond HTTPS, I would add argon2id or bcrypt with login rate limiting, short-lived access tokens, and scoping every query by the authenticated user id on the server so app users only ever see their own rows. For the external service, per-service API keys that you can rotate beat a shared username and password. Are you encrypting the SQLite file at rest?
1
u/opportify 4d ago
Nobody's covered the email side yet, and since your app users are identified by email that's a big one. Verification and reset tokens should be random, single use, expire within 15 to 30 minutes, and get stored hashed like passwords. Rate limit code sends per email and per IP too. And give the same response whether an address exists or not, otherwise anyone can probe which emails are in a high-sensitivity database.
1
u/AdhesivenessFew8441 3d ago
One thing nobody mentioned yet is logs and backups, which is where a lot of leaks actually happen. Make sure your logs never include the data the external service sends or any tokens, only ids, and keep an audit log of what admins look at or change. And if you back up the SQLite file, encrypt the backup too, otherwise disk encryption on the server does not help much. Small SQLite tip since the external service writes while the app reads: turn on WAL mode, or you will get database is locked errors under load.
1
u/RandomPantsAppear 1d ago
Use UUID not autoincrementing integers in the DB. Can't even begin to explain the number of attacks that involve "increment this number" because someone didn't do auth right.
...of course do your auth right, this is a failsafe.