Skip to content

Static webhook payloads for snippet and label

Luke Duncalfe requested to merge 440384-static-hook_attrs into master

What does this MR do and why?

This defines static webhook payloads for snippets and labels. This means as attributes are added to these models we do not automatically include them in the webhook payload until we redefine their #hook_attr methods to do so.

This is a best practice to avoid sending data that we do not expect in future.

There are some properties being removed from webhook payloads as part of this change:

  • Snippet webhook payloads are having removed:
    • encrypted_secret_token, encrypted_secret_token_iv, secret and secret_token removed (related to #440384 - these properties are not used in GitLab, and not documented as part of the snippet payload so we are wanting to exclude them from the snippet webhook payload)
    • repository_read_only was not documented and seems to be for internal-use.
    • imported also undocumented (and added 2 days ago!) !145446 (comment 1868595112).
  • Label webhook payloads are having lock_on_merge removed (see for !145446 (comment 1851829125) reasoning)

The change is behind two feature flags (one for labels and one for snippets).

#440384

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

In a rails console, compare the output of Snippet.first.hook_attrs and Label.first.hook_attrs when the two flags are toggled on, or toggled off.

Related to #440384

Edited by Luke Duncalfe

Merge request reports