fix(installer): correct a false security claim, and clear the should-fix list
Some checks failed
CI / backend (push) Failing after 8s
CI / naming (push) Successful in 2s
CI / frontend (push) Successful in 9s
CI / migrations-mysql (push) Failing after 7s

CLIENT IP / SPOOFABILITY. docs/geenforce-api-cutover.md claimed that removing the
IIS rewrite rule made the allowlist fail closed and that it does NOT become
spoofable. The opposite is true. IIS never sets X-Forwarded-For on its own; the
rule is the only thing that does. Remove it and IIS still forwards whatever
X-Forwarded-For the CALLER sent, waitress trusts it because it arrives from
127.0.0.1, and remote_addr becomes attacker-controlled - so a token-less caller
can fetch manifests from anywhere on the network. The document and the
_trusted_client_ip docstring now say so, waitress runs with
--trusted-proxy-count=1, and stage 5 checks the rule is actually live rather than
assuming it. The wizard question is rephrased to something an operator can verify
with their network team instead of guessing at.

NON-ASCII. The style gate only ever checked .py/.vue/.js/.ts, so documentation
accumulated em-dashes, arrows and box-drawing characters against this repo's own
convention - including in files added this week. Cleaned, and the gate now uses
INCLUDES_ALL so Markdown, JSON and YAML are covered.

PLUGIN DEFAULTS. The wizard pre-ticked measuringtools and printedparts, both of
which ship default_enabled=false, so every site taking the defaults installed and
enabled them against their manifests. Inno has no JSON parser so the list must be
hardcoded, but tests/test_installer_defaults.py now fails when it drifts.

UPGRADES. The payload copy merges, so a plugin dropped from a site's profile kept
its code forever - which defeats a lean build and leaves core's optional-import
guards succeeding for a plugin the site no longer has. Stale plugin directories
are now deregistered and removed before the copy.

add-plugin used 'plugin install', which for the five default_enabled=false
plugins left them installed but DISABLED - and printed a green success line
anyway. It now goes through apply-profile, and the success line is gated on the
exit code. Invoke-Flask records its own exit status, because $LASTEXITCODE keeps
a stale value when flask.exe is missing and no native command runs.

CHARSET. The utf8mb4 compiler hook lived inline in migrations/env.py, so it
covered the CORE chain only: plugin baselines inherited the server default, which
on a latin1 server means two charsets in one database. It is now
shopdb/utils/mysql_charset.py, imported by both, and preflight reports the
database's default charset.

BACKUP HONESTY. The dump was described as 'all of your asset data'. Uploaded
branding and floor-map images live in instance\ on disk, not in the database, so
a restore from the .sql alone comes back with no map. backup now archives
instance\ alongside it and says both are needed.

VERSIONING. AppVersion was hardcoded at 0.9.0 while the product, the frontend and
the newest tag said 0.7.0 - and 0.9.0 collides with a retired contract version.
Both builders now generate version.iss from shopdb/__init__.py.

Smaller: rollback overwrites .env before deleting it, as uninstall already did;
appcmd unlocks are scoped to this site's location rather than server-wide, with
the wide unlock as a fallback; DEVELOPMENT-SETUP says Python 3.14; the README
plugin list gains printedparts; prune-schema --force is documented as
first-provisioning-only; HTTPS is documented as not-the-default with the steps to
add it; the DBA SQL is on the wizard's database page; the features page says
unticking does not remove an installed feature; and the installer README states
that bundle-lock cannot vouch for the exe itself - that needs signing or an
out-of-band hash, neither of which is wired up.
This commit is contained in:
cproudlock
2026-08-03 14:57:38 -04:00
parent aea2905de0
commit 2c415a1712
24 changed files with 582 additions and 119 deletions

View File

