Skip to content

Copy auth field objects when serializing values

What does this MR do and why?

This fixes a bug where a computed property would inadvertently reset a form field.

When editing a DAST site profile that had a password set, the password field is set to a redacted value ('••••••••') as is the requestHeaders field. This is done for security reasons and means that, when saving the profile without changing the password field, its value should be omitted from the request payload so that its original value is preserved in the DB. This is being controlled by the serializedAuthFields computed property that deletes the password property from the object. The issue is that the password property was being accessed by reference in serializedAuthFields, which resulted in the main form object being mutated, hence resetting the password field's value.

Screenshots or screen recordings

Before After
Screen_Shot_2021-12-15_at_11.03.48_AM Screen_Shot_2021-12-15_at_10.57.35_AM

How to set up and validate locally

  1. Create a DAST Site profile with authentication enabled and a password set.
  2. Edit the profile.
    • The password field should be populated with '••••••••'.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #348550 (closed)

Edited by Paul Gascou-Vaillancourt

Merge request reports