Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make path param regex more strict #83

Merged
merged 40 commits into from
Mar 11, 2020
Merged

Conversation

llhhaa
Copy link
Contributor

@llhhaa llhhaa commented Mar 7, 2020

Description

In upgrading from 2.6 to 3.4, we were noticing some mysterious behavior in our VersionCake-managed API. Most requests to the API were fine, but a small, seemingly random subset were having their version parsed as 0, resulting in an UnsupportedVersionError.

The format of our API paths includes encoded parameters, which look like /api/resource/ynv0-00c5-96ua?api_version=5. It turns out that the path parameter extraction strategy was yanking the v0 out of ynv0-00c5-96ua and interpreting that as the API version. To resolve this in our app, I replaced :path_parameter with a near-identical custom one, except with more strict regex - end-of-string anchors on either side of the version to be extracted.

That a path parameter version will always take the format of /\Av\d+\z/ seems like the original intent of the strategy and a reasonable constraint on its use, such that it should be part of the builtin.

Changes

  • Add end-of-string anchors to path parameter regex. Add tests covering the change.

bwillis and others added 30 commits May 7, 2017 18:51
…upport

Removes legacy Ruby/Rails support
Adding minimum Rails support to 5 and upgrading security patches
Bumps [actionview](https://github.com/rails/rails) from 5.1.4 to 5.2.4.1.
- [Release notes](https://github.com/rails/rails/releases)
- [Changelog](https://github.com/rails/rails/blob/v6.0.2.1/actionview/CHANGELOG.md)
- [Commits](rails/rails@v5.1.4...v5.2.4.1)

Signed-off-by: dependabot[bot] <support@github.com>
…iew-5.2.4.1

Bump actionview from 5.1.4 to 5.2.4.1
@bwillis
Copy link
Owner

bwillis commented Mar 11, 2020

Nice investigation and thanks for fixing! I've just resolved some long outstanding CI pipeline issues and rebased so hopefully CI passes now!

@bwillis bwillis added this to the v4 milestone Mar 11, 2020
@bwillis bwillis merged commit 057ad3a into bwillis:master Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants