govuk_app_config 9.6.0 → 9.8.0

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: c15ac7d4a7297bc830a60b2877bc36d0e1b046fe2a498a0006b29b58ce9a0fec
4
- data.tar.gz: 323f249a17a7806f176e88d060e7c99ac0eb54f0244815534056e2820e70f9e0
3
+ metadata.gz: 9842df0c29ae508b504907d58d8bfbdb31cde911e7d59b4236be45eea6fd4054
4
+ data.tar.gz: e75ffd357becba4eb101c00fb82573fc556af88255efa2109f54a9257559f47d
5
5
  SHA512:
6
- metadata.gz: 8d514827abb88965374c9213b700ba05f9fdb3f65098f403d4e583581da768ebb6aa512b8b38adeae4818e839186443a011dfc3dd9ee7e1fc101363cd2721f3d
7
- data.tar.gz: 319470197ea8a8ead9e29ba6e01b347215c62d472be68d94eaf58223a0e4b350a1046cee03c2aafef5d8e3828a34e802400eb60ea2322c93e6c5da277230d856
6
+ metadata.gz: c3c3cb9a9a79c113bb23e7281b26bad0f17825ec6ad53903d323c5a74fced1fb9f0b5189aa97be424fc8090f20c3c433fe23b2af75568d26fd492e3f55c51929
7
+ data.tar.gz: 1b14f98b1f155e8182e51d50ca1cd7146c357246f835d282f63aa1c92f5f7b2898ec4551934e8c351b982fbfbe68e8a03b67d61c48c8d8b36cc629baf5f63564
@@ -11,6 +11,16 @@ on:
11
11
  type: string
12
12
 
13
13
  jobs:
14
+ codeql-sast:
15
+ name: CodeQL SAST scan
16
+ uses: alphagov/govuk-infrastructure/.github/workflows/codeql-analysis.yml@main
17
+ permissions:
18
+ security-events: write
19
+
20
+ dependency-review:
21
+ name: Dependency Review scan
22
+ uses: alphagov/govuk-infrastructure/.github/workflows/dependency-review.yml@main
23
+
14
24
  # Run the test suite against multiple Ruby and Rails versions
15
25
  test_matrix:
16
26
  strategy:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 9.8.0
2
+
3
+ * Add GOVUK domains to script src CSP ([#334](https://github.com/alphagov/govuk_app_config/pull/334))
4
+
5
+ # 9.7.0
6
+
7
+ * Enable adding custom LogStasher fields from apps ([#327](https://github.com/alphagov/govuk_app_config/pull/327))
8
+
1
9
  # 9.6.0
2
10
 
3
11
  * Allow YouTube thumbnails from https://i.ytimg.com in the global Content Security Policy ([#328](https://github.com/alphagov/govuk_app_config/pull/328))
data/README.md CHANGED
@@ -149,6 +149,20 @@ allow JSON format logs and `Govuk-Request-Id` to be visible.
149
149
  For development logs, in order to see the production style logs, developers should
150
150
  set `GOVUK_RAILS_JSON_LOGGING`in `govuk-docker` -> `docker-compose` files.
151
151
 
152
+ ### Logger configuration
153
+
154
+ To include additional custom fields in your Rails logs, you can declare them
155
+ within a `GovukJsonLogging.configure` block in a `config/initializers/` file.
156
+
157
+ Example of adding a key/value to log entries based on a request header:
158
+
159
+ ```ruby
160
+ GovukJsonLogging.configure do
161
+ add_custom_fields do |fields|
162
+ fields[:govuk_custom_field] = request.headers["GOVUK-Custom-Header"]
163
+ end
164
+ end
165
+ ```
152
166
 
153
167
  ## Content Security Policy generation
154
168
 
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_dependency "logstasher", "~> 2.1"
24
24
  spec.add_dependency "opentelemetry-exporter-otlp", ">= 0.25", "< 0.27"
25
- spec.add_dependency "opentelemetry-instrumentation-all", ">= 0.39.1", "< 0.52.0"
25
+ spec.add_dependency "opentelemetry-instrumentation-all", ">= 0.39.1", "< 0.55.0"
26
26
  spec.add_dependency "opentelemetry-sdk", "~> 1.2"
27
27
  spec.add_dependency "plek", ">= 4", "< 6"
28
28
  spec.add_dependency "prometheus_exporter", "~> 2.0"
@@ -51,6 +51,7 @@ module GovukContentSecurityPolicy
51
51
  policy.script_src :self,
52
52
  *GOOGLE_ANALYTICS_DOMAINS,
53
53
  *GOOGLE_STATIC_DOMAINS,
54
+ *GOVUK_DOMAINS,
54
55
  # Allow YouTube Embeds (Govspeak turns YouTube links into embeds)
55
56
  "*.ytimg.com",
56
57
  "www.youtube.com",
@@ -3,7 +3,23 @@ require "logstasher"
3
3
  require "action_controller"
4
4
 
5
5
  module GovukJsonLogging
6
- def self.configure
6
+ class Configuration
7
+ def initialize
8
+ @custom_fields_block = proc {}
9
+ end
10
+
11
+ attr_reader :custom_fields_block
12
+
13
+ def add_custom_fields(&block)
14
+ @custom_fields_block = block if block_given?
15
+ end
16
+ end
17
+
18
+ def self.configure(&block)
19
+ configuration = Configuration.new
20
+
21
+ configuration.instance_eval(&block) if block_given?
22
+
7
23
  # We disable buffering, so that logs aren't lost on crash or delayed
8
24
  # indefinitely while troubleshooting.
9
25
  $stdout.sync = true
@@ -31,6 +47,8 @@ module GovukJsonLogging
31
47
  fields[:govuk_request_id] = request.headers["GOVUK-Request-Id"]
32
48
  fields[:varnish_id] = request.headers["X-Varnish"]
33
49
  fields[:govuk_app_config] = GovukAppConfig::VERSION
50
+
51
+ instance_exec(fields, &configuration.custom_fields_block) if block_given?
34
52
  end
35
53
 
36
54
  Rails.application.config.logstasher.enabled = true
@@ -1,3 +1,3 @@
1
1
  module GovukAppConfig
2
- VERSION = "9.6.0".freeze
2
+ VERSION = "9.8.0".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.6.0
4
+ version: 9.8.0
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: 2023-11-17 00:00:00.000000000 Z
11
+ date: 2023-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstasher
@@ -53,7 +53,7 @@ dependencies:
53
53
  version: 0.39.1
54
54
  - - "<"
55
55
  - !ruby/object:Gem::Version
56
- version: 0.52.0
56
+ version: 0.55.0
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -63,7 +63,7 @@ dependencies:
63
63
  version: 0.39.1
64
64
  - - "<"
65
65
  - !ruby/object:Gem::Version
66
- version: 0.52.0
66
+ version: 0.55.0
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: opentelemetry-sdk
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -375,7 +375,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
375
375
  - !ruby/object:Gem::Version
376
376
  version: '0'
377
377
  requirements: []
378
- rubygems_version: 3.4.22
378
+ rubygems_version: 3.5.1
379
379
  signing_key:
380
380
  specification_version: 4
381
381
  summary: Base configuration for GOV.UK applications