From 6aa33fa334a1ce68d1bdd66702b03ba020ff0fee Mon Sep 17 00:00:00 2001 From: Drew Bomhof Date: Thu, 26 Mar 2020 09:14:22 -0400 Subject: [PATCH 1/2] Remove POST PATCH as available redirect options --- lib/insights/api/common/routing.rb | 2 +- spec/lib/insights/api/common/routing_spec.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/insights/api/common/routing.rb b/lib/insights/api/common/routing.rb index aba00b90..1ece7b91 100644 --- a/lib/insights/api/common/routing.rb +++ b/lib/insights/api/common/routing.rb @@ -8,7 +8,7 @@ def initialize(route_mapper) @route_mapper = route_mapper end - def redirect_major_version(version, prefix, via: [:delete, :get, :options, :patch, :post]) + def redirect_major_version(version, prefix, via: [:delete, :get, :options]) route_mapper.match( "/#{version.split('.').first}/*path(.:format)", :format => false, diff --git a/spec/lib/insights/api/common/routing_spec.rb b/spec/lib/insights/api/common/routing_spec.rb index 3d41087d..a2b70fda 100644 --- a/spec/lib/insights/api/common/routing_spec.rb +++ b/spec/lib/insights/api/common/routing_spec.rb @@ -1,5 +1,6 @@ RSpec.describe Insights::API::Common::Routing, :type => :request do let(:expected_version) { "v0.1" } + let(:major_version) { "v1" } describe("/api/v0") do it "sanity test for a regular resource" do @@ -25,5 +26,9 @@ expect(response.status).to eq(200) expect(response.headers["Location"]).to be_nil end + + it "does not allow redirects to a POST endpoint" do + expect { post("/api/#{major_version}/graphql") }.to raise_exception(ActionController::RoutingError) + end end end From 3ed05952230ddddd109b6f74b49d684b0e37edc7 Mon Sep 17 00:00:00 2001 From: Drew Bomhof Date: Fri, 25 Sep 2020 17:16:57 -0400 Subject: [PATCH 2/2] Added versioon and CHANGELOG to promote new minor version --- CHANGELOG.md | 72 +++++++++++++++++++++++++++++- lib/insights/api/common/version.rb | 2 +- 2 files changed, 72 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54508b59..d8bc7df4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,65 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [4.1.4] - 2020-09-25 +### Changed +- Remove POST / PATCH from redirects #173 + +## [4.1.3] - 2020-08-26 +### Changed +- Pin cloudwatchlogger gem to ~> 0.2.1 #207 + +## [4.1.2] - 2020-07-30 +### Added +- Add openapi-validator.sh script for reference from API repos. #202 +- Add github workflow to release to rubygems automatically #199 +### Changed +- Define custom metric methods even if port is zero #203 +- Make sure Pundit exception's query type is String #205 +- Excluding existing 'nullable' attributes #198 + +## [4.1.1] - 2020-06-09 +### Added +- Add the ability to disable metrics by setting METRICS_PORT=0 #196 +### Changed +- Handle Pundit::NotAuthorizedError exceptions differently than general exceptions #185 + +## [4.1.0] - 2020-06-02 +### Changed +- Improve serializer to exclude attributes that should not be needed #181 + +## [4.0.3] - 2020-05-13 +### Added +- Add support for custom prometheus metrics defined by the application #184 + +## [4.0.2] - 2020-05-13 +### Added +- Enforce unique operation ids #182 +- ManangeIQ Logger is deprecating the use of current_request #183 +- The status field in the error object is string #188 +- Switched to insights-rbac-api-client from rubygems #189 + + +## [4.0.1] - 2020-04-27 +### Added +- Percolate errors from different micro services #180 + +## [4.0.0] - 2020-04-15 +### Added +- Added args to the base_query call #177 + +## [3.10.0] - 2020-04-14 +### Added +- Remove the RBAC Client limit and offset parameters to get data in single call #175 +- Use rack to get proper status code from symbols #179 + +## [3.9.0] - 2020-04-02 +### Added +- Update documentation for sort_by and filter with associations #170 +- Upgrade openapi_parser dependency #174 +- Enable filtering by association attributes #159 +- RBAC: Implement group_uuid filtering #172 + ## [3.8.0] - 2020-03-24 ### Added - RBAC - Added support for scopes in permissions #171 @@ -134,7 +193,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.1.0] - 2019-09-24 ### Initial release to rubygems.org -[Unreleased]: https://github.com/RedHatInsights/insights-api-common-rails/compare/v3.8.0...HEAD +[Unreleased]: https://github.com/RedHatInsights/insights-api-common-rails/compare/v4.1.4...HEAD +[4.1.4]: https://github.com/RedHatInsights/insights-api-common-rails/compare/v4.1.3...v4.1.4 +[4.1.3]: https://github.com/RedHatInsights/insights-api-common-rails/compare/v4.1.2...v4.1.3 +[4.1.2]: https://github.com/RedHatInsights/insights-api-common-rails/compare/v4.1.1...v4.1.2 +[4.1.1]: https://github.com/RedHatInsights/insights-api-common-rails/compare/v4.1.0...v4.1.1 +[4.1.0]: https://github.com/RedHatInsights/insights-api-common-rails/compare/v4.0.3...v4.1.0 +[4.0.3]: https://github.com/RedHatInsights/insights-api-common-rails/compare/v4.0.2...v4.0.3 +[4.0.2]: https://github.com/RedHatInsights/insights-api-common-rails/compare/v4.0.1...v4.0.2 +[4.0.1]: https://github.com/RedHatInsights/insights-api-common-rails/compare/v4.0.0...v4.0.1 +[4.0.0]: https://github.com/RedHatInsights/insights-api-common-rails/compare/v3.10.0...v4.0.0 +[3.10.0]: https://github.com/RedHatInsights/insights-api-common-rails/compare/v3.9.0...v3.10.0 +[3.9.0]: https://github.com/RedHatInsights/insights-api-common-rails/compare/v3.8.0...v3.9.0 [3.8.0]: https://github.com/RedHatInsights/insights-api-common-rails/compare/v3.7.0...v3.8.0 [3.7.0]: https://github.com/RedHatInsights/insights-api-common-rails/compare/v3.6.0...v3.7.0 [3.6.0]: https://github.com/RedHatInsights/insights-api-common-rails/compare/v3.5.0...v3.6.0 diff --git a/lib/insights/api/common/version.rb b/lib/insights/api/common/version.rb index 6aa721d9..e49b4212 100644 --- a/lib/insights/api/common/version.rb +++ b/lib/insights/api/common/version.rb @@ -1,7 +1,7 @@ module Insights module API module Common - VERSION = "3.8.0".freeze + VERSION = "4.1.4".freeze end end end