otterdog
otterdog copied to clipboard
Default secret visibility not applied when property is unspecified
Description
When creating manually a secret in GitHub, the default visibility is set to "Private and Internal Repositories". However, if no visibility setting is explicitly specified in the configuration, the expected default value from otterdog-defaults.libsonnet is not applied. Instead, GitHub retains its own default setting.
Steps to Reproduce
- Manually create a secret with the default visibility: "Private and Internal Repositories".
- Import the organization configuration using:
otterdog import eclipse-<project_id> - Modify the configuration, without explicitly specifying the secret's visibility (removing "private" visibility).
- Apply the changes using:
otterdog apply eclipse-<project_id>
Expected
If the visibility property is not explicitly defined, the system should apply the default value from otterdog-defaults.libsonnet.
Actual behavior
When no visibility is specified, GitHub’s default setting ("Private and Internal Repositories") remains in effect, instead of using the value defined in otterdog-defaults.libsonnet. https://github.com/EclipseFdn/otterdog-defaults/blob/main/otterdog-defaults.libsonnet#L233
I just tested it and it works fine. However, you need to make sure that the secret does not have a dummy value assigned (********) as in this case the secret will be skipped from processing.
The reason for that is that you cant make changes to a secret unless you provide the secret value again to it. See the documentation here: https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret
So we cant update the visibility of a secret without knowing its value.
It was exactly that use case. sorry for not mentioning it.
you cant make changes to a secret unless you provide the secret value again to it
From the UI it is possible. maybe it is different from the API.
I would at least expect a warning message showing the difference between the configuration and the visibility of these secrets.
actually that is tracked by #263