Skip to content
Snippets Groups Projects

Add filepath redirect url for Release assets

Merged Sean Carroll requested to merge 27300-add-filepath-redirect-url into master
All threads resolved!

What does this MR do?

With this change we will allow receipt of urls made up of the project + tag + arbitrary filepath to the actual url stored for a link.

This is complicated by the fact that tags may have or or 1 embedded slashes, and the filepath may have any number of embedded slashes.

Existing Routes

be rake routes | grep project_release | awk '{ print $1, $2, $3, $4 }'

evidence_namespace_project_release GET /*namespace_id/:project_id/-/releases/:tag/evidence(.:format) projects/releases#evidence
namespace_project_releases GET /*namespace_id/:project_id/-/releases(.:format) projects/releases#index
edit_namespace_project_release GET /*namespace_id/:project_id/-/releases/:tag/edit(.:format) projects/releases#edit
namespace_project_release GET /*namespace_id/:project_id/-/releases/:tag(.:format) projects/releases#show

Example possible combinations

No embedded slashes

  • tag: v11.9.0-rc2
  • filepath: /gitlab-runner-linux-amd64.dmg
  • filepath_redirect_url: https://gitlab.com/namespace/project/releases/v11.9.0-rc2/gitlab-runner-linux-amd64.dmg

Embedded slash in tag

  • tag: v11.9.0/rc2
  • filepath: /gitlab-runner-linux-amd64.dmg
  • filepath_redirect_url: https://gitlab.com/namespace/project/releases/v11.9.0/rc2/gitlab-runner-linux-amd64.dmg

Embedded slashes in filepath

  • tag: v11.9.0-rc2
  • filepath: /binaries/v2/gitlab-runner-linux-amd64.dmg
  • filepath_redirect_url: https://gitlab.com/namespace/project/releases/v11.9.0-rc2/binaries/v2/gitlab-runner-linux-amd64.dmg

Embedded slashes in both

  • tag: v11.9.0/rc2
  • filepath: /binaries/v2/gitlab-runner-linux-amd64.dmg
  • filepath_redirect_url: https://gitlab.com/namespace/project/releases/v11.9.0/rc2/binaries/v2/gitlab-runner-linux-amd64.dmg

Filepath rules

  • No embedded double slashes // or colons : allowed
  • single embedded / is allowed
  • Embedded -, _, . are allowed as single or multiple
  • Filepath must begin with a slash
  • Filepath much end with a number or letter
  • Filepath must be a valid url fragment
  • UTF-8 (accented) characters are not allowed

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Part of #27300 (closed)

Edited by Sean Carroll

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Peter Leitzen
  • Sean Carroll added 1 commit

    added 1 commit

    • 3113de08 - Apply suggestion to app/controllers/projects/releases_controller.rb

    Compare with previous version

  • Sean Carroll added 1 commit

    added 1 commit

    • 00f60fdf - Apply suggestion to spec/controllers/projects/releases_controller_spec.rb

    Compare with previous version

  • Sean Carroll added 1 commit

    added 1 commit

    Compare with previous version

  • Sean Carroll added 1 commit

    added 1 commit

    Compare with previous version

  • Sean Carroll mentioned in merge request !26370 (merged)

    mentioned in merge request !26370 (merged)

  • Sean Carroll added 1 commit

    added 1 commit

    Compare with previous version

  • Sean Carroll resolved all threads

    resolved all threads

  • added workflowin review label and removed workflowin dev label

  • Sean Carroll added 1 commit

    added 1 commit

    Compare with previous version

  • Reviewer roulette

    Changes that require review have been detected! A merge request is normally reviewed by both a reviewer and a maintainer in its primary category (e.g. frontend or backend), and by a maintainer in all other categories.

    To spread load more evenly across eligible reviewers, Danger has randomly picked a candidate for each review slot. Feel free to override this selection if you think someone else would be better-suited, or the chosen person is unavailable.

    To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines.

    Once you've decided who will review this merge request, mention them as you normally would! Danger does not (yet?) automatically notify them for you.

    Category Reviewer Maintainer
    backend Brett Walker (@digitalmoksha) Grzegorz Bizon (@grzesiek)

    Generated by :no_entry_sign: Danger

  • Sean Carroll resolved all threads

    resolved all threads

  • Peter Leitzen approved this merge request

    approved this merge request

  • Peter Leitzen resolved all threads

    resolved all threads

  • merged

  • Peter Leitzen mentioned in commit a9bd44b2

    mentioned in commit a9bd44b2

  • Sean Carroll mentioned in commit 421fbbbf

    mentioned in commit 421fbbbf

  • Sean Carroll resolved all threads

    resolved all threads

  • added workflowstaging label and removed workflowin review label

  • added workflowcanary label and removed workflowstaging label

  • Sean Carroll mentioned in commit 13471854

    mentioned in commit 13471854

  • mentioned in issue #211622 (closed)

  • mentioned in issue #213016 (closed)

  • mentioned in issue #296841 (closed)

  • Please register or sign in to reply
    Loading