Skip to content

Commit 4eec2d6

Browse files
author
蔡耀賢
committed
Merge branch 'fix-activesupport-security-bug' into 'master'
Patch 1.2.0 See merge request kdanmobile/shared-code-base/gems/error_response!45
2 parents bbf3d8a + 52808ab commit 4eec2d6

15 files changed

Lines changed: 270 additions & 84 deletions

.gitlab-ci.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,37 @@ include:
66
stages:
77
- test
88
- sast_upload
9+
- lint
910
- rspec
1011
- publish
1112

13+
rubocop:
14+
stage: lint
15+
image: ruby:3.4.8
16+
tags:
17+
- arm64
18+
script:
19+
- bundle install
20+
- bundle exec rubocop
21+
rules:
22+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
23+
- if: $CI_COMMIT_BRANCH == "master"
24+
1225
rspec:
1326
stage: rspec
14-
image: ruby:3.4.5
27+
image: ruby:3.4.8
1528
tags:
1629
- arm64
1730
script:
1831
- bundle install
1932
- rspec spec
20-
only:
21-
- master
33+
rules:
34+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
35+
- if: $CI_COMMIT_BRANCH == "master"
2236

2337
to_gem:
2438
stage: publish
25-
image: ruby:3.4.5
39+
image: ruby:3.4.8
2640
tags:
2741
- arm64
2842
script:
@@ -34,5 +48,5 @@ to_gem:
3448
- GEM_NAME=error_response-$RELEASE_VERSION.gem
3549
- gem build error_response.gemspec
3650
- gem push $GEM_NAME
37-
only:
38-
- /release-\d+\.\d+\.\d+(\.\d+)?/
51+
rules:
52+
- if: '$CI_COMMIT_TAG =~ /^release-\d+\.\d+\.\d+(\.\d+)?$/'

.rubocop.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
plugins:
2+
- rubocop-performance
3+
4+
AllCops:
5+
NewCops: enable
6+
TargetRubyVersion: 3.0
7+
Exclude:
8+
- 'bin/**/*'
9+
- 'pkg/**/*'
10+
- 'vendor/**/*'
11+
12+
Layout/LineLength:
13+
Max: 200
14+
15+
Style/Documentation:
16+
Enabled: false
17+
18+
Style/StringLiterals:
19+
Enabled: true
20+
EnforcedStyle: double_quotes
21+
22+
Metrics/MethodLength:
23+
Max: 25
24+
25+
Metrics/AbcSize:
26+
Max: 25
27+
28+
Metrics/CyclomaticComplexity:
29+
Max: 10
30+
31+
Metrics/PerceivedComplexity:
32+
Max: 10
33+
34+
Metrics/BlockLength:
35+
Exclude:
36+
- 'spec/**/*'
37+
38+
Metrics/ParameterLists:
39+
Max: 10
40+
41+
Naming/VariableNumber:
42+
Enabled: false

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.4.5
1+
3.4.8

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## [1.2.0] - 2026-03-24
2+
- Patch activesupport to 7.2.3.1.
3+
- Fix possible ReDoS vulnerability in `number_to_delimited`.
4+
- Fix possible XSS vulnerability in `ActiveSupport::SafeBuffer#%`.
5+
- Add SECURITY.md.
6+
- Add README.md link to the security policy.
7+
- Add RSpec coverage for loading remote error definitions.
8+
- Add RuboCop configuration and clean up lint issues.
9+
- Improve remote YAML loading safety.
110
## [1.1.6] - 2025-07-18
211
- Fix readme typo.
312
## [1.1.5] - 2025-07-16

Gemfile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
source 'https://rubygems.org'
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
24

35
gemspec
46

5-
gem 'irb', '~> 1.15.2'
6-
gem 'rspec', '~> 3.13.1'
7+
group :development, :test do
8+
gem "irb", "~> 1.17.0"
9+
gem "rspec", "~> 3.13.2"
10+
gem "rubocop", "~> 1.85.1"
11+
gem "rubocop-performance", "~> 1.26.1"
12+
end

Gemfile.lock

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
PATH
22
remote: .
33
specs:
4-
error_response (1.1.6)
4+
error_response (1.2.0)
5+
activesupport (~> 7.2.3.1)
56

