Skip to content

Application update does not revoke old roles #8329

Open

Description

@stephdl

When an application is updated, update-module grants the roles requested by the new image, but it never removes the roles that are no longer requested.

The roles of a module are stored in the roles/module/<module_id> Redis hash, one field per target agent. update-module replaces the cluster/authorizations/module/<module_id> set with the new label, then calls add_module_permissions(), which only adds or overwrites fields. A target removed from the label keeps its old role. If the new image has no org.nethserver.authorizations label at all, the if authorizations: block is skipped and nothing changes.

Steps to reproduce

  1. Install an application whose image has org.nethserver.authorizations=node:fwadm traefik@node:routeadm.
  2. Update it to a version whose label is only traefik@node:routeadm.
  3. redis-cli hgetall roles/module/<module_id> still lists node/1 fwadm.

Expected behavior

After an update, the roles granted to an application match exactly the label of the installed image, plus self:selfadm. Targets that are no longer requested are revoked. An empty label revokes everything except selfadm.

Notes

This is also needed to compare old and new permissions before an update (see the follow-up issue about approving new permissions).

Discussion (private): https://mattermost.nethesis.it/nethesis/pl/9nbznashep8mfnkfgyza19t34a

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

  • Status
    In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions