# Audit round 2 — 16 November 2026 (corporate booker security, launch phase, tiers off, debtors & creditors, folders, TravelClip)

Continues handbooks 26–29. Everything was tested on copies of the databases and throw-away test clients that were deleted after.

## 1. Corporate booker security sweep (new tool: tools/corporate-sweep.php)
What it does: makes two throw-away clients (A and B), a login for every role in A and an admin in B, trips with secret markers,
then attacks every booker action (corporate/public/api/app.php) and the platform link (public/api/corporate.php).
| Test | Result |
|---|---|
| Every action with no login | refused (401) — only the sign-in page's info and login answer |
| Every login of client A used on client B's address, every action | refused (401); none of B's names, passports, trips or e-mails came back |
| Every action by every role | no role reached an action its permissions do not allow |
| A traveller on another traveller's trip (open, change, add sectors, submit, cancel, book, e-mail, delete, approve own trip, change another person's profile, see another passport) | all refused |
| A line manager approving a trip outside their team | refused |
| Hostile input (SQL, HTML, paths, type confusion, oversized, null byte) in every field, as admin and traveller | no crash, no error text, no file path, no secret |
| The platform link without its signature, or with a made-up one | refused (401) |
Result: **1 791 calls, 0 findings** (after the fixes below).
Fixed during the sweep:
1. **Role permissions could be wiped by one bad save.** A permissions save with no table set every role to "no permissions" (a whole
   company could not book). Now only the roles sent are changed; a save with no table is refused.
2. **Odd input showed PHP warnings with file paths on this computer.** The booker's guard against a list sent where one value belongs
   did not run behind its router. Now it runs on every booker API call. (The live server never shows PHP messages.)
3. An invoice asked for before anything is booked now answers "not found", not a server fault.

### Who sees what in a corporate booker (the role permissions — there is nothing else)
- Company admin: everything, including logins, roles, branding, policy, budgets.
- Travel manager: book for anyone, keep the people directory, approve, see every trip, reports, policy.
- Line manager: book for their team, approve their team's trips, see their team's trips, people list, reports.
- Supervisor: book for their team, see their team's trips, people list.
- Finance: see every trip, people list, reports, departments/cost centres/budgets.
- Traveller: request their own trips and see only their own itineraries.
(The company admin can change which role has which permission under Users → Roles.) A team = people who report to them or are in
their department. There are no "shared trip views" or other sharing features.

## 2. Launch phase — PER SITE (Settings → Launch phase, a tick per site)
- **Per site** (16 Nov, later): a ticked site is in phase 1; every other site is in phase 2. Getaway's site **Travel 5** is in phase 1 (live booking, Build your trip, all content and destinations — no packages: no Packages tab, menu link or button). **Travel 5a** is a test copy of Travel 5 with packages on (phase 2), behind the showcase sign-in, to test packages before Getaway moves to phase 2.
- **Phase 1**: every site, the booking widget and agents' links sell only live flights, stays, cars, coaches and **Build your trip**.
  No package is shown or sold on any site; a package payment is refused at payment. Balances on bookings already made still pay.
- **Phase 2**: packages on the sites too (each on the sites it is set for).
- The package builder and approvals work in both phases (prepare packages for phase 2). Corporate bookers have their own switch
  ("Corporate bookers can add packages", default on).
- Enforced in one place for all sites (gw_pkg_site_sql), at payment (pay.php), in the widget (no Packages tab), in the corporate link.
- Tested in the self-test (phase 1 hides and refuses, phase 2 brings back). On 16 Nov the setting was still phase 2 (the owner chooses).

## 3. Tiers are switched off — no bearing on anything
- While tiers_on is off, tiers take **no part** in any fee, commission, monthly fee, profit, report or reconciliation.
- A term missing from an agent's deal is "not set" (it is NOT filled from a tier); an agent with a missing term cannot trade.
- No screen shows a tier, tier badge, ladder or "tier rates" while off; the Finance agents table shows "Deal: complete / incomplete".
- The starting tier's table is only the template a new deal's form is filled from — staff check every figure before saving.
- Checked on the data: every agent's terms come from their deal, every deal version is complete, every monthly fee charged
  (Karoo Trails, R500 a month, Aug–Nov) says "your agreed rate". Tiers never affected a recorded figure.

