Skip to content

update_pyro_config silently discards configuration keys it cannot apply #72

Description

@sequoiap

PyroConfigMixin.update_pyro_config, pyrolab/configure.py:202-211:

pyroset = {}
for key, value in values.items():
    key = key.upper()
    if key in Pyro5.config.__slots__:
        setattr(Pyro5.config, key, value)
        pyroset[key] = value
return pyroset

Any model field whose uppercased name is not a Pyro5 config slot is dropped with no log line and no error. Some of those are intentional (module, classname, nameservers are consumed elsewhere); some are silent data loss. port and unixsocket on DaemonConfiguration fall in the second category and are the subject of a separate issue -- this issue is about the mechanism that hides it.

The design has two further consequences worth documenting or changing:

  1. It writes to Pyro5 process globals. Per-daemon settings only work because each daemon runs in its own process (DaemonRunner). Nothing states this, and it silently stops being true for anything that runs two configurations in one process -- including tests. Daemon accepts host/port/nathost/natport as constructor arguments; passing them explicitly would remove the dependency on global state.
  2. A typo in a config file is invisible. servertyp: multiplex is accepted by pydantic (extra fields are ignored by default in v1) and then ignored here, so the daemon silently runs with the default server type.

Suggested fixes:

  • Log at DEBUG which keys were applied and at WARNING which were skipped for an unrecognized name.
  • Set class Config: extra = "forbid" on the settings models so unknown YAML keys are rejected at load with a clear message.
  • Maintain an explicit allowlist of "fields intentionally not Pyro options" so the skip-warning does not fire for module/classname/nameservers.

Found in a full-codebase audit at v0.4.0 (commit 1ce3146).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions