On this page10
Part of the TFI PHP App. By Mohammad Javad Dastouri, full-stack and AI engineer.
WordPress security depends on every plugin being safe. I wanted the opposite: a system that refuses everything until it has been told what to allow.
At a glance
- Approach
- Deny by default
- Staff sign-in
- Two-factor required, Argon2id password hashing (bcrypt where a host lacks it), sessions bound to one screen
- Content
- Cleaned on save and again on the page
- File check
- Compared with a trusted record every 15 minutes
- Updates
- Signed packages, verified before install
- Approach
- Deny by default
- Staff sign-in
- Two-factor required, Argon2id password hashing (bcrypt where a host lacks it), sessions bound to one screen
- Content
- Cleaned on save and again on the page
- File check
- Compared with a trusted record every 15 minutes
- Updates
- Signed packages, verified before install
The decision
- Context
- A site built from plugins is only as safe as its weakest plugin.
- Decision
- Close everything by default. An address answers only if it is a registered route with an access level, or a published page.
- Not chosen
- A check inside each feature. Quicker when adding one page, but safety would depend on remembering every time.
- Cost
- A feature I forget to declare looks like a broken page, and the 404 gives no hint why. On a device that has never signed in, staff get the same 404 as anyone else.
- Result
- A feature I forget to declare stays closed instead of open.
- Context
- A site built from plugins is only as safe as its weakest plugin.
- Decision
- Close everything by default. An address answers only if it is a registered route with an access level, or a published page.
- Not chosen
- A check inside each feature. Quicker when adding one page, but safety would depend on remembering every time.
- Cost
- A feature I forget to declare looks like a broken page, and the 404 gives no hint why. On a device that has never signed in, staff get the same 404 as anyone else.
- Result
- A feature I forget to declare stays closed instead of open.
Closed until opened
Every feature address is registered in a route list, with the access it needs. Articles and categories answer only when a published row exists. Anything else gets the site's normal 404. Staff pages also answer 404 to anyone without a session, so an outsider cannot tell they exist.
Content that cannot run code
Text reaches the database through an allow-list of tags and attributes, and it passes through that list again every time it is shown. A changed article row still cannot put a script on a page.
By rule, every form carries a token, printed values are escaped and queries use prepared statements.
A small footprint on the server
Folders and files are private to one account. A list of dangerous PHP functions is banned. An automatic check reads the code for them, and the few exceptions are named one by one.
Every 15 minutes the site compares its own files with a trusted record. An unexpected change is treated as tampering and investigated, never simply accepted.
Abuse and bots
A network that abuses a site can be sent to a verification form, where the admin decides what happens. Google and Bing crawlers are recognised by their published ranges, so search traffic is not caught by mistake.
Privacy built in
Consent
Scripts placed under a consent category stay switched off until the visitor agrees. The site owner decides which scripts go there.
Page counts
The app's own counter uses no cookie, keeps no IP address and has no record of a person.
External media
A video reaches no outside service until the visitor asks for it.
Consent
Scripts placed under a consent category stay switched off until the visitor agrees. The site owner decides which scripts go there.
Page counts
The app's own counter uses no cookie, keeps no IP address and has no record of a person.
External media
A video reaches no outside service until the visitor asks for it.
When something goes wrong
The app is written to fail in words. If the database does not match the code, the site answers with a clean "come back shortly" and repairs itself, instead of showing a PHP error.
What a separate review found
A separate read-only review of the first two phases of the forms module found 2 high, 7 medium and 9 low problems, and all were fixed. I would rather learn that from a review than from a visitor.
Looking for security designed in from the start?
Tell me what your team needs protected. The 13 designs sit on top of this.
- Section
- Web platforms and migration
- Updated
- November 9, 2026
- Reading time
- 3 min read
Hiring for this kind of work?
Tell me about the role and I will reply by email.
Discuss a role with me