@@ -5,7 +5,7 @@ and get a working application. Nothing here needs an internet connection, and yo
do not need to know IIS, Python or MySQL.
If you are looking after an existing hand-built server, see
[DEPLOY-WINDOWS-IIS.md](DEPLOY-WINDOWS-IIS.md) instead that is the manual
[DEPLOY-WINDOWS-IIS.md](DEPLOY-WINDOWS-IIS.md) instead - that is the manual
procedure, and the installer will not adopt a server it did not build.
---
@@ -17,9 +17,9 @@ You need **four things**. The installer supplies everything else.
| | What | How to check |
|---|---|---|
| 1 | Windows Server 2019 or newer | `winver` |
| 2 | The **IIS Web Server role** installed | Server Manager Manage Add Roles Web Server (IIS). Or run the PowerShell below. |
| 3 | Administrator rights on the box | Right-click PowerShell "Run as administrator" works |
| 4 | A decision about the database see [Which database?](#which-database) | |
| 2 | The **IIS Web Server role** installed | Server Manager -> Manage -> Add Roles -> Web Server (IIS). Or run the PowerShell below. |
| 3 | Administrator rights on the box | Right-click PowerShell -> "Run as administrator" works |
| 4 | A decision about the database - see [Which database?](#which-database) | - |
Installing IIS, if it is missing (this needs no internet):
@@ -35,10 +35,10 @@ time.
Two options. Pick before you start, because they ask different questions.
- **Use the bundled MySQL** the installer puts MySQL 8.0 on this server and
- **Use the bundled MySQL** - the installer puts MySQL 8.0 on this server and
creates the database for you. Choose this when the server has no database
today. Simplest option, nothing to arrange in advance.
- **Use an existing MySQL** the database already exists somewhere, and you have
- **Use an existing MySQL** - the database already exists somewhere, and you have
a hostname, a database name, a username and a password for it. Choose this if
your site already runs MySQL, or a DBA looks after it.
@@ -51,29 +51,29 @@ bundled option.
1. Copy the installer `.exe` onto the server. It is one file and needs no
network.
2. **Right-click it Run as administrator.** Without this it cannot configure
2. **Right-click it -> Run as administrator.** Without this it cannot configure
IIS, and it will tell you so.
3. Work through the wizard. The pages are:
| Page | What it wants | If unsure |
|---|---|---|
| **Server check** | Nothing it reports what it found | Fix anything red, then "Check again". You cannot continue while something is red, and nothing has been changed yet. |
| **Server check** | Nothing - it reports what it found | Fix anything red, then "Check again". You cannot continue while something is red, and nothing has been changed yet. |
| **Features** | Which parts of the product this site uses | The defaults are fine. You can add more later; removing needs a new installer. |
| **Database** | Bundled or existing see above | Bundled |
| **Database** | Bundled or existing - see above | Bundled |
| **Database details** | Host, port, name, user, password | Only asked for the existing-database option |
| **Address** | How people reach the site | See [Own address or subpath?](#own-address-or-subpath) |
| **Client addresses** | Whether a proxy sits in front | See [Client addresses](#client-addresses) |
| **Location** | Where to install | `C:\shopdb-flask` is fine |
4. The install takes a few minutes. Most of it is Python and the database schema.
5. At the end you get the address to open. **Write it down** it is also on the
5. At the end you get the address to open. **Write it down** - it is also on the
Start Menu as "Open ShopDB-Flask".
### Own address or subpath?
- **Its own address** `http://yourserver:8090/`. Choose this on a server that
- **Its own address** - `http://yourserver:8090/`. Choose this on a server that
is not already running a website. Simplest.
- **Under this server's existing address** `http://yourserver/shopdb/`. Choose
- **Under this server's existing address** - `http://yourserver/shopdb/`. Choose
this when the server already serves something else and you do not want a second
port or a new DNS name. This is what West Jefferson uses.
@@ -85,9 +85,9 @@ web interface has the address compiled into it.
The application records who connects, and some features decide what to show based
on it. The wizard asks one question:
- **Clients connect to this server directly** the normal answer. Pick this
- **Clients connect to this server directly** - the normal answer. Pick this
unless you know otherwise.
- **A proxy or load balancer sits in front** pick this only if your network
- **A proxy or load balancer sits in front** - pick this only if your network
team has told you traffic reaches this server through something else first.
Getting this wrong is not dangerous, but the site will record every visitor as
@@ -102,7 +102,7 @@ Open the address the installer gave you. With no users in the database yet, the
page offers to **create the first administrator**, then runs a short setup wizard
for site details, features and the floor map.
That first account is a normal administrator account. Use a real password
That first account is a normal administrator account. Use a real password -
this is the account that creates everyone else.
---
@@ -118,7 +118,7 @@ cd C:\shopdb-flask
You want to see the site started, the pool started, and `responding : yes`.
Day-to-day tasks restarting, backups, logs, upgrades are in
Day-to-day tasks - restarting, backups, logs, upgrades - are in
[OPERATE-WINDOWS.md](OPERATE-WINDOWS.md).
---
@@ -130,9 +130,9 @@ is still there. That is deliberate: it means re-running is able to pick up where
it stopped.
1. Read the error. It names the cause and what to do about it.
2. Fix that, then **run the same installer again**. Re-running is safe it skips
2. Fix that, then **run the same installer again**. Re-running is safe - it skips
what is already done and does not touch your database or `.env`.
3. If you would rather start clean, remove it from **Settings Apps** first.
3. If you would rather start clean, remove it from **Settings -> Apps** first.
The full log is at:
@@ -155,7 +155,7 @@ real state rather than a description:
That prints one structured block covering the version, how the site is published,
IIS state, database reachability, Python version, installed features and any
errors. Paste it in. **It contains no passwords.** The install log is also safe
to share the installer keeps secrets out of it deliberately.
to share - the installer keeps secrets out of it deliberately.
Offline API reference for this server is served at `/api/docs` on the site
itself, and `docs\` in the install directory holds these runbooks.
@@ -174,7 +174,7 @@ Run a newer installer over the top. It:
Nothing else is required. See [UPGRADE.md](UPGRADE.md).
> **Before your first upgrade:** confirm `mysqldump` is available the console's
> **Before your first upgrade:** confirm `mysqldump` is available - the console's
> health check reports it. Without it the pre-upgrade backup is skipped, and that
> is the one you would want if a migration went wrong. It ships with the bundled
> database option; for an existing remote database, ask for `mysqlclient\` to be
@@ -184,7 +184,7 @@ Nothing else is required. See [UPGRADE.md](UPGRADE.md).
## Removing it
**Settings Apps ShopDB-Flask**, or Add/Remove Programs.
**Settings -> Apps -> ShopDB-Flask**, or Add/Remove Programs.
That removes the website, the application pool, the firewall rule and the
application directory. It deliberately **does not** drop the database and does