Refactor resetting secret fields in integrations
Summary
Some integrations reset their "secret" fields (type: 'password'
) when certain "exposing" fields are changed (e.g. URLs), to avoid leaking secrets to unauthorized parties:
- https://gitlab.com/gitlab-org/gitlab/blob/49a4911e011419a40b37d0aa18d7f5ccc4048e04/app/models/integrations/bamboo.rb#L23
- https://gitlab.com/gitlab-org/gitlab/blob/49a4911e011419a40b37d0aa18d7f5ccc4048e04/app/models/integrations/jenkins.rb#L21
- https://gitlab.com/gitlab-org/gitlab/blob/49a4911e011419a40b37d0aa18d7f5ccc4048e04/app/models/integrations/jira.rb#L67
- https://gitlab.com/gitlab-org/gitlab/blob/49a4911e011419a40b37d0aa18d7f5ccc4048e04/app/models/integrations/teamcity.rb#L33
Improvements
- Extract this behaviour into a shared concern.
- Add this behaviour to other integrations with secret fields:
app/models/integrations/datadog.rb
app/models/integrations/zentao.rb
Related links
- !66972 (019f5d16) was a draft to introduce a concern.
- #336004 will need information about the "secret" and "exposing" fields to automatically update the UI.
Edited by Markus Koller