Skip to content

VOLTTRON 9.1.0

Choose a tag to compare

@craigpnnl craigpnnl released this 06 Oct 19:02
· 216 commits to main since this release
6fbecc9

VOLTTRON 9.1.0

This is a minor release. It adds new enforcement on the platform web service, the VUI, the auth service and the PostgreSQL historian, a new platform option, and a set of fixes. Several changes need action from operators, some before the upgrade and some after the first start; read "Upgrade steps" first.

Upgrade steps

Before upgrading:

  1. Check web agents for namespace conflicts. Every path an agent registers with the platform web service must start with a literal first path segment, its namespace. The first agent to register in a namespace owns it, and another agent's registration there is refused. A pattern without a literal first segment (an empty pattern, /.*, ^/.*$, a leading group or alternation) is refused. These names are reserved and cannot be used as namespaces, in any letter case: admin, authenticate, discovery, gs, vui, csr, index.html, js, logo-tagline.png and favicon.ico, along with anything a platform route pattern matches. The name vc is held for VolttronCentral. An agent may own several namespaces. A web agent that registers a reserved name, or a pattern without a literal first segment, fails to register after the upgrade and must be changed first.
  2. Set web-static-roots if agents serve files from outside their install. A static path registered by an agent must be an absolute directory inside the agent's own install, below its package directory, or inside a directory listed in the new web-static-roots platform option (comma-separated absolute directories, set in <VOLTTRON_HOME>/config, for example web-static-roots = /opt/site/www). A root equal to the whole install directory, or to the package directory itself, is refused. Agents run from a source tree, and tests that register a temporary directory, must list it there. Every agent allowed to register web routes may serve files from any listed directory, so list only directories meant to be public.
  3. Check PostgreSQL historian configurations. A configuration whose database or table names contain % or control characters, or whose table names collide with the rebuild's leftover table names, now fails at start with an error naming the setting. Table names of 48 to 63 bytes get a new constraint name on the first table rebuild.
  4. Update agents for PyJWT 2. The web extra now pins PyJWT 2.15.1. Agents that use the PyJWT 1.x API (bytes from encode, decode without an algorithms list) need updating, and code that imported get_user_claims from volttron.platform.web should call the platform web service's get_user_claims RPC. With PyJWT 1.x installed, web support reports itself unavailable.
  5. Update web clients.
    • VUI requests other than GET must send the token in the Authorization: Bearer header. A VUI front end that writes with only the cookie now gets 401.
    • The admin API calls that approve, deny or delete requests and credentials must send the token in the Authorization: Bearer header; a cookie alone is refused with 401. The bundled admin pages do this.
    • /discovery/allow must send the token in the Authorization: Bearer header and a JSON content type (415 otherwise).
    • VUI method calls and publishing need a JSON content type, and the user needs the admin group in addition to vui.
    • VUI agent RPC refuses the platform's own service identities (platform.auth, platform.health, config.store, control, platform_web, keydiscovery, zmq.proxy.router and control.connection) with 403, and refuses method names that contain a dot. The dedicated VUI endpoints keep serving control and config store operations.
    • A browser page that opens a pubsub websocket with the cookie must be served from the same host and port as the VUI.
    • /gs accepts POST only, at /gs or /gs/. The token must be an admin token sent in the JSON-RPC params.authentication field, and the method must be one of control.list_agents, control.status_agents or control.peerlist.

At the first start after upgrading:

  • The auth file (auth.json) moves from version 1.4 to 1.5, and a .bak file is written by the upgrade. Entries that cannot be read are dropped with a warning, and the rest of the file loads. An existing VolttronCentral entry receives the register_web_routes capability during this upgrade.

After the first start:

  1. Grant register_web_routes to web agents. Every agent that registers web routes (other than VolttronCentral) needs the capability, and its registration fails with a capability error until it has it. Add it with vctl auth update <index> (capabilities field). In-repository agents that register routes: SimpleWebAgent and WebSocketAgent (examples), PrometheusScrapeAgent (contrib) and OpenADRVenAgent (unsupported). Treat this capability like admin access: an agent holding it answers every request under its namespaces.
  2. Grant the auth capabilities that callers need. Reading or changing the auth file over RPC needs allow_auth_modifications; changing another agent's RPC method authorizations needs modify_rpc_method_allowance. vctl and the platform web service already hold them. A third-party agent that reads the credential lists or another user's capabilities, groups or roles, or edits the auth file, needs a grant with vctl auth update. VolttronCentral setup mode now needs allow_auth_modifications, and VolttronCentral is not granted it at install; grant it on the volttron.central entry.
  3. Create the first web administrator with the setup token. When the web service starts with no users, it writes a one-time setup token to <VOLTTRON_HOME>/web-setup-token and logs its path. Enter that token in the setup form to create the first administrator. Platforms that already have web users are unaffected.

What changed

  • feat: new web-static-roots platform option, and confinement of static path routes to the owning agent's install or a listed root.
  • feat: web route registration needs the register_web_routes capability, and each agent owns a first-path-segment namespace.
  • feat: first-administrator setup uses a one-time token.
  • feat: /gs, VUI agent RPC, VUI pubsub, the admin write API and /discovery/allow enforce group, header and content-type requirements (see Upgrade steps, item 5).
  • feat: auth file reads and changes over RPC are gated by capability, and an agent records method authorizations only for its own entry.
  • feat: capability-gated control RPCs are split into separate capabilities; with authentication disabled, capability enforcement is skipped and a startup warning is logged.
  • fix: PyJWT 2 support; token renewal and JSON-RPC authentication reject tokens that fail to decode.
  • fix: PostgreSQL historian table-name handling, table rebuild, and index naming.
  • fix: auth file kept in sync after writes, and a file lock prevents lost updates to the auth file.
  • fix: logging and input-handling hardening in the web service; request paths and names are shortened in web log lines.
  • fix: JSON-RPC error replies handle non-object data, keep detail, and build RemoteError from a message alone; the vip_main error names the right key variables.
  • docs: RELEASING.md and a security policy added; capability and web framework documentation updated.
  • chore: unused VolttronCentral npm packages dropped; dependency updates and test and CI hardening.

Migration notes

  • Database: no migration. The auth file upgrade from version 1.4 to 1.5 is applied automatically on the next platform start and writes a .bak file.
  • Rollback: returning to 9.0.x after the auth file has been upgraded to version 1.5 is not tested. The upgrade keeps the previous file as a .bak copy beside it; restore that copy before starting 9.0.x.
  • Breaking changes: no platform API is removed, but these callers must change. Web agents that register reserved names or patterns without a literal first segment, and web agents without the register_web_routes grant. Agents that use the PyJWT 1.x API or import get_user_claims from volttron.platform.web. Clients of the VUI, the admin approve, deny and delete API, /discovery/allow and /gs that rely on a cookie, omit a JSON content type, or lack the admin group. Third-party agents that read or edit the auth file or other agents' method authorizations without the capabilities named in Upgrade steps. Static path registrations outside the agent's install and the web-static-roots directories.

Resolved issues

#3237, #3238, #3239, #3248, #3254, #3304, #3305, #3306, #3320, #3341, #3343, #3344