[Corrective Action] Switch to `read_attribute` from `public_send` in `RetryBuildService` to avoid accidental miscopy

Problem

Originally this problem was unveiled in this comment. This issue is a corrective action for a recent production incident on CI/CD pipelines.

Proposal

@shinya.maeda I also wonder if https://gitlab.com/gitlab-org/gitlab/blob/af70ab20d625bf5f2470b2296d25af403009614d/app/services/ci/retry_build_service.rb#L67 should not be using public_send; since we're copying attributes from another build, can we just use read_attribute as part of a layered defense against this?

gitlab-com/gl-infra/production#5498 (comment 671866315)

Assignee Loading
Time tracking Loading