Skip to content

Add routing payload, random bytes length & checksum to routable tokens

Why is this change being made?

After starting to update detection scripts, it appears that having variable-length tokens makes detection harder. To solve that, this MR adds a CRC32 checksum of the token to, which also allow offline checking of tokens (in the case of fake or badly-forged tokens).

This was suggested at gitlab-org/security-products/secret-detection/secret-detection-rules!26 (comment 2196302929).

This MR also changes the specification to allow the random bytes part to be longer than 16 bytes in the future, by including the random bytes length after the random bytes, and the routing payload length after the base-64 payload.

This doesn't change significantly how the HTTP Router would retrieve the routing information: the only change needed is that the random bytes is now variable-length, so that the routing information are a substring of the decoded-payload. It doesn't require a lot of computation.

This takes some inspiration from https://www.finnie.org/2023/10/18/better-assembled-access-tokens/.

Review app: https://gitlab-com.gitlab.io/content-sites/handbook/mr9756/handbook/engineering/architecture/design-documents/cells/routable_tokens/

Author and Reviewer Checklist

Please verify the check list and ensure to tick them off before the MR is merged.

  • Provided a concise title for this Merge Request (MR)
  • Added a description to this MR explaining the reasons for the proposed change, per say why, not just what
    • Copy/paste the Slack conversation to document it for later, or upload screenshots. Verify that no confidential data is added, and the content is SAFE
  • Assign reviewers for this MR to the correct Directly Responsible Individual/s (DRI)
    • If the DRI for the page/s being updated isn’t immediately clear, then assign it to one of the people listed in the Maintained by section on the page being edited
    • If your manager does not have merge rights, please ask someone to merge it AFTER it has been approved by your manager in #mr-buddies
    • The when to get approval handbook section explains the workflow in more detail
  • For transparency, share this MR with the audience that will be impacted.
    • Team: For changes that affect your direct team, share in your group Slack channel
    • Department: If the update affects your department, share the MR in your department Slack channel
    • Division: If the update affects your division, share the MR in your division Slack channel
    • Company: If the update affects all (or the majority of) GitLab team members, post an update in #whats-happening-at-gitlab linking to this MR

Commits

  • Change routable token payload to always be 90 bytes and add a checksum

Edited by Rémy Coutable

Merge request reports

Loading