lab built Aug 2025, revisited Dec 2025 8 min read

Restaurant Management System

A secure web app that passed its security checklist, and the five holes a later review found

status
Coursework, Aug 2025. Revisited Dec 2025, fixed later. Not deployed.
role
Led it: the access control, authentication, password policy and audit log
stack
  • python
  • django
  • sqlite

For Secure Web Development (ITSECWB) at De La Salle University, I led a restaurant ordering app built around its security, not its screens: three roles, account lockout, re-authentication for risky actions, a password policy and an audit log of every success and failure. It was graded against a checklist of security controls, and every item had code behind it. A later review found five holes the checklist never asked about, including one that let any customer delete anyone’s order.

Status: coursework, built August 2025 and revisited December 2025; reviewed and fixed later. Not deployed and has no real users.

What it is
a Django web app where customers order, managers run the menu and orders, and administrators manage accounts and read the audit log.
Built for
Secure Web Development (ITSECWB) at De La Salle University. Graded against a security checklist.
The focus
security controls: access by role, authentication, passwords, sessions, validation, logging.
What the review found
any customer could delete anyone's order; a link alone could delete one; the password rules never ran; security answers could be guessed forever; a link could pass through the site to a fake one.
Now
all five fixed, each with a test that failed before the fix. 15 security tests pass.
My part
I led it: the access control, authentication, password policy and audit log.

What it does

A restaurant ordering system with three roles. Customers register, browse the menu and place orders, which they can edit or cancel while the order is still pending. Managers run the menu and move orders through the kitchen. Administrators manage accounts and roles, and read the audit log. The screens were never the point. The course was about what happens when someone tries to do something they shouldn’t: see another customer’s order, give themselves more power, or guess their way into an account.

Action Customer Manager Administrator
Place an order yes
See orders own only all all
Edit or cancel an order own, while pending all all
Move an order to preparing, completed or cancelled yes yes
Add, edit or delete menu items yes yes
Change a user’s role yes
Read the audit log yes

The controls

Every request passes the same checks, in the same order:

What every request goes through: are you logged in, does your role allow it, is it your own order, and for risky actions, did you confirm your password in the last 5 minutes. Only then does it happen, and it is logged. Before the fix, deleting an order skipped the own-order check.Someone asks to do something1Are you logged in?If not: sent to the login page.2Does your role allow this?If not: refused, and the attempt is logged.3Is it your own order?If not: “not found”, and the attempt is logged.Hole 1: deleting an order skipped this check.4Password confirmed in the last 5 minutes?Risky actions only. If not: asked for it again.It happens, and it’s logged
The checks every request passes, in order. The dashed check is the one the order-deletion page skipped before the fix.

Each of these maps to an item on the course checklist:

  • Each role sees only what it’s allowed to. Every page checks who’s asking before doing anything. A customer who asks for someone else’s order gets the same “not found” as an order that doesn’t exist, so the answer doesn’t even reveal that it’s there. The last administrator can’t be demoted, so the system can’t lock itself out.
  • Orders only move forward. Pending to preparing to completed, or cancelled before it’s done. Any other move is refused and logged.
An order's life: pending, then preparing, then completed. From pending or preparing it can be cancelled instead. Any other move is refused and logged.pendingpreparingcompletedcancelledAny other move, like completed back to pending, is refused.
An order only moves forward. Managers and administrators move it; a customer can withdraw it only while it is pending.
  • Too many wrong passwords lock the account. Five failed logins lock it for 15 minutes. The error never says which part was wrong, the username or the password.
  • You see your last login. After logging in, users see their last login or last failed attempt, so they can spot someone else trying their account.
  • Risky actions ask for your password again. Changing a role, changing a password, moving an order and deleting orders or menu items all need the password re-entered within the last 5 minutes, so an unattended, logged-in screen can’t be abused.
  • Strong passwords, stored safely. At least 8 characters with upper case, lower case, a number and a symbol; common and all-number passwords refused; the last 5 can’t be reused; and a password must be a day old before it changes again. Passwords are stored scrambled (salted hashes), never as written.
  • Account recovery. A security question, chosen from a fixed list, with the answer stored scrambled like a password. The reset page never says whether a username exists.
  • Every input is checked twice. Forms check every field, and the database itself repeats the important limits (an order line holds 1 to 100 of an item; a price stays between 0 and 999,999.99).
  • Everything is written down. Every login, failure, role change, order change and refused action goes into an audit log with the user, time, network address and browser. The address comes from the connection itself, not from something the visitor could fake. Only administrators can read the log.
  • Logins don’t linger. Sessions end after 30 minutes or when the browser closes. The login cookie can’t be read by scripts and only travels over secure connections outside development, and no other site can show the app inside its own page.

What the checklist checked, and what it didn’t

A checklist asks whether each control exists: is there a lockout, a password policy, a role check. It doesn’t ask whether every path through the app goes through them. Every item on ours had code behind it, so it passed.

