Skip to content

Commit 925df62

Browse files
committed
Refactor bundle configuration and improve logging level for JSON parsing errors
1 parent 61ece3f commit 925df62

File tree

4 files changed

+3
-12
lines changed

4 files changed

+3
-12
lines changed

.bundle/config

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
22
BUNDLE_BIN: "bin"
3-
BUNDLE_PATH: "/home/runner/work/hooks/hooks/vendor/bundle"
3+
BUNDLE_PATH: "vendor/gems"
44
BUNDLE_CACHE_PATH: "vendor/cache"
55
BUNDLE_CACHE_ALL: "true"
66
BUNDLE_SPECIFIC_PLATFORM: "true"
77
BUNDLE_NO_INSTALL: "true"
8-
BUNDLE_DEPLOYMENT: "true"

lib/hooks.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
require_relative "hooks/version"
44
require_relative "hooks/core/builder"
5-
6-
# Load core components explicitly for better performance and security
75
require_relative "hooks/core/config_loader"
86
require_relative "hooks/core/config_validator"
97
require_relative "hooks/core/logger_factory"
@@ -12,8 +10,6 @@
1210
require_relative "hooks/core/log"
1311
require_relative "hooks/core/failbot"
1412
require_relative "hooks/core/stats"
15-
16-
# Load essential plugins explicitly
1713
require_relative "hooks/plugins/auth/base"
1814
require_relative "hooks/plugins/auth/hmac"
1915
require_relative "hooks/plugins/auth/shared_secret"
@@ -24,12 +20,8 @@
2420
require_relative "hooks/plugins/instruments/failbot_base"
2521
require_relative "hooks/plugins/instruments/stats"
2622
require_relative "hooks/plugins/instruments/failbot"
27-
28-
# Load utils explicitly
2923
require_relative "hooks/utils/normalize"
3024
require_relative "hooks/utils/retry"
31-
32-
# Load security module
3325
require_relative "hooks/security"
3426
require_relative "hooks/version"
3527

lib/hooks/app/helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def parse_payload(raw_body, headers, symbolize: true)
6161
# If JSON parsing fails or security limits exceeded, return raw body
6262
# Log security violations at debug level to avoid log spam
6363
if e.message.include?("nesting") || e.message.include?("depth")
64-
log.debug("JSON parsing security limit exceeded: #{e.message}")
64+
log.warn("JSON parsing security limit exceeded: #{e.message}")
6565
end
6666
end
6767
end

spec/unit/lib/hooks/app/helpers_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def error!(message, code)
236236
# Mock logger to capture debug messages
237237
logger = instance_double("Logger")
238238
allow(helper).to receive(:log).and_return(logger)
239-
expect(logger).to receive(:debug).with(/JSON parsing security limit exceeded/)
239+
expect(logger).to receive(:warn).with(/JSON parsing security limit exceeded/)
240240

241241
# Mock the safe_json_parse method to simulate nesting limit exceeded
242242
allow(helper).to receive(:safe_json_parse).and_raise(ArgumentError, "nesting exceeded")

0 commit comments

Comments
 (0)