Sign and verify ansi2json state

What does this MR do and why?

This state serves as a sort of a pagination cursor for the jobs controller trace rendering.

The state is passed in a base64 encoded query parameter, and gets embedded in the JSON output in a way that makes it look like the values originate from the GitLab backend itself.

To prevent confusion, we are appending a signature to the state and only restoring states with a valid signature.

See #392794 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

  1. Make sure you have a runner configured in your GDK
  2. Create a long running job in a project:
    # .gitlab-ci.yml
    many-echoes:
      script: for i in $(seq 1000); do echo $i; sleep 1; done
  3. Observe that the job trace keeps updating over time
  4. Optional: Repeat the experiment by checking out master first and then switching to this branch while on the page of a running job. Observe that the trace keeps updating. This is because we fall back to the empty state and send an a full trace back to the frontend that falls under the append == false case.

MR acceptance checklist

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

Edited by Hordur Freyr Yngvason

Merge request reports

Loading