In December 2025 I went back to document the security logic, and started wondering whether it held up beyond the checklist. When I finally checked, with an AI assistant reviewing my code, it found five holes the checklist never asked about. I confirmed each one with a test that failed on my code, then fixed them and kept the tests.

The five holes

# Hole Why it mattered Fix
1 Any customer could delete any other customer’s order, just by changing the order number in the address The check only stopped owners deleting orders that weren’t pending. Everyone else fell straight through to the delete. Only the owner or a manager can delete; anyone else gets “not found”, and the attempt is logged
2 Just opening the delete link deleted the order Another website could hide that link in an image, and visiting that site while logged in would delete the order (cross-site request forgery) Deleting needs a submitted form; opening the link only shows a confirmation page
3 The password rules never ran They were set up correctly, but the register, change and reset pages checked passwords their own way: length only, plus reuse on two of them All three now use the same rules
4 Security answers could be guessed forever Login locked after 5 tries; the reset question didn’t 5 wrong answers lock the reset for 15 minutes
5 A link could pass through the site to any other website After asking for your password again, the page went wherever its link said, so a phishing link could borrow the real site’s name It only goes to pages on this site

The first one, as it was:

is_staff = _is_manager(request.user)
is_owner = order.customer_id == request.user.id

if is_owner and not is_staff and order.status != "pending":
    ...  # refuse
order.delete()  # everyone who isn't the owner reaches this line

It reads like an access check. It only checks owners.

Testing turned up one more problem. The custom error pages, which the checklist counted, sat in a folder Django never searched, so with debugging off every error page would have crashed into a bare server error. Fixed, with a test.

How I checked

For each hole, I wrote a test that tries the attack: another customer sends the delete, a plain visit opens the delete link, a weak password goes into registration, a sixth wrong security answer arrives, the password page is handed an outside address. Those 7 failed on the original code, and so did an 8th, for the error pages. After the fixes all 8 pass, alongside 7 more that check the app still does what it should. That’s 15 in all, run from a fresh install with no database.

Fifteen security tests. On the original code, 7 pass and 8 fail, one for each problem found. After the fixes, all 15 pass.Original code: 7 of 15 passAfter the fixes: 15 of 15 passpassesfails: a problem is still there
Each square is one test. The 8 that failed on the original code each try one of the problems the review found: the five holes, plus the error pages.

The tests stay in the repository, so none of these holes can quietly come back.

What I’d do differently

  • Test the paths, not just the controls. For every view, ask what happens when the wrong role calls it. The deletion hole would have shown up in the first such test.
  • Configure a rule once, and make every path use it. The password policy existed and was correct. Three pages simply didn’t call it.
  • Run it the way production would, with debugging off, before calling the error handling done.
  • Give every change one way in. Django’s built-in admin let managers change data without going through the app’s own checks and audit log. A second door undoes the first one’s locks.
  • Recover accounts with something the user has, not something they remember. A reset link sent by email beats security questions, whose answers can be guessed or looked up, and it lets the app stop revealing which accounts exist.
  • Ask the most powerful accounts for a second step at login. An administrator’s password alone shouldn’t be enough.

What I left as is

Three trade-offs, written down rather than changed:

  • Registration says when a username or email is taken, and login says when an account is locked. Both reveal that an account exists. Hiding that properly needs email verification, which the app doesn’t have.
  • Lockout is per username, so anyone who knows a username can lock that account out for 15 minutes.
  • Managers can sign in to Django’s built-in admin, where actions skip the app’s own audit log and re-authentication.

What this is not

It isn’t deployed and has no real users. Nobody outside the course has tried to break it. The review that found the five holes was mine, done with an AI assistant, not a professional penetration test.

Sources and credits

  • ITSECWB_RestaurantApp, source code as submitted for the course. github.com/Stilsi-dev/ITSECWB_RestaurantApp (opens in a new tab). The fixes and the 15 security tests described here are written and passing on a separate branch, not merged into the public repository.
  • Django Software Foundation. Django, web framework.

Built for Secure Web Development (ITSECWB) at De La Salle University. I led it. Any errors are mine.

end of restaurant-security.md. next: ~/lab · ~/work

~/angelo · Metro Manila · © 2026

privacy

This site sets no cookies and runs no ads or trackers. Cloudflare hosts it and counts page views with Web Analytics, which uses no cookies; a counter of my own records only how many times the CV is downloaded, nothing about who. Your theme choice, open tabs and the notes you pinged stay in your own browser. If you send a signal under a note, Cloudflare Turnstile checks that you're not a bot; the site keeps only the count. I collect no names, emails or IP addresses. For questions or requests under the Data Privacy Act of 2012 (RA 10173), write to angelo@nuque.dev.

~/angelo/lab/restaurant-security.md

keyboard

move

j / k
scroll down / up
d / u
half a page down / up
gg / G
top / bottom
] / [
next / previous section

go to

gh
README.md (home)
gw
work/
gn
writing/notes/
ga
about.md
gt / gT
next / previous open tab

panels

: / /
command palette and search
ctrl+k
command palette (always on)
esc
close, or leave :zen
?
this list
:tour
a 30-second walkthrough