Unpick one site's conventions from the shipped bundle, and bind the launch-path
check to the file it actually runs Two clusters the five-agent review found. Both are about a product that another plant has to be able to install. ADR-015: the shipped monitor bundle was the originating plant's fleet convention frozen into product seed. The business policy was seeded as "RPCA Shopfloor App Monitors". RPCA is that plant's facility designator, the row is source='shipped', and the API refused to rename it - so every adopting site would carry another plant's label at the top of its policy list forever. 0007 now seeds the neutral name, and 0010 renames it on installs that already stamped 0007, guarded so it cannot collide with a policy a site made itself. Downgrade is one-way on purpose: putting another site's designator back is not a state worth reaching. Which PC type the bundle attaches to was the literal 'Shopfloor PC'. A plant whose type is "Shop Floor Workstation" silently got no shipped monitors at all, and one using that name for something else got all of them. It is a setting now, defaulting to the seeded name so nothing changes here, and a blank value attaches the bundle to nothing - the right neutral answer for a site that does not want it. Shipped rows refused every edit, including isactive and launchpath. A plant whose eDNC is on D:, or that runs no UDC, could not correct the path or switch the monitor off, and then carried permanent false drift for it. ADR-015 allows seed data BECAUSE a site can edit it afterwards. Paths and the active flag are now editable; kind and displayname stay fixed, because that pair is the identity 0007's bundle matches on. Also corrected two false claims in 0007's docstring: the policy tables belong to the computers plugin, not the core baseline, and a guarded no-op does NOT reconcile later - Alembic stamps the revision either way, so the bundle would simply never seed. LaunchPathPolicy was purely lexical. GetFullPath is string normalization that never touches the disk, so the root check constrained the NAME while File.Exists and CreateProcess followed reparse points to somewhere else. A junction under a writable directory in an approved root - creating one needs no privilege, only write access to the parent, and vendor trees under Program Files are not reliably locked down - turned WebUI monitor-edit rights into code execution as the console operator. It now resolves the real target, leaf and directory chain both, and re-checks THAT against the roots, rejecting if resolution fails. Alternate data streams passed the whole policy on net8.0: an interior colon no longer throws in GetFullPath, so "readme.txt:payload.exe" reported an .exe extension, passed the root check, and existed. Rejected explicitly now. Six tests added for the shipped-row and pctype behaviour. The Core project compiles clean. The launch-path change has NOT been exercised against real junctions, ADS or 8.3 names - that needs the win11 VM, and per the reviewer it wants a planted-violation suite there rather than my say-so. Still open from the review: monitor revocation does not take effect until agent restart, ActionPicker is keyboard-inoperable, the lightbox has no focus trap, one attached monitor grants generic any-target process control, and screenshots are retained unencrypted in the user profile. Scope: product
This commit is contained in:
@@ -20,17 +20,27 @@ CRUD API refuses to edit or delete them):
|
||||
trying to START the process when a launch path is mapped - never something
|
||||
the product ships switched on for every endpoint.
|
||||
|
||||
BusinessPolicy "RPCA Shopfloor App Monitors"
|
||||
BusinessPolicy "Shopfloor App Monitors"
|
||||
the site-level wrapper, carrying the Configuration Policy as its one item.
|
||||
It was named for the originating plant when this arrived. A shipped row is
|
||||
product-owned and every adopting site sees it, so the name cannot be one
|
||||
site's designator (ADR-015). Migration 0010 renames it on installs that
|
||||
already stamped this one.
|
||||
|
||||
Monitors are looked up by identity (kind, displayname), never by a hardcoded id,
|
||||
so the bundle survives id drift across installs.
|
||||
|
||||
Lives in the endpoints chain, after 0006, because the monitor rows it references
|
||||
are seeded there. The computers policy tables are created by the core baseline
|
||||
before per-plugin chains run; this migration still guards on their presence and
|
||||
no-ops cleanly if they are absent, and is idempotent on the policy/business-policy
|
||||
names so re-running never duplicates the bundle.
|
||||
are seeded there. The policy tables belong to the COMPUTERS plugin and are
|
||||
created by its own post-cutover chain, not by the core baseline; endpoints
|
||||
declares a hard dependency on computers, which is what orders the two.
|
||||
|
||||
It guards on those tables being present and no-ops if they are not, and it is
|
||||
idempotent on the policy names so re-running never duplicates the bundle. Be
|
||||
clear about what the guard costs, though: Alembic stamps the revision either
|
||||
way, so if it ever no-ops the bundle is simply never seeded and nothing comes
|
||||
back to finish the job. That is acceptable only because the dependency makes
|
||||
the absent case unreachable in a supported install.
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
@@ -47,7 +57,7 @@ depends_on = None
|
||||
|
||||
|
||||
CONFIG_POLICY_NAME = 'Shopfloor App Monitors'
|
||||
BUSINESS_POLICY_NAME = 'RPCA Shopfloor App Monitors'
|
||||
BUSINESS_POLICY_NAME = 'Shopfloor App Monitors'
|
||||
|
||||
# The shipped monitors this bundle attaches, by identity (kind, displayname).
|
||||
_SHIPPED_MONITORS = (
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
"""Rename the shipped business policy off one site's designator.
|
||||
|
||||
0007 seeded it as "RPCA Shopfloor App Monitors". RPCA is the originating
|
||||
plant's facility designator, and the row is product-owned: source='shipped',
|
||||
seeded into every install, and the CRUD API refuses to rename it. So every
|
||||
adopting site would carry another plant's label at the top of its policy list
|
||||
with no way to change it, which is exactly what ADR-015 exists to prevent.
|
||||
|
||||
0007 now seeds the neutral name, which covers a fresh install. This migration
|
||||
covers the installs that already stamped 0007 with the old one - the
|
||||
originating site, and anyone who upgraded before this landed.
|
||||
|
||||
Renames only when the old name is present AND the new one is not, so it is
|
||||
idempotent and cannot collide with a site that already has a policy of its own
|
||||
under the new name. Downgrade is deliberately one-way: putting another site's
|
||||
designator back into a shipped row is not a state worth being able to reach.
|
||||
|
||||
Revision ID: endpoints0010renamepolicy
|
||||
Revises: endpoints0009opreports
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = 'endpoints0010renamepolicy'
|
||||
down_revision = 'endpoints0009opreports'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
OLD_NAME = 'RPCA Shopfloor App Monitors'
|
||||
NEW_NAME = 'Shopfloor App Monitors'
|
||||
|
||||
|
||||
def _has_table(bind, name):
|
||||
return sa.inspect(bind).has_table(name)
|
||||
|
||||
|
||||
def upgrade():
|
||||
bind = op.get_bind()
|
||||
# The policy tables belong to the computers plugin. Same guard as 0007: if
|
||||
# they are not there, there is nothing seeded to rename.
|
||||
if not _has_table(bind, 'businesspolicies'):
|
||||
return
|
||||
|
||||
exists = bind.execute(
|
||||
sa.text('SELECT COUNT(*) FROM businesspolicies WHERE name = :name'),
|
||||
{'name': NEW_NAME}).scalar()
|
||||
if exists:
|
||||
return
|
||||
|
||||
bind.execute(
|
||||
sa.text('UPDATE businesspolicies SET name = :new WHERE name = :old'),
|
||||
{'new': NEW_NAME, 'old': OLD_NAME})
|
||||
|
||||
|
||||
def downgrade():
|
||||
# One-way on purpose. See the module docstring.
|
||||
pass
|
||||
Reference in New Issue
Block a user