67
GEM
78
remote: https://rubygems.org/
89
specs:
9-
activesupport (7.1.5.1)
10+
activesupport (7.2.3.1)
1011
base64
1112
benchmark (>= 0.3)
1213
bigdecimal
13-
concurrent-ruby (~> 1.0, >= 1.0.2)
14+
concurrent-ruby (~> 1.0, >= 1.3.1)
1415
connection_pool (>= 2.2.5)
1516
drb
1617
i18n (>= 1.6, < 2)
1718
logger (>= 1.4.2)
18-
minitest (>= 5.1)
19-
mutex_m
19+
minitest (>= 5.1, < 6)
2020
securerandom (>= 0.3)
21-
tzinfo (~> 2.0)
21+
tzinfo (~> 2.0, >= 2.0.5)
22+
addressable (2.8.9)
23+
public_suffix (>= 2.0.2, < 8.0)
24+
ast (2.4.3)
2225
base64 (0.3.0)
2326
benchmark (0.4.1)
2427
bigdecimal (3.2.2)
@@ -29,20 +32,37 @@ GEM
2932
i18n (1.14.7)
3033
concurrent-ruby (~> 1.0)
3134
io-console (0.8.1)
32-
irb (1.15.2)
35+
irb (1.17.0)
3336
pp (>= 0.6.0)
37+
prism (>= 1.3.0)
3438
rdoc (>= 4.0.0)
3539
reline (>= 0.4.2)
40+
json (2.19.2)
41+
json-schema (6.2.0)
42+
addressable (~> 2.8)
43+
bigdecimal (>= 3.1, < 5)
44+
language_server-protocol (3.17.0.5)
45+
lint_roller (1.1.0)
3646
logger (1.7.0)
47+
mcp (0.9.2)
48+
json-schema (>= 4.1)
3749
minitest (5.25.5)
38-
mutex_m (0.3.0)
50+
parallel (1.27.0)
51+
parser (3.3.10.2)
52+
ast (~> 2.4.1)
53+
racc
3954
pp (0.6.2)
4055
prettyprint
4156
prettyprint (0.2.0)
57+
prism (1.9.0)
58+
public_suffix (7.0.5)
59+
racc (1.8.1)
60+
rainbow (3.1.1)
4261
rdoc (6.3.4.1)
62+
regexp_parser (2.11.3)
4363
reline (0.6.1)
4464
io-console (~> 0.5)
45-
rspec (3.13.1)
65+
rspec (3.13.2)
4666
rspec-core (~> 3.13.0)
4767
rspec-expectations (~> 3.13.0)
4868
rspec-mocks (~> 3.13.0)
@@ -55,18 +75,42 @@ GEM
5575
diff-lcs (>= 1.2.0, < 2.0)
5676
rspec-support (~> 3.13.0)
5777
rspec-support (3.13.4)
78+
rubocop (1.85.1)
79+
json (~> 2.3)
80+
language_server-protocol (~> 3.17.0.2)
81+
lint_roller (~> 1.1.0)
82+
mcp (~> 0.6)
83+
parallel (~> 1.10)
84+
parser (>= 3.3.0.2)
85+
rainbow (>= 2.2.2, < 4.0)
86+
regexp_parser (>= 2.9.3, < 3.0)
87+
rubocop-ast (>= 1.49.0, < 2.0)
88+
ruby-progressbar (~> 1.7)
89+
unicode-display_width (>= 2.4.0, < 4.0)
90+
rubocop-ast (1.49.1)
91+
parser (>= 3.3.7.2)
92+
prism (~> 1.7)
93+
rubocop-performance (1.26.1)
94+
lint_roller (~> 1.1)
95+
rubocop (>= 1.75.0, < 2.0)
96+
rubocop-ast (>= 1.47.1, < 2.0)
97+
ruby-progressbar (1.13.0)
5898
securerandom (0.4.1)
5999
tzinfo (2.0.6)
60100
concurrent-ruby (~> 1.0)
101+
unicode-display_width (3.2.0)
102+
unicode-emoji (~> 4.1)
103+
unicode-emoji (4.2.0)
61104