## 4. Debtors & creditors (Finance → Books → first tab)
As at today, straight from the general ledger:
- **Left (debit side): what we hold and what is owed to us** — Bank (card money collected less everything paid out), customers still
  to pay (deposit balances), corporate monthly fees unpaid, agents who owe us, card fees on cancellations awaiting a refund.
- **Right (credit side): what we owe and the owners' shares** — suppliers, agents we owe, SARS VAT, customers to refund, the payment
  gateway (nil), Getaway's share, API Travel Solutions' share, suspense (nil).
- The two sides are equal when the books are right. Each line opens its detail (bookings, agents, clients).
- **Every site**: paid bookings, sales, received, customers still to pay, to refund, suppliers still to pay, agents earned, VAT,
  Getaway, API — all time. Bookings with no site recorded are from before sites were tracked (test data, 26 Sep–22 Oct); every
  booking since gets its site (the main booking app is "pwa").
- **Reconciliation** under it: the books balance; the two sides equal; customers account = deposits owed − refunds held; suppliers
  account = every booking's supplier still owed; agents account = what each agent is owed; corporate fees account = each client's
  unpaid fees; gateway nil; nothing in suspense; the books proof (53 checks); then what needs attention — refunds to make, suppliers
  unpaid after the trip, agent statements unpaid, customer balances overdue, corporate fees to collect.
- First run (16 Nov, test data): both sides R1 578 251.64; every account tied to the cent; 53/53; attention: 37 trips travelled with
  the supplier not paid (R269 502.15 — test suppliers are never paid), 2 agent statements unpaid (R6 418.53), R4 500 corporate fees.

## 5. Folders and files (what the web can reach)
- Only public/ is served (locally and on Afrihost). The database, backups, config files, client configs, keys, TravelClip's memory
  and runtime all live outside it.
- public/.htaccess (live) refuses dotfiles, databases, backups, logs, keys, notes (.md), zips and scripts, programs in uploads, the
  include folders, and now the local router. **The local servers now refuse the same** (public/router.php) — they listen on the
  network for the phone app, so they must be as strict as the live site.
- Probed with attack paths (../, encoded ../, .git, .htaccess, include files, uploads/x.php, client config, client database) on both
  local servers: nothing secret is served (unknown addresses just show the app's start page).
- TravelClip's model server listens on this computer only (127.0.0.1:8188).
- Secret files are kept out of git (config, client configs, keys, config.zip, TravelClip memory). **Open item for the owners: the live
  database storage/app.sqlite is tracked in git** — its personal data goes into every commit's history. Recommended: stop tracking it
  and, if the repository was ever pushed, remove it from the history (needs the owner's go-ahead).

## 6. "Where am I" — the trail at the top
Six screens were not in the screen list, so the trail and the browser tab said "Dashboard": one agent's page, Finance → Books,
Reports, Settle, Agent reports, Documents. Fixed: Books and the agent page are listed (agent page: Agents › Agent desk › the agent's
name; admin only), and any screen not listed now takes its trail from its own heading — never "Dashboard" by mistake.

## 7. TravelClip audit (questions put to the running model)
Right: tiers off and no bearing; nobody on Gold; a traveller cannot see another's trip. Wrong, and fixed:
1. It said "phase 1 is active" — the live settings it reads did not include the launch phase. Added (and the corporate package switch).
2. It tacked "My mistake …" onto answers nobody had corrected. The rule now says: only as the first words after the owner says you were
   wrong; and the chat window drops a "My mistake" tacked on after an answer, and ✅ stamps.
3. It invented a feature ("shared trip views"). New rule: never invent a feature, setting or screen; the booker roles are listed above.
4. It quoted a stale test count. Counts grow — quote the latest audit, and say when it was run.

## 8. Tests at the end of the round
Self-test 528/528 (baseline database) · security test 74/74 · corporate booker sweep 1 791 calls, 0 findings · platform security
sweep 10 859 calls, no real finding (handbook 26).
