Refonte d'une application de santé · AP-HP
Security audit and hardening of a hospital application
Case study. No integration, no screenshots, no real data.
Role
Freelance
Twelve hospital centres use this application to issue sports fitness certificates to children with Marfan syndrome. I audited a stack that was no longer supported, tested an emergency hardening, then proposed a rebuild on Symfony 7, PHP 8 and PostgreSQL. It's presented as a case study, with reconstructed screens and fictional data.
What's inside
- 23-page security audit: six major flaws, 60 published vulnerabilities, build chain repaired.
- Emergency hardening branch: 12 commits, 69 green tests, per-centre partitioning, anti-CSRF, secrets out of the repository.
- Encrypted backup, restore and deployment scripts, a three-window plan.
- Note for the DPO and personal-data mapping.
- Proposed rebuild on Symfony 7.4, PHP 8.3, PostgreSQL 16 and Docker, with history and action log.
In detail
01Where it comes from
I was contacted about this hospital application, and it mattered to me. It serves children with Marfan syndrome, so that a precise certificate, sport by sport, replaces a vague ban on doing sport at school.
The stack was no longer maintained and health data was reachable without logging in. I audited it, hardened it in an emergency, and proposed what comes next. Everything below is a case study, with no real data.
02What the application is for
A child with Marfan syndrome can't do just any sport at school. A vague unfitness certificate excludes them from everything, when they could take part in most activities. The application turns that into a precise, reproducible decision. Three specialists each answer a questionnaire, the application crosses the answers with a reference list of school activities, and produces a PDF certificate that lists, sport by sport, what is allowed, for the current school year and the next.
In real use, that means around 200 to 260 certificates a year since 2019, across 12 hospital centres, 52 accounts, 268 files and 1,313 certificates produced.
03The fitness engine
Four profiles, super-administrator, centre administrator, secretariat, and a specialist in cardiology, ophthalmology or paediatric rheumatology, who can only open their own specialty's questionnaire. While any questionnaire is incomplete, generation stays unavailable, and once the PDF exists, the questionnaires are frozen.
The core logic fits in about fifty lines. For each activity matching the child's school level and gender, if no cardiology answer allows it, it's forbidden outright, the aorta comes first. Otherwise a single contraindication from any specialist is enough to refuse it. All the intelligence sits in the mapping from answers to authorisations, managed by the super-admin, and the code only applies it.
04The audit
Symfony 4.2, PHP 7.2, PostgreSQL 9.6 and Debian 9 on an OVH VPS, in other words the whole stack out of support, with 60 published vulnerabilities including 5 critical, a dead build chain I had to repair before I could rebuild the image, no backups, and e-mail delivery broken since 2022, which also prevented the automatic deletion of files after sending.
I found six major flaws. Certificates reachable without logging in, the database and Adminer open to the Internet, passwords in clear in the code, a password sent back in clear by e-mail, no partitioning between centres, and destructive actions triggered by a plain link. The audit also showed that the "hospital identifier" field in practice held the child's first and last name.
I delivered 23 pages with reproducible findings, six quotes, a comparison, a maintenance contract, a note for the DPO and an acceptance checklist per role.
05Hardening and next steps
An emergency hardening branch, 12 commits and 69 green automated tests. Certificates and logos move out of the web root, with random names and authenticated downloads, per-centre partitioning covers 14 actions, an anti-CSRF token protects 12 routes, the password leaves the e-mails, secrets leave the repository, production runs without Adminer or an exposed database port, nginx is hardened, and scripts handle encrypted backups, restores and deployments.
Deployment follows a plan of three short windows on the server, with a dress rehearsal on a local replica of production, a per-role acceptance and a report. The next step I propose is a full rebuild on Symfony 7, PHP 8, PostgreSQL 16 and Docker, with a certificate history and an action log, which don't exist today.
Presented as a case study. It's a health application, so no real data is shown.