govuk_app_config 9.10.0 → 9.11.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3bf6ae30aec5a886810a0b912444c0b97ea69e939cd8923f7fae4d1a29083f22
4
- data.tar.gz: 7651211aa7ec14d12260e75d3d979fe706c2541d87d3d2ff58dae8cb8b6f61c5
3
+ metadata.gz: 2e328b8f14abd03a18e3f68c5334eca8681fd149b6572bbc30bd2336f32fa4a8
4
+ data.tar.gz: f31ef5725579cb25b04fcc0ddfb75a00e1efedb7e6f6ca838182edea6fdfd0ff
5
5
  SHA512:
6
- metadata.gz: 50113bab587d2bbe40d045020871943cf090a9503c26c100faf642c43f06d3baeeda8f98220622f2fb8fec4c29c4ca51d181d2ff449f7a736efc3dc57ff7fb57
7
- data.tar.gz: e94c092a17c03154d43f0d226f5897c88b2fcc8aefe9b3f3ffca7b0377d7b08328d474024e0d3d8c666a48d21b5b9775c4170a1f25c76f8926bfe4d148ecb0d4
6
+ metadata.gz: 6387c742d5b1e535e8e26b7e60f5161377e410c9a1a974aae32572546746f9e6bed7cbbf09ed2501492106d3db82bf57293f661c116d748e79e5d973f2242ca9
7
+ data.tar.gz: 8b5283cc08344c0975d0cdd5904f380bfd937e87f41f4f89e10c296b4f3eb906d76625160130aea6ad77f399f4e2b0e129e648dd6df1bfb278ddea65ad821704
@@ -0,0 +1,3 @@
1
+ ⚠️ Make sure you [release a new version of this gem](https://github.com/alphagov/govuk_app_config/pull/356/files) after merging your changes. ⚠️
2
+
3
+ Refer to the [existing docs](https://docs.publishing.service.gov.uk/manual/publishing-a-ruby-gem.html#ruby-version-compatibility) if you are making changes to the supported Ruby versions.
@@ -1,7 +1,7 @@
1
1
  on:
2
2
  workflow_dispatch: {}
3
3
  schedule:
4
- - cron: '00 13 * * 2'
4
+ - cron: '30 10 * * 1-5' # 10:30am UTC, Mon-Fri.
5
5
 
6
6
  jobs:
7
7
  autorelease:
@@ -11,17 +11,6 @@ on:
11
11
  type: string
12
12
 
13
13
  jobs:
14
- snyk-security:
15
- name: SNYK security analysis
16
- uses: alphagov/govuk-infrastructure/.github/workflows/snyk-security.yml@main
17
- with:
18
- skip_sca: true
19
- secrets: inherit
20
- permissions:
21
- contents: read
22
- security-events: write
23
- actions: read
24
-
25
14
  codeql-sast:
26
15
  name: CodeQL SAST scan
27
16
  uses: alphagov/govuk-infrastructure/.github/workflows/codeql-analysis.yml@main
data/.gitignore CHANGED
@@ -8,3 +8,5 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  spec/examples.txt
11
+ # simplecov
12
+ coverage/
@@ -1,10 +1,4 @@
1
- api_version: 1
2
- auto_merge:
3
- - dependency: rubocop-govuk
4
- allowed_semver_bumps:
5
- - patch
6
- - minor
7
- - dependency: plek
8
- allowed_semver_bumps:
9
- - patch
10
- - minor
1
+ api_version: 2
2
+ defaults:
3
+ auto_merge: true
4
+ update_external_dependencies: true
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 9.11.1
2
+
3
+ * Fix OpenTelemetry errors when using with Logstasher gem ([#372](https://github.com/alphagov/govuk_app_config/pull/372))
4
+
5
+ # 9.11.0
6
+
7
+ * Add GDS::SSO::PermissionDeniedError to excluded exceptions list ([#366](https://github.com/alphagov/govuk_app_config/pull/366))
8
+
1
9
  # 9.10.0
2
10
 
3
11
  * Simplify the logic for deciding whether to initialize `GovukPrometheusExporter`. `GovukPrometheusExporter` provides the `/metrics` webserver and "exporter" process for aggregating counters in multi-process apps. govuk_app_config will now always attempt to initialize GovukPrometheusExporter except when running under `rails console`. The `GOVUK_PROMETHEUS_EXPORTER` environment variable no longer has any effect.
@@ -39,6 +39,7 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency "rake", "~> 13.0"
40
40
  spec.add_development_dependency "rspec", "~> 3.10"
41
41
  spec.add_development_dependency "rspec-its", "~> 1.3"
42
- spec.add_development_dependency "rubocop-govuk", "4.16.1"
42
+ spec.add_development_dependency "rubocop-govuk", "4.17.1"
43
+ spec.add_development_dependency "simplecov"
43
44
  spec.add_development_dependency "webmock"
44
45
  end
@@ -40,6 +40,7 @@ module GovukError
40
40
  "CGI::Session::CookieStore::TamperedWithCookie",
41
41
  "GdsApi::HTTPIntermittentServerError",
42
42
  "GdsApi::TimedOutException",
43
+ "GDS::SSO::PermissionDeniedError",
43
44
  "Mongoid::Errors::DocumentNotFound",
44
45
  "Puma::HttpParserError",
45
46
  "Sinatra::NotFound",
@@ -0,0 +1,65 @@
1
+ # This is copied from
2
+ # https://github.com/shadabahmed/logstasher/blob/main/lib/logstasher/rails_ext/action_controller/metal/instrumentation.rb
3
+ # Changes have been highlight in comments, otherwise the code is the same.
4
+
5
+ module ActionController
6
+ module Instrumentation
7
+ alias_method "orig_process_action", "process_action"
8
+
9
+ def process_action(*args)
10
+ # The raw payload has been updated to reflect the payload structure used
11
+ # in Rails 7.1, primarily the addition of the `headers`, `request` keys
12
+ # and using `request.filtered_path` instead of `request.fullpath`.
13
+ # https://github.com/rails/rails/blame/d39db5d1891f7509cde2efc425c9d69bbb77e670/actionpack/lib/action_controller/metal/instrumentation.rb#L60
14
+ raw_payload = {
15
+ controller: self.class.name,
16
+ action: action_name,
17
+ request:,
18
+ params: request.filtered_parameters,
19
+ headers: request.headers,
20
+ format: request.format.ref,
21
+ method: request.request_method,
22
+ path: begin
23
+ request.filtered_path
24
+ rescue StandardError
25
+ "unknown"
26
+ end,
27
+ }
28
+
29
+ LogStasher.add_default_fields_to_payload(raw_payload, request)
30
+
31
+ LogStasher.clear_request_context
32
+ LogStasher.add_default_fields_to_request_context(request)
33
+
34
+ ActiveSupport::Notifications.instrument("start_processing.action_controller", raw_payload.dup)
35
+
36
+ ActiveSupport::Notifications.instrument("process_action.action_controller", raw_payload) do |payload|
37
+ if respond_to?(:logstasher_add_custom_fields_to_request_context)
38
+ logstasher_add_custom_fields_to_request_context(LogStasher.request_context)
39
+ end
40
+
41
+ if respond_to?(:logstasher_add_custom_fields_to_payload)
42
+ before_keys = raw_payload.keys.clone
43
+ logstasher_add_custom_fields_to_payload(raw_payload)
44
+ after_keys = raw_payload.keys
45
+ # Store all extra keys added to payload hash in payload itself. This is a thread safe way
46
+ LogStasher::CustomFields.add(*(after_keys - before_keys))
47
+ end
48
+
49
+ result = super
50
+
51
+ payload[:status] = response.status
52
+ append_info_to_payload(payload)
53
+ LogStasher.store.each do |key, value|
54
+ payload[key] = value
55
+ end
56
+
57
+ LogStasher.request_context.each do |key, value|
58
+ payload[key] = value
59
+ end
60
+ result
61
+ end
62
+ end
63
+ alias_method "logstasher_process_action", "process_action"
64
+ end
65
+ end
@@ -16,6 +16,12 @@ module GovukJsonLogging
16
16
  end
17
17
 
18
18
  def self.configure(&block)
19
+ # Fixes the monkey patch from the logstasher gem to support Rails 7
20
+ config = Rails.application.config.logstasher
21
+ if (!config.controller_monkey_patch && config.controller_monkey_patch != false) || config.controller_monkey_patch == true
22
+ require_relative "./govuk_json_logging/rails_ext/action_controller/metal/instrumentation"
23
+ end
24
+
19
25
  configuration = Configuration.new
20
26
 
21
27
  configuration.instance_eval(&block) if block_given?
@@ -1,3 +1,3 @@
1
1
  module GovukAppConfig
2
- VERSION = "9.10.0".freeze
2
+ VERSION = "9.11.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_app_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.10.0
4
+ version: 9.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-10 00:00:00.000000000 Z
11
+ date: 2024-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstasher
@@ -292,14 +292,28 @@ dependencies:
292
292
  requirements:
293
293
  - - '='
294
294
  - !ruby/object:Gem::Version
295
- version: 4.16.1
295
+ version: 4.17.1
296
296
  type: :development
297
297
  prerelease: false
298
298
  version_requirements: !ruby/object:Gem::Requirement
299
299
  requirements:
300
300
  - - '='
301
301
  - !ruby/object:Gem::Version
302
- version: 4.16.1
302
+ version: 4.17.1
303
+ - !ruby/object:Gem::Dependency
304
+ name: simplecov
305
+ requirement: !ruby/object:Gem::Requirement
306
+ requirements:
307
+ - - ">="
308
+ - !ruby/object:Gem::Version
309
+ version: '0'
310
+ type: :development
311
+ prerelease: false
312
+ version_requirements: !ruby/object:Gem::Requirement
313
+ requirements:
314
+ - - ">="
315
+ - !ruby/object:Gem::Version
316
+ version: '0'
303
317
  - !ruby/object:Gem::Dependency
304
318
  name: webmock
305
319
  requirement: !ruby/object:Gem::Requirement
@@ -322,6 +336,7 @@ extensions: []
322
336
  extra_rdoc_files: []
323
337
  files:
324
338
  - ".github/dependabot.yml"
339
+ - ".github/pull_request_template.md"
325
340
  - ".github/workflows/autorelease.yml"
326
341
  - ".github/workflows/ci.yml"
327
342
  - ".gitignore"
@@ -351,6 +366,7 @@ files:
351
366
  - lib/govuk_app_config/govuk_healthcheck/redis.rb
352
367
  - lib/govuk_app_config/govuk_healthcheck/sidekiq_redis.rb
353
368
  - lib/govuk_app_config/govuk_json_logging.rb
369
+ - lib/govuk_app_config/govuk_json_logging/rails_ext/action_controller/metal/instrumentation.rb
354
370
  - lib/govuk_app_config/govuk_open_telemetry.rb
355
371
  - lib/govuk_app_config/govuk_prometheus_exporter.rb
356
372
  - lib/govuk_app_config/govuk_proxy/static_proxy.rb
@@ -377,7 +393,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
377
393
  - !ruby/object:Gem::Version
378
394
  version: '0'
379
395
  requirements: []
380
- rubygems_version: 3.5.7
396
+ rubygems_version: 3.5.11
381
397
  signing_key:
382
398
  specification_version: 4
383
399
  summary: Base configuration for GOV.UK applications