Class WebEngineAdvisor
CC-DESIGN-WEBVIEW-WARNING sections 6.3, 7.1 and 8, work order CC-WEBENGINE-SERVER): it counts it for ServerAdmin, it logs an unpatched session, and it tells the client to warn its user when the application allows that.Where it is called from (the exact points, all in com.iizix.server):
- connect: the end of the
ClientSessionGyroconstructor, directly afterSessionGeoLogger.onConnected: the client's environment has arrived and the user is known; - reconnect:
ClientTransactionProcessor.onReconnected. The session is classified again, because a session can be taken over by another device and a day can have passed; a verdict that did not change does nothing at all, one that did moves the session to its new group row, and NO connect is counted a second time; - disconnect: the start of
ClientSessionGyro.dispose(): the session leaves the "active now" counts.
The verdict is WebEngineClassifier's, from the client's navigator.userAgent, izr.cordova, izr.osversion and izr.platform, the support table, today in UTC and the grace period of the server setting ServerSettings.WEB_ENGINE_GRACE_DAYS. It is pure CPU over at most 1 KB, so it is safe on the Jetty I/O thread the connect event runs on. It is kept on the session's EnvProps (EnvProps.getWebEngineStatus()), as DeviceMatch keeps its parsed user agents, and an application reads it with IClientSessionGyro.getWebEngineStatus().
The verdict decides no access (design D-16): it is computed from what the client says about itself, so a client can only make itself look patched or unpatched. Nothing here blocks, delays or refuses anything, and a failure in here never disturbs the session.
The log (section 8.1): one INFO line per connect of an unpatched session, under this class, on every server and whatever the application's setting. PATCHED and NOT_ASSESSED write nothing. The line holds the session, the application, the user name, the verdict and what was done about the warning - no user agent, no address, no device ID and no credential:
Web engine not patched: session=12 app=demo user=jane platform=Android os=7.0 engine=Android System WebView 119.0.6045.194 status=ENDED since=2023-11-30 last=119 warning=sent
The warning (section 7.1) is the application's choice, the app property ModuleApp.PN_WEB_ENGINE_WARNING: 1 IIZI warns - remote event 12 is sent at connect (warning=sent); 2 the application decides and calls IClientSessionGyro.showWebEngineWarning() (warning=application); 0 never (warning=never). Counting and logging happen whatever it says.
The support table is loaded when the server starts (loadTable(ServerSettings)), from the sources of WebEngineSupportTable.load(Path, Path, LocalDate): the file of the server setting ServerSettings.WEB_ENGINE_DATA_FILE when there is one, else the bundled table, with the Chrome dates of the weekly refresh's cache when ServerSettings.WEB_ENGINE_REFRESH is on; WebEngineRefresher loads it again after each refresh.
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptionstatic WebEngineSupportTablegetTable()Gets the support table the sessions are classified with.static WebEngineSupportTableloadTable(ServerSettings settings) Loads the support table from its sources and keeps it, without the cache of the weekly refresh:loadTable(ServerSettings,Path)with no cache file.static WebEngineSupportTableloadTable(ServerSettings settings, Path cacheFile) Loads the support table from its sources and keeps it: the file ofServerSettings.WEB_ENGINE_DATA_FILEwhen the settings name one, else the bundled table, with the Chrome dates of the cache file when one is given and it loads.static voidonConnected(ClientSessionGyro clientGyro) Called when a client session has been created (connected and authenticated): classifies its web engine, counts it, logs it when unpatched and sends the warning when the application's setting says IIZI warns.static voidonDisconnected(ClientSessionGyro clientGyro) Called when a client session is disposed of: the session leaves the "active now" counts.static voidonReconnected(ClientSessionGyro clientGyro) Called when a client session has been reconnected on a new connection: classifies its web engine again.static booleanshowWarning(ClientSessionGyro clientGyro) Sends the warning of a client session because its application asks for it (IClientSessionGyro.showWebEngineWarning()).
Method Details
onConnected
Called when a client session has been created (connected and authenticated): classifies its web engine, counts it, logs it when unpatched and sends the warning when the application's setting says IIZI warns. Never throws.- Parameters:
clientGyro- The client session gyro.
onReconnected
Called when a client session has been reconnected on a new connection: classifies its web engine again. A verdict that did not change does nothing; one that did is kept, moves the session to its new group row, and is logged and warned about as at connect. No connect is counted a second time. Never throws.- Parameters:
clientGyro- The client session gyro.
onDisconnected
Called when a client session is disposed of: the session leaves the "active now" counts. Never throws.- Parameters:
clientGyro- The client session gyro.
showWarning
Sends the warning of a client session because its application asks for it (IClientSessionGyro.showWebEngineWarning()). Nothing is sent when the application's setting is "never", when the engine is not unpatched, or when the session has no verdict.- Parameters:
clientGyro- The client session gyro.- Returns:
- true when the warning was sent.
getTable
Gets the support table the sessions are classified with.- Returns:
- The table, never null. It is loaded now, with the settings of the running server, when
loadTable(ServerSettings)has not been called yet.
loadTable
Loads the support table from its sources and keeps it, without the cache of the weekly refresh:loadTable(ServerSettings,Path)with no cache file.- Parameters:
settings- The server settings, null for the bundled table.- Returns:
- The table, never null.
loadTable
Loads the support table from its sources and keeps it: the file ofServerSettings.WEB_ENGINE_DATA_FILEwhen the settings name one, else the bundled table, with the Chrome dates of the cache file when one is given and it loads. Called when the server starts, off the Jetty I/O threads, after each weekly refresh (WebEngineRefresher), and by whoever has another reason to read the sources again. Writes one INFO line naming the source and the table'sasOfday, so that a stale table is visible in the log. Never throws.- Parameters:
settings- The server settings, null for the bundled table.cacheFile- The cache of the weekly refresh (WebEngineRefresher.cacheFileOf(ServerSettings, File)), or null for none.- Returns:
- The table, never null.