62105
PLATFORMS
63106
ruby
64107

65108
DEPENDENCIES
66-
activesupport (~> 7.1.5.1)
67109
error_response!
68-
irb (~> 1.15.2)
69-
rspec (~> 3.13.1, ~> 3.0)
110+
irb (~> 1.17.0)
111+
rspec (~> 3.13.2)
112+
rubocop (~> 1.85.1)
113+
rubocop-performance (~> 1.26.1)
70114

71115
BUNDLED WITH
72-
2.7.0
116+
2.7.2

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Error Response
22

3+
[![Gem Version](https://badge.fury.io/rb/error_response.svg?icon=si%3Arubygems)](https://badge.fury.io/rb/error_response)
4+
35
`Error Response` is a json response gem to help you easily manage all your custom error statuses in your Rails application.
46

57
## Installation
@@ -158,6 +160,10 @@ gives you
158160
}
159161
```
160162

163+
## Security
164+
165+
If you would like to report a security issue, please review the [Security Policy](SECURITY.md).
166+
161167
## License
162168

163169
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

SECURITY.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
Security fixes are provided for the latest released version of `error_response`.
6+
7+
If you report a vulnerability, please verify whether it can still be reproduced on the latest release before submitting the report.
8+
9+
## Reporting a Vulnerability
10+
11+
Please report security issues privately by email:
12+
13+
- `dev@kdanmobile.com`
14+
15+
To help us investigate quickly, please include:
16+
17+
- A clear description of the issue
18+
- The affected `error_response` version
19+
- Your Ruby and Rails versions, if applicable
20+
- Steps to reproduce the issue
21+
- A proof of concept or sample payload, if available
22+
- The expected impact and any known workarounds
23+
24+
Please do not open public issues for suspected security vulnerabilities.
25+
26+
## Response Process
27+
28+
After receiving a report, we will:
29+
30+
- Confirm whether the issue can be reproduced
31+
- Assess the impact and affected versions
32+
- Prepare and release a fix when necessary
33+
- Publish the relevant update through the normal project release process
34+
35+
Response time may vary depending on severity and reproduction complexity.
36+
37+
## Disclosure Policy
38+
39+
Please allow time for investigation and remediation before making any public disclosure.
40+
41+
We appreciate responsible disclosure and coordinated reporting.

VERSION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.6
1+
1.2.0

error_response.gemspec

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1+
# frozen_string_literal: true
2+
13
Gem::Specification.new do |s|
2-
s.name = 'error_response'
4+
s.name = "error_response"
35
s.version = File.read("./VERSION.md")
4-
s.date = Time.now.strftime('%F')
56
s.summary = "A tool for API error response"
67
s.description = "use for error_response"
78
s.authors = ["Kdan Mobile Software Developer"]
8-
s.email = 'dev@kdanmobile.com'
9-
s.homepage = 'https://github.com/kdan-mobile-software-ltd/error_response'
10-
s.license = 'MIT'
9+
s.email = "dev@kdanmobile.com"
10+
s.homepage = "https://github.com/kdan-mobile-software-ltd/error_response"
11+
s.license = "MIT"
1112
s.files = Dir["lib/**/*"]
12-
s.require_path = ["lib"]
13-
s.required_ruby_version = '>= 2.7'
13+
s.require_path = ["lib"]
14+
s.required_ruby_version = ">= 3.0"
1415
s.metadata = {
1516
"source_code_uri" => "https://github.com/kdan-mobile-software-ltd/error_response",
16-
"changelog_uri" => "https://github.com/kdan-mobile-software-ltd/error_response/blob/master/CHANGELOG.md"
17+
"changelog_uri" => "https://github.com/kdan-mobile-software-ltd/error_response/blob/master/CHANGELOG.md",
18+
"rubygems_mfa_required" => "true"
1719
}
1820

19-
s.add_development_dependency 'activesupport', '~> 7.1.5.1'
20-
s.add_development_dependency 'rspec', '~> 3.0'
21+
s.add_dependency "activesupport", "~> 7.2.3.1"
2122
end

0 commit comments

Comments
 (0)