Skip to content

Conversation

@tjferguson
Copy link

This change lets users of the image define one new envars:

OIDC_UPDATE_USER_ROLE = true | false

This sets the update_user_role value in the MISP config.php that is used by newer versions to allow the management of user-roles to occur internal of the application vs through role mapping.

Why would you want this?

This is to bring the image params in-line with the allowed configuration of the parent MISP application.

@tjferguson tjferguson changed the title Enable redirect_uri property for Docker Image Enable update_user_role property for Docker Image Dec 11, 2025
\"authentication_method\": \"${OIDC_AUTH_METHOD}\",
\"redirect_uri\": \"${OIDC_REDIRECT_URI}\"
\"redirect_uri\": \"${OIDC_REDIRECT_URI}\",
+ \"update_user_role\": ${OIDC_UPDATE_USER_ROLE}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when this is empty? Is this valid?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is referenced in:
https://github.com/MISP/MISP/blob/2.5/app/Plugin/OidcAuth/Lib/Oidc.php#L109
https://github.com/MISP/MISP/blob/2.5/app/Plugin/OidcAuth/Lib/Oidc.php#L240

The bit that matters for this is:

$this->getConfig('update_user_role', true)

This uses the getConfig function from:
https://github.com/MISP/MISP/blob/2.5/app/Plugin/OidcAuth/Lib/Oidc.php#L541

If the value is not in the configuration file at all, then getConfig call below would default the value to true (which is what the container does today).

In the case where the env variable is empty coming from the container runtime, you are 100% right; this would cause the JSON being written to be invalid. We should probably use ${OIDC_UPDATE_USER_ROLE:=default_role_value} to account for this case, so this isn't a breaking change for existing configs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, but does /var/www/MISP/tests/modify_config.php modify succeed when that is the case?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it does, if I'm reading the modify_config.php file correctly; otherwise the upstream project would have issues with the upgrades after the new property was added.

Using:
${OIDC_UPDATE_USER_ROLE:=true}

Should allow any potential inputs to pass as they currently do. There is a failure case in the original submission for an invalid json file if no value was set.

I'll give the following a test when I get back to a computer:

  1. input value set to true/false
  2. no input value supplied for OIDC_UPDATE_USER_ROLE
  3. no input value specified, but a value already set in an existing container (e.g. via a configmap in k8s)

Are there any other scenarios this needs to be tested under?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are sure that the default value is true, we can cut to the chase by creating defaults in the main entrypoint file (entrypoint.sh) so we are sure that the var is always initialized to a default value.

Also, we should update docker-compose.yml and template.env to document it.

@ostefano ostefano added documentation Improvements or additions to documentation enhancement New feature or request labels Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants