pact_broker 2.96.0 → 2.97.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/Gemfile +1 -0
  4. data/docs/CONFIGURATION.md +98 -66
  5. data/lib/db.rb +1 -7
  6. data/lib/pact_broker/api/middleware/http_debug_logs.rb +36 -0
  7. data/lib/pact_broker/app.rb +1 -7
  8. data/lib/pact_broker/config/runtime_configuration.rb +20 -3
  9. data/lib/pact_broker/config/runtime_configuration_coercion_methods.rb +11 -0
  10. data/lib/pact_broker/config/runtime_configuration_database_methods.rb +1 -1
  11. data/lib/pact_broker/config/runtime_configuration_logging_methods.rb +7 -2
  12. data/lib/pact_broker/configuration.rb +2 -0
  13. data/lib/pact_broker/db/models.rb +2 -2
  14. data/lib/pact_broker/index/service.rb +1 -2
  15. data/lib/pact_broker/integrations/integration.rb +21 -6
  16. data/lib/pact_broker/integrations/service.rb +1 -1
  17. data/lib/pact_broker/matrix/repository.rb +2 -3
  18. data/lib/pact_broker/matrix/service.rb +0 -1
  19. data/lib/pact_broker/metrics/service.rb +2 -2
  20. data/lib/pact_broker/pacts/pact_publication.rb +9 -6
  21. data/lib/pact_broker/pacts/pact_version.rb +24 -28
  22. data/lib/pact_broker/pacts/pact_version_association_loaders.rb +36 -0
  23. data/lib/pact_broker/pacts/pacts_for_verification_repository.rb +9 -13
  24. data/lib/pact_broker/pacts/repository.rb +29 -27
  25. data/lib/pact_broker/test/http_test_data_builder.rb +8 -1
  26. data/lib/pact_broker/test/test_data_builder.rb +2 -1
  27. data/lib/pact_broker/ui/controllers/matrix.rb +14 -11
  28. data/lib/pact_broker/version.rb +1 -1
  29. data/pact_broker.gemspec +1 -1
  30. metadata +9 -16
  31. data/lib/pact_broker/matrix/aggregated_row.rb +0 -79
  32. data/lib/pact_broker/matrix/head_row.rb +0 -80
  33. data/lib/pact_broker/matrix/row.rb +0 -287
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e08b2792c380c3066af4817bc219cc3dc134860b2769a6608e3d625269d53f7d
4
- data.tar.gz: be1cefe3b370f3b227bff1330af71dd5a0adcfd609a7ae4fd1d1b144c76fe7a1
3
+ metadata.gz: 42a4c440061063f19b90c35a0d680f6d2a9802df42e3b4fc4b93031a6e8efb72
4
+ data.tar.gz: 7e4acbf7aab9709d30db431a1fc2cee5048934f17170b76f5788ad9db9115e72
5
5
  SHA512:
6
- metadata.gz: 24dbb88676eb61e1e5809b54ef9cb6cae4d33093beefbe1e9140c0e43f68561aa0ef765cc176e5da04415964410dbc4f18b2393f6426a2b40dbf0826d86a5ff4
7
- data.tar.gz: d3fdd055d91ba7b563b258c49fb666a17518432a72c8faa818ffc5dfd2c20a6095c82390ccc71c5c1f1a888e8aa7319d530d0d6c3fefe83170a5fab4320f724d
6
+ metadata.gz: c06b5cc6227a1141d5e5ccd02701096b4987d26860baf8836431317a26f7809fddefb41c355115bd485a39f8f44eee94884f164c36b7c8bbfacbaf0e62bd1e49
7
+ data.tar.gz: 0c55019fbfb51cdb54bdc23896164a17621b927fed18eb5807cf5c4392723ec052baaff6aeabf61ed887e910eccd18afde0b7511349b2475b5cd3ec42ca4d4f6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ <a name="v2.97.0"></a>
2
+ ### v2.97.0 (2022-03-29)
3
+
4
+ #### Features
5
+
6
+ * **webhook certificates**
7
+ * support setting webhook certificates using environment variables ([82c7a7e5](/../../commit/82c7a7e5))
8
+
9
+ #### Bug Fixes
10
+
11
+ * do not set postgres connection driver options if database_statement_timeout is nil ([adec4b00](/../../commit/adec4b00))
12
+
1
13
  <a name="v2.96.0"></a>
2
14
  ### v2.96.0 (2022-03-21)
3
15
 
data/Gemfile CHANGED
@@ -12,6 +12,7 @@ group :development do
12
12
  gem "rubocop", "~>1.1"
13
13
  gem "rubocop-performance", "~> 1.11"
14
14
  gem "sequel-annotate", "~>1.3"
15
+ gem "yard", "~> 0.9"
15
16
  end
16
17
 
17
18
  group :test do
@@ -19,8 +19,8 @@ variable `PACT_BROKER_CONF` to the full path to the configuration file.
19
19
 
20
20
  The application log level
21
21
 
22
- **YAML configuration key name:** `log_level`<br/>
23
22
  **Environment variable name:** `PACT_BROKER_LOG_LEVEL`<br/>
23
+ **YAML configuration key name:** `log_level`<br/>
24
24
  **Default:** `info`<br/>
25
25
  **Allowed values:** `debug`, `info`, `warn`, `error`, `fatal`<br/>
26
26
 
@@ -28,8 +28,8 @@ The application log level
28
28
 
29
29
  The application log format. Can be any value supported by Semantic Logger.
30
30
 
31
- **YAML configuration key name:** `log_format`<br/>
32
31
  **Environment variable name:** `PACT_BROKER_LOG_FORMAT`<br/>
32
+ **YAML configuration key name:** `log_format`<br/>
33
33
  **Default:** `default`<br/>
34
34
  **Allowed values:** `default`, `json`, `color`<br/>
35
35
  **More information:** https://github.com/rocketjob/semantic_logger/tree/master/lib/semantic_logger/formatters<br/>
@@ -38,8 +38,8 @@ The application log format. Can be any value supported by Semantic Logger.
38
38
 
39
39
  The log file directory
40
40
 
41
- **YAML configuration key name:** `log_dir`<br/>
42
41
  **Environment variable name:** `PACT_BROKER_LOG_DIR`<br/>
42
+ **YAML configuration key name:** `log_dir`<br/>
43
43
  **Default:** `./logs`<br/>
44
44
 
45
45
  ### log_stream
@@ -48,8 +48,8 @@ The stream to which the logs will be sent.
48
48
 
49
49
  While the default is `file` for the Ruby application, it is set to `stdout` on the supported Docker images.
50
50
 
51
- **YAML configuration key name:** `log_stream`<br/>
52
51
  **Environment variable name:** `PACT_BROKER_LOG_STREAM`<br/>
52
+ **YAML configuration key name:** `log_stream`<br/>
53
53
  **Default:** `file`<br/>
54
54
  **Allowed values:** `stdout`, `file`<br/>
55
55
 
@@ -57,8 +57,8 @@ While the default is `file` for the Ruby application, it is set to `stdout` on t
57
57
 
58
58
  Set to `true` to hide the messages in the logs about Pactflow
59
59
 
60
- **YAML configuration key name:** `hide_pactflow_messages`<br/>
61
60
  **Environment variable name:** `PACT_BROKER_HIDE_PACTFLOW_MESSAGES`<br/>
61
+ **YAML configuration key name:** `hide_pactflow_messages`<br/>
62
62
  **Default:** `true`<br/>
63
63
  **Allowed values:** `true`, `false`<br/>
64
64
  **More information:** https://pactflow.io<br/>
@@ -77,8 +77,8 @@ The database adapter. For production use, Postgres must be used.
77
77
  For investigations/spikes on a development machine, you can use SQlite. It is not supported as a production database, as it does not support
78
78
  concurrent requests.
79
79
 
80
- **YAML configuration key name:** `database_adapter`<br/>
81
80
  **Environment variable name:** `PACT_BROKER_DATABASE_ADAPTER`<br/>
81
+ **YAML configuration key name:** `database_adapter`<br/>
82
82
  **Default:** `postgres`<br/>
83
83
  **Allowed values:** `postgres` (for production use), `sqlite` (for spikes only)<br/>
84
84
 
@@ -86,44 +86,44 @@ concurrent requests.
86
86
 
87
87
  The database username
88
88
 
89
- **YAML configuration key name:** `database_username`<br/>
90
89
  **Environment variable name:** `PACT_BROKER_DATABASE_USERNAME`<br/>
90
+ **YAML configuration key name:** `database_username`<br/>
91
91
 
92
92
  ### database_password
93
93
 
94
94
  The database password
95
95
 
96
- **YAML configuration key name:** `database_password`<br/>
97
96
  **Environment variable name:** `PACT_BROKER_DATABASE_PASSWORD`<br/>
97
+ **YAML configuration key name:** `database_password`<br/>
98
98
 
99
99
  ### database_name
100
100
 
101
101
  The database name. If using the `sqlite` adapter, this will be the path to the database file.
102
102
 
103
- **YAML configuration key name:** `database_name`<br/>
104
103
  **Environment variable name:** `PACT_BROKER_DATABASE_NAME`<br/>
104
+ **YAML configuration key name:** `database_name`<br/>
105
105
  **Examples:** `pact_broker`, `/tmp/pact_broker.sqlite3`, `./tmp/pact_broker.sqlite3`<br/>
106
106
 
107
107
  ### database_host
108
108
 
109
109
  The database host
110
110
 
111
- **YAML configuration key name:** `database_host`<br/>
112
111
  **Environment variable name:** `PACT_BROKER_DATABASE_HOST`<br/>
112
+ **YAML configuration key name:** `database_host`<br/>
113
113
 
114
114
  ### database_port
115
115
 
116
116
  The database port. If ommited, the default port for the adapter will be used.
117
117
 
118
- **YAML configuration key name:** `database_port`<br/>
119
118
  **Environment variable name:** `PACT_BROKER_DATABASE_PORT`<br/>
119
+ **YAML configuration key name:** `database_port`<br/>
120
120
 
121
121
  ### database_url
122
122
 
123
123
  The full database URL may be specified instead of the separate adapter, username, password, name, host and port.
124
124
 
125
- **YAML configuration key name:** `database_url`<br/>
126
125
  **Environment variable name:** `PACT_BROKER_DATABASE_URL`<br/>
126
+ **YAML configuration key name:** `database_url`<br/>
127
127
  **Format:** `{database_adapter}://{database_username}:{database_password}@{database_host}:{database_port}/{database_name}`<br/>
128
128
  **Examples:** `postgres://pact_broker_user:pact_broker_password@pact_broker_db_host/pact_broker`, `sqlite:///tmp/pact_broker.sqlite3` (relative path to working directory), `sqlite:////tmp/pact_broker.sqlite3` (absolute path)<br/>
129
129
 
@@ -131,8 +131,8 @@ The full database URL may be specified instead of the separate adapter, username
131
131
 
132
132
  The Postgresql ssl mode.
133
133
 
134
- **YAML configuration key name:** `database_sslmode`<br/>
135
134
  **Environment variable name:** `PACT_BROKER_DATABASE_SSLMODE`<br/>
135
+ **YAML configuration key name:** `database_sslmode`<br/>
136
136
  **Default:** `prefer`<br/>
137
137
  **Allowed values:** `disable`, `allow`, `prefer`, `require`, `verify-ca`, `verify-full`<br/>
138
138
  **More information:** https://ankane.org/postgres-sslmode-explained<br/>
@@ -143,8 +143,8 @@ The log level that will be used when the SQL query statements are logged.
143
143
 
144
144
  To disable noisy SQL query logging when the application `log_level` is set to `debug` for other reasons, use the value `none`.
145
145
 
146
- **YAML configuration key name:** `sql_log_level`<br/>
147
146
  **Environment variable name:** `PACT_BROKER_SQL_LOG_LEVEL`<br/>
147
+ **YAML configuration key name:** `sql_log_level`<br/>
148
148
  **Default:** `debug`<br/>
149
149
  **Allowed values:** `none`, `debug`, `info`, `warn`, `error`, `fatal`<br/>
150
150
 
@@ -152,18 +152,29 @@ To disable noisy SQL query logging when the application `log_level` is set to `d
152
152
 
153
153
  The number of seconds after which to log an SQL query at warn level. Use this for detecting slow queries.
154
154
 
155
- **YAML configuration key name:** `sql_log_warn_duration`<br/>
156
155
  **Environment variable name:** `PACT_BROKER_SQL_LOG_WARN_DURATION`<br/>
156
+ **YAML configuration key name:** `sql_log_warn_duration`<br/>
157
157
  **Default:** `5`<br/>
158
158
  **Allowed values:** A positive integer or float, as a string.<br/>
159
159
  **More information:** https://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html#label-General+connection+options<br/>
160
160
 
161
+ ### sql_enable_caller_logging
162
+
163
+ Whether or not to enable caller_logging extension for database connection.
164
+ When enabled it logs source path that caused SQL query.
165
+
166
+ **Environment variable name:** `PACT_BROKER_SQL_ENABLE_CALLER_LOGGING`<br/>
167
+ **YAML configuration key name:** `sql_enable_caller_logging`<br/>
168
+ **Default:** `false`<br/>
169
+ **Allowed values:** `true`, `false`<br/>
170
+ **More information:** https://sequel.jeremyevans.net/rdoc-plugins/files/lib/sequel/extensions/caller_logging_rb.html<br/>
171
+
161
172
  ### database_max_connections
162
173
 
163
174
  The maximum size of the connection pool (4 connections by default on most databases)
164
175
 
165
- **YAML configuration key name:** `database_max_connections`<br/>
166
176
  **Environment variable name:** `PACT_BROKER_DATABASE_MAX_CONNECTIONS`<br/>
177
+ **YAML configuration key name:** `database_max_connections`<br/>
167
178
  **Default:** `4`<br/>
168
179
  **Allowed values:** A positive integer value.<br/>
169
180
  **More information:** https://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html#label-General+connection+options<br/>
@@ -172,8 +183,8 @@ The maximum size of the connection pool (4 connections by default on most databa
172
183
 
173
184
  The number of seconds to wait if a connection cannot be acquired before raising an error
174
185
 
175
- **YAML configuration key name:** `database_pool_timeout`<br/>
176
186
  **Environment variable name:** `PACT_BROKER_DATABASE_POOL_TIMEOUT`<br/>
187
+ **YAML configuration key name:** `database_pool_timeout`<br/>
177
188
  **Default:** `5`<br/>
178
189
  **Allowed values:** A positive integer.<br/>
179
190
  **More information:** https://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html#label-General+connection+options<br/>
@@ -185,8 +196,8 @@ the Broker application process may be ready before the database is available for
185
196
  container to exit with an error. Setting the max retries to a non-zero number will allow it to retry the connection the
186
197
  configured number of times, waiting 3 seconds between attempts.
187
198
 
188
- **YAML configuration key name:** `database_connect_max_retries`<br/>
189
199
  **Environment variable name:** `PACT_BROKER_DATABASE_CONNECT_MAX_RETRIES`<br/>
200
+ **YAML configuration key name:** `database_connect_max_retries`<br/>
190
201
  **Default:** `0`<br/>
191
202
  **Allowed values:** A positive integer value.<br/>
192
203
 
@@ -194,8 +205,8 @@ configured number of times, waiting 3 seconds between attempts.
194
205
 
195
206
  Whether or not to run the database schema migrations on start up. It is recommended to set this to `true`.
196
207
 
197
- **YAML configuration key name:** `auto_migrate_db`<br/>
198
208
  **Environment variable name:** `PACT_BROKER_AUTO_MIGRATE_DB`<br/>
209
+ **YAML configuration key name:** `auto_migrate_db`<br/>
199
210
  **Default:** `true`<br/>
200
211
  **Allowed values:** `true`, `false`<br/>
201
212
 
@@ -203,8 +214,8 @@ Whether or not to run the database schema migrations on start up. It is recommen
203
214
 
204
215
  Whether or not to run the database data migrations on start up. It is recommended to set this to `true`.
205
216
 
206
- **YAML configuration key name:** `auto_migrate_db_data`<br/>
207
217
  **Environment variable name:** `PACT_BROKER_AUTO_MIGRATE_DB_DATA`<br/>
218
+ **YAML configuration key name:** `auto_migrate_db_data`<br/>
208
219
  **Default:** `true`<br/>
209
220
  **Allowed values:** `true`, `false`<br/>
210
221
 
@@ -214,8 +225,8 @@ If `true`, will not raise an error if a database migration is recorded in the da
214
225
  equivalent file in the codebase. If this is true, an older version of the code may be used with a newer version of the database,
215
226
  however, data integrity issues may occur.
216
227
 
217
- **YAML configuration key name:** `allow_missing_migration_files`<br/>
218
228
  **Environment variable name:** `PACT_BROKER_ALLOW_MISSING_MIGRATION_FILES`<br/>
229
+ **YAML configuration key name:** `allow_missing_migration_files`<br/>
219
230
  **Default:** `true`<br/>
220
231
  **More information:** https://sequel.jeremyevans.net/rdoc/classes/Sequel/Migrator.html<br/>
221
232
 
@@ -223,8 +234,8 @@ however, data integrity issues may occur.
223
234
 
224
235
  The number of seconds after which an SQL query will be aborted. Only supported for Postgresql connections.
225
236
 
226
- **YAML configuration key name:** `database_statement_timeout`<br/>
227
237
  **Environment variable name:** `PACT_BROKER_DATABASE_STATEMENT_TIMEOUT`<br/>
238
+ **YAML configuration key name:** `database_statement_timeout`<br/>
228
239
  **Default:** `15`<br/>
229
240
  **Allowed values:** A positive integer or float.<br/>
230
241
  **More information:** https://www.postgresql.org/docs/9.3/runtime-config-client.html<br/>
@@ -235,8 +246,8 @@ The number of seconds after which the SQL queries used for the metrics endpoint
235
246
  This is configurable separately from the standard `database_statement_timeout` as it may need to be significantly
236
247
  longer than the desired value for standard queries.
237
248
 
238
- **YAML configuration key name:** `metrics_sql_statement_timeout`<br/>
239
249
  **Environment variable name:** `PACT_BROKER_METRICS_SQL_STATEMENT_TIMEOUT`<br/>
250
+ **YAML configuration key name:** `metrics_sql_statement_timeout`<br/>
240
251
  **Default:** `30`<br/>
241
252
  **Allowed values:** A positive integer.<br/>
242
253
 
@@ -248,8 +259,8 @@ The number of seconds after which to check the health of a connection from a con
248
259
  when databases are restarted and connections are killed. This has a performance
249
260
  penalty, so consider increasing this timeout if building a frequently accessed service.
250
261
 
251
- **YAML configuration key name:** `database_connection_validation_timeout`<br/>
252
262
  **Environment variable name:** `PACT_BROKER_DATABASE_CONNECTION_VALIDATION_TIMEOUT`<br/>
263
+ **YAML configuration key name:** `database_connection_validation_timeout`<br/>
253
264
  **Default:** -1 for v2.85.1 and earlier, 3600 for later versions.<br/>
254
265
  **Allowed values:** -1 or any positive integer.<br/>
255
266
  **More information:** https://sequel.jeremyevans.net/rdoc-plugins/files/lib/sequel/extensions/connection_validator_rb.html<br/>
@@ -268,8 +279,8 @@ should be used for CI/CD.
268
279
 
269
280
  Whether to enable basic authorization. This is automatically set to true for the Docker images if the `basic_auth_username` and `basic_auth_password` are set.
270
281
 
271
- **YAML configuration key name:** `basic_auth_enabled`<br/>
272
282
  **Environment variable name:** `PACT_BROKER_BASIC_AUTH_ENABLED`<br/>
283
+ **YAML configuration key name:** `basic_auth_enabled`<br/>
273
284
  **Default:** `false`<br/>
274
285
  **Allowed values:** `true`, `false`<br/>
275
286
 
@@ -277,36 +288,36 @@ Whether to enable basic authorization. This is automatically set to true for the
277
288
 
278
289
  The username for the read/write basic auth user.
279
290
 
280
- **YAML configuration key name:** `basic_auth_username`<br/>
281
291
  **Environment variable name:** `PACT_BROKER_BASIC_AUTH_USERNAME`<br/>
292
+ **YAML configuration key name:** `basic_auth_username`<br/>
282
293
 
283
294
  ### basic_auth_password
284
295
 
285
296
  The password for the read/write basic auth user.
286
297
 
287
- **YAML configuration key name:** `basic_auth_password`<br/>
288
298
  **Environment variable name:** `PACT_BROKER_BASIC_AUTH_PASSWORD`<br/>
299
+ **YAML configuration key name:** `basic_auth_password`<br/>
289
300
 
290
301
  ### basic_auth_read_only_username
291
302
 
292
303
  The username for the read only basic auth user.
293
304
 
294
- **YAML configuration key name:** `basic_auth_read_only_username`<br/>
295
305
  **Environment variable name:** `PACT_BROKER_BASIC_AUTH_READ_ONLY_USERNAME`<br/>
306
+ **YAML configuration key name:** `basic_auth_read_only_username`<br/>
296
307
 
297
308
  ### basic_auth_read_only_password
298
309
 
299
310
  The password for the read only basic auth user.
300
311
 
301
- **YAML configuration key name:** `basic_auth_read_only_password`<br/>
302
312
  **Environment variable name:** `PACT_BROKER_BASIC_AUTH_READ_ONLY_PASSWORD`<br/>
313
+ **YAML configuration key name:** `basic_auth_read_only_password`<br/>
303
314
 
304
315
  ### allow_public_read
305
316
 
306
317
  If you want to allow public read access, but still require credentials for writing, then leave `basic_auth_read_only_username` and `basic_auth_read_only_password` unset, and set `allow_public_read` to `true`.
307
318
 
308
- **YAML configuration key name:** `allow_public_read`<br/>
309
319
  **Environment variable name:** `PACT_BROKER_ALLOW_PUBLIC_READ`<br/>
320
+ **YAML configuration key name:** `allow_public_read`<br/>
310
321
  **Default:** `false`<br/>
311
322
  **Allowed values:** `true`, `false`<br/>
312
323
 
@@ -314,8 +325,8 @@ If you want to allow public read access, but still require credentials for writi
314
325
 
315
326
  If you have enabled basic auth, but require unauthenticated access to the heartbeat URL (eg. for use within an AWS autoscaling group), set `public_heartbeat` to `true`.
316
327
 
317
- **YAML configuration key name:** `public_heartbeat`<br/>
318
328
  **Environment variable name:** `PACT_BROKER_PUBLIC_HEARTBEAT`<br/>
329
+ **YAML configuration key name:** `public_heartbeat`<br/>
319
330
  **Default:** `false`<br/>
320
331
  **Allowed values:** `true`, `false`<br/>
321
332
 
@@ -323,8 +334,8 @@ If you have enabled basic auth, but require unauthenticated access to the heartb
323
334
 
324
335
  Set this to true to allow status badges to be embedded in README files without requiring a hardcoded password.
325
336
 
326
- **YAML configuration key name:** `enable_public_badge_access`<br/>
327
337
  **Environment variable name:** `PACT_BROKER_ENABLE_PUBLIC_BADGE_ACCESS`<br/>
338
+ **YAML configuration key name:** `enable_public_badge_access`<br/>
328
339
  **Default:** `false`<br/>
329
340
  **Allowed values:** `true`, `false`<br/>
330
341
 
@@ -340,8 +351,8 @@ Set this to true to allow status badges to be embedded in README files without r
340
351
  The schedule of seconds to wait between webhook execution attempts.
341
352
  The default schedule is 10 sec, 1 min, 2 min, 5 min, 10 min, 20 min (38 minutes in total).
342
353
 
343
- **YAML configuration key name:** `webhook_retry_schedule`<br/>
344
354
  **Environment variable name:** `PACT_BROKER_WEBHOOK_RETRY_SCHEDULE`<br/>
355
+ **YAML configuration key name:** `webhook_retry_schedule`<br/>
345
356
  **Format:** A space separated list of integers.<br/>
346
357
  **Default:** `10 60 120 300 600 1200`<br/>
347
358
 
@@ -350,8 +361,8 @@ The default schedule is 10 sec, 1 min, 2 min, 5 min, 10 min, 20 min (38 minutes
350
361
  The allowed HTTP methods for webhooks.
351
362
  It is highly recommended that only `POST` requests are allowed to ensure that webhooks cannot be used to retrieve sensitive information from hosts within the same network.
352
363
 
353
- **YAML configuration key name:** `webhook_http_method_whitelist`<br/>
354
364
  **Environment variable name:** `PACT_BROKER_WEBHOOK_HTTP_METHOD_WHITELIST`<br/>
365
+ **YAML configuration key name:** `webhook_http_method_whitelist`<br/>
355
366
  **Format:** A space separated list.<br/>
356
367
  **Default:** `POST`<br/>
357
368
  **Allowed values:** `POST`, `GET` (not recommended), `PUT` (not recommended), `PATCH` (not recommended), `DELETE` (not recommended)<br/>
@@ -364,8 +375,8 @@ considered a success, otherwise the webhook will be re-triggered based on the `w
364
375
  In most cases, configuring this is not necessary, but there are some CI systems that return a non 200 status for a success,
365
376
  which is why this feature exists.
366
377
 
367
- **YAML configuration key name:** `webhook_http_code_success`<br/>
368
378
  **Environment variable name:** `PACT_BROKER_WEBHOOK_HTTP_CODE_SUCCESS`<br/>
379
+ **YAML configuration key name:** `webhook_http_code_success`<br/>
369
380
  **Format:** A space separated list of integers.<br/>
370
381
  **Default:** `200 201 202 203 204 205 206`<br/>
371
382
  **Allowed values:** `Any valid HTTP status code`<br/>
@@ -374,8 +385,8 @@ which is why this feature exists.
374
385
 
375
386
  The allowed URL schemes for webhooks.
376
387
 
377
- **YAML configuration key name:** `webhook_scheme_whitelist`<br/>
378
388
  **Environment variable name:** `PACT_BROKER_WEBHOOK_SCHEME_WHITELIST`<br/>
389
+ **YAML configuration key name:** `webhook_scheme_whitelist`<br/>
379
390
  **Format:** A space delimited list.<br/>
380
391
  **Default:** `https`<br/>
381
392
  **Allowed values:** `https`, `http`<br/>
@@ -387,37 +398,58 @@ Regular expressions should start and end with a `/` to differentiate them from S
387
398
  Note that backslashes need to be escaped with a second backslash when setting via an environment variable.
388
399
  Please read the [Webhook whitelists section](https://docs.pact.io/pact_broker/configuration/features#webhooks) of the Pact Broker configuration documentation to understand how the whitelist is used.
389
400
 
390
- **YAML configuration key name:** `webhook_host_whitelist`<br/>
391
401
  **Environment variable name:** `PACT_BROKER_WEBHOOK_HOST_WHITELIST`<br/>
402
+ **Environment variable format:** A space separated list.<br/>
403
+ **YAML configuration key name:** `webhook_host_whitelist`<br/>
404
+ **YAML format:** A YAML list.<br/>
392
405
  **Examples:** `github.com`, `10.2.3.41/24`, `/.*\\.foo\\.com$/`<br/>
393
406
  **More information:** https://docs.pact.io/pact_broker/configuration/#webhook-whitelists<br/>
394
407
 
395
408
  ### webhook_certificates
396
409
 
397
- A list of SSL certificate configuration objects with the keys `description`, and either `content` or `path`. These
410
+ A list of SSL certificate configuration objects with the key `description`, and either `content` or `path`. These
398
411
  certificates are used when a webhook needs to connect to a server that uses a self signed certificate.
399
412
 
400
413
  Each certificate configuration item accepts a chain of certificates in PEM format - there may be multiple 'BEGIN CERTIFICATE' and 'END CERTIFICATE' in the content of each item.
401
414
 
402
- When setting the content, use the syntax "content: |-" followed by a new line, and then the contents of the certificate
403
- chain in PEM format, indented by 2 more characters.
404
-
405
- When setting the path, the full path to the certificate file in PEM format must be specified.
406
-
407
415
  The certificate configuration is not validated on startup. If any of the configured certificates cannot be loaded during the execution of a webhook, an error
408
416
  will be logged, and they will be ignored. You can check if the configuration is working by testing the execution of
409
417
  a webhook that connects to the server with the self signed certificate by following these instructions https://docs.pact.io/pact_broker/webhooks/debugging_webhooks#testing-webhook-execution
410
418
 
411
- **YAML configuration key name:** `webhook_certificates`<br/>
412
- **Environment variable name:** `PACT_BROKER_WEBHOOK_CERTIFICATES`<br/>
419
+ When setting the content in the YAML file, use the syntax "content: |-" followed by a new line, and then the contents of the certificate
420
+ chain in PEM format, indented by 2 more characters.
421
+
422
+ When setting the path, the full path to the certificate file in PEM format must be specified. When using Docker, you must ensure the
423
+ certificate file is [mounted into the container](https://docs.docker.com/storage/volumes/).
424
+
425
+ *NOTE: USING ENVIRONMENT VARIABLES TO SET THE WEBHOOK CERTIFICATES IS NOT SUPPORTED.*
426
+
427
+ YAML Example:
428
+
429
+ ```yaml
430
+ webhook_certificates:
431
+ - description: "An example self signed certificate with content"
432
+ content: |-
433
+ -----BEGIN CERTIFICATE-----
434
+ MIIDZDCCAkygAwIBAgIBATANBgkqhkiG9w0BAQsFADBCMRMwEQYKCZImiZPyLGQB
435
+ <REST OF CERTIFICATE>
436
+ jHT1Ty2CglM=
437
+ -----END CERTIFICATE-----
438
+ - description: "An example self signed certificate with a path"
439
+ path: /full/path/to/the/cert.pem
440
+
441
+ ```
442
+
413
443
  **Supported versions:** From v2.90.0<br/>
444
+ **Environment variable name:** `PACT_BROKER_WEBHOOK_CERTIFICATES`<br/>
445
+ **YAML configuration key name:** `webhook_certificates`<br/>
414
446
 
415
447
  ### disable_ssl_verification
416
448
 
417
449
  If set to true, SSL verification will be disabled for the HTTP requests made by the webhooks
418
450
 
419
- **YAML configuration key name:** `disable_ssl_verification`<br/>
420
451
  **Environment variable name:** `PACT_BROKER_DISABLE_SSL_VERIFICATION`<br/>
452
+ **YAML configuration key name:** `disable_ssl_verification`<br/>
421
453
  **Default:** `false`<br/>
422
454
  **Allowed values:** `true`, `false`<br/>
423
455
 
@@ -425,8 +457,8 @@ If set to true, SSL verification will be disabled for the HTTP requests made by
425
457
 
426
458
  The user agent to set when making HTTP requests for webhooks.
427
459
 
428
- **YAML configuration key name:** `user_agent`<br/>
429
460
  **Environment variable name:** `PACT_BROKER_USER_AGENT`<br/>
461
+ **YAML configuration key name:** `user_agent`<br/>
430
462
  **Default:** `Pact Broker v{VERSION}`<br/>
431
463
 
432
464
  <br/>
@@ -442,8 +474,8 @@ The HTTP port that the Pact Broker application will run on. This will only be ho
442
474
  a package that actually reads this property (eg. one of the supported Docker images). If you are running the vanilla Ruby application,
443
475
  the application will run on the port the server has been configured to run on (eg. `bundle exec rackup -p 9393`)
444
476
 
445
- **YAML configuration key name:** `port`<br/>
446
477
  **Environment variable name:** `PACT_BROKER_PORT`<br/>
478
+ **YAML configuration key name:** `port`<br/>
447
479
  **Default:** `9292`<br/>
448
480
 
449
481
  ### base_url
@@ -455,8 +487,8 @@ deploying the Pact Broker to production as it prevents cache poisoning security
455
487
  It is also required when deploying the Broker behind a reverse proxy, and when the application has been mounted at a non-root context.
456
488
  Note that this attribute does not change where the application is actually mounted (that is the concern of the deployment configuration) - it just changes the links.
457
489
 
458
- **YAML configuration key name:** `base_url`<br/>
459
490
  **Environment variable name:** `PACT_BROKER_BASE_URL`<br/>
491
+ **YAML configuration key name:** `base_url`<br/>
460
492
  **Examples:** `https://pact-broker.mycompany.com`, `https://my-company.com:9292/pact-broker`<br/>
461
493
 
462
494
  ### base_urls
@@ -464,8 +496,8 @@ Note that this attribute does not change where the application is actually mount
464
496
  An alias of base_url. From version 2.79.0, multiple base URLs can be configured for architectures that use
465
497
  gateways or proxies that allow the same Pact Broker instance to be addressed with different base URLs.
466
498
 
467
- **YAML configuration key name:** `base_urls`<br/>
468
499
  **Environment variable name:** `PACT_BROKER_BASE_URLS`<br/>
500
+ **YAML configuration key name:** `base_urls`<br/>
469
501
  **Format:** A space separated list.<br/>
470
502
  **Example:** `http://my-internal-pact-broker:9292 https://my-external-pact-broker`<br/>
471
503
 
@@ -473,8 +505,8 @@ gateways or proxies that allow the same Pact Broker instance to be addressed wit
473
505
 
474
506
  The URL of the shields.io server used to generate the README badges.
475
507
 
476
- **YAML configuration key name:** `shields_io_base_url`<br/>
477
508
  **Environment variable name:** `PACT_BROKER_SHIELDS_IO_BASE_URL`<br/>
509
+ **YAML configuration key name:** `shields_io_base_url`<br/>
478
510
  **Default:** `https://img.shields.io`<br/>
479
511
  **More information:** https://shields.io<br/>
480
512
 
@@ -485,8 +517,8 @@ to render the badge from the shields.io server directly in the browser. This is
485
517
  When set to `proxy`, the Pact Broker will make a request directly to the configured shields.io server, and then send the returned file
486
518
  back to the browser. This mode is not recommended for security and performance reasons.
487
519
 
488
- **YAML configuration key name:** `badge_provider_mode`<br/>
489
520
  **Environment variable name:** `PACT_BROKER_BADGE_PROVIDER_MODE`<br/>
521
+ **YAML configuration key name:** `badge_provider_mode`<br/>
490
522
  **Default:** `redirect`<br/>
491
523
  **Allowed values:** `redirect`, `proxy`<br/>
492
524
 
@@ -496,8 +528,8 @@ Whether or not to enable the diagnostic endpoints at `/diagnostic/status/heartbe
496
528
  The heartbeat endpoint is for use by load balancers, and the dependencies endpoint is for checking that the database
497
529
  is available (do not use this for load balancing, as it makes a database connection).
498
530
 
499
- **YAML configuration key name:** `enable_diagnostic_endpoints`<br/>
500
531
  **Environment variable name:** `PACT_BROKER_ENABLE_DIAGNOSTIC_ENDPOINTS`<br/>
532
+ **YAML configuration key name:** `enable_diagnostic_endpoints`<br/>
501
533
  **Default:** `true`<br/>
502
534
  **Allowed values:** `true`, `false`<br/>
503
535
 
@@ -505,8 +537,8 @@ is available (do not use this for load balancing, as it makes a database connect
505
537
 
506
538
  Whether or not to enable the embedded HAL Browser.
507
539
 
508
- **YAML configuration key name:** `use_hal_browser`<br/>
509
540
  **Environment variable name:** `PACT_BROKER_USE_HAL_BROWSER`<br/>
541
+ **YAML configuration key name:** `use_hal_browser`<br/>
510
542
  **Default:** `true`<br/>
511
543
  **Allowed values:** `true`, `false`<br/>
512
544
  **More information:** https://github.com/mikekelly/hal-browser<br/>
@@ -532,8 +564,8 @@ or that the pacticipant should be created manually if it was intended to be a ne
532
564
  To turn this feature off, set `check_for_potential_duplicate_pacticipant_names` to `false`, and make sure everyone is very careful with their naming!
533
565
  The usefulness of the Broker depends on the integrity of the data, which in turn depends on the correctness of the pacticipant names.
534
566
 
535
- **YAML configuration key name:** `check_for_potential_duplicate_pacticipant_names`<br/>
536
567
  **Environment variable name:** `PACT_BROKER_CHECK_FOR_POTENTIAL_DUPLICATE_PACTICIPANT_NAMES`<br/>
568
+ **YAML configuration key name:** `check_for_potential_duplicate_pacticipant_names`<br/>
537
569
  **Default:** `true`<br/>
538
570
  **Allowed values:** `true`, `false`<br/>
539
571
 
@@ -544,9 +576,9 @@ also created for the pacticipant version.
544
576
 
545
577
  This is to assist in the migration from using tags to track deployments to using the deployed and released versions feature.
546
578
 
547
- **YAML configuration key name:** `create_deployed_versions_for_tags`<br/>
548
- **Environment variable name:** `PACT_BROKER_CREATE_DEPLOYED_VERSIONS_FOR_TAGS`<br/>
549
579
  **Supported versions:** From v2.81.0<br/>
580
+ **Environment variable name:** `PACT_BROKER_CREATE_DEPLOYED_VERSIONS_FOR_TAGS`<br/>
581
+ **YAML configuration key name:** `create_deployed_versions_for_tags`<br/>
550
582
  **Default:** `true`<br/>
551
583
  **Allowed values:** `true`, `false`<br/>
552
584
  **More information:** https://docs.pact.io/pact_broker/recording_deployments_and_releases/<br/>
@@ -558,9 +590,9 @@ will be used to populate the `branch` property of the version.
558
590
 
559
591
  This is to assist in the migration from using tags to track branches to using the branches feature.
560
592
 
561
- **YAML configuration key name:** `use_first_tag_as_branch`<br/>
562
- **Environment variable name:** `PACT_BROKER_USE_FIRST_TAG_AS_BRANCH`<br/>
563
593
  **Supported versions:** From v2.82.0<br/>
594
+ **Environment variable name:** `PACT_BROKER_USE_FIRST_TAG_AS_BRANCH`<br/>
595
+ **YAML configuration key name:** `use_first_tag_as_branch`<br/>
564
596
  **Default:** `true`<br/>
565
597
  **Allowed values:** `true`, `false`<br/>
566
598
 
@@ -571,9 +603,9 @@ the `mainBranch` property is set for that pacticipant if it is not already set.
571
603
 
572
604
  This is to assist in the migration from using tags to track branches to using the branches feature.
573
605
 
574
- **YAML configuration key name:** `auto_detect_main_branch`<br/>
575
- **Environment variable name:** `PACT_BROKER_AUTO_DETECT_MAIN_BRANCH`<br/>
576
606
  **Supported versions:** From v2.82.0<br/>
607
+ **Environment variable name:** `PACT_BROKER_AUTO_DETECT_MAIN_BRANCH`<br/>
608
+ **YAML configuration key name:** `auto_detect_main_branch`<br/>
577
609
  **Default:** `true`<br/>
578
610
  **Allowed values:** `true`, `false`<br/>
579
611
 
@@ -581,9 +613,9 @@ This is to assist in the migration from using tags to track branches to using th
581
613
 
582
614
  An array of potential main branch names used when automatically detecting the main branch for a pacticipant.
583
615
 
584
- **YAML configuration key name:** `main_branch_candidates`<br/>
585
- **Environment variable name:** `PACT_BROKER_MAIN_BRANCH_CANDIDATES`<br/>
586
616
  **Supported versions:** From v2.82.0<br/>
617
+ **Environment variable name:** `PACT_BROKER_MAIN_BRANCH_CANDIDATES`<br/>
618
+ **YAML configuration key name:** `main_branch_candidates`<br/>
587
619
  **Format:** A space delimited list.<br/>
588
620
  **Default:** `develop main master`<br/>
589
621
 
@@ -593,9 +625,9 @@ Whether or not to allow the pact content for an existing consumer version to be
593
625
  as allowing modification makes the results of can-i-deploy unreliable. When this is set to false as recommended, each commit must publish pacts
594
626
  with a unique version number.
595
627
 
596
- **YAML configuration key name:** `allow_dangerous_contract_modification`<br/>
597
- **Environment variable name:** `PACT_BROKER_ALLOW_DANGEROUS_CONTRACT_MODIFICATION`<br/>
598
628
  **Supported versions:** From v2.82.0<br/>
629
+ **Environment variable name:** `PACT_BROKER_ALLOW_DANGEROUS_CONTRACT_MODIFICATION`<br/>
630
+ **YAML configuration key name:** `allow_dangerous_contract_modification`<br/>
599
631
  **Default:** For new installations of v2.82.0 and later, this defaults to `false`.<br/>
600
632
  **Allowed values:** `true`, `false`<br/>
601
633
  **More information:** https://docs.pact.io/versioning<br/>
@@ -611,7 +643,7 @@ with a unique version number.
611
643
 
612
644
  A list of features to enable in the Pact Broker for beta testing before public release.
613
645
 
614
- **YAML configuration key name:** `features`<br/>
615
646
  **Environment variable name:** `PACT_BROKER_FEATURES`<br/>
647
+ **YAML configuration key name:** `features`<br/>
616
648
  **Format:** A space separated list.<br/>
617
649
 
data/lib/db.rb CHANGED
@@ -38,14 +38,8 @@ module DB
38
38
  con.extension(:connection_validator)
39
39
  con.extension(:pagination)
40
40
  con.extension(:statement_timeout)
41
+ con.extension(:any_not_empty)
41
42
  #con.extension(:caller_logging)
42
- con.extend_datasets do
43
- # rubocop: disable Lint/NestedMethodDefinition
44
- def any?
45
- !empty?
46
- end
47
- # rubocop: enable Lint/NestedMethodDefinition
48
- end
49
43
  con.timezone = :utc
50
44
  con.run("SET sql_mode='STRICT_TRANS_TABLES';") if db_credentials[:adapter].to_s =~ /mysql/
51
45
  con
@@ -0,0 +1,36 @@
1
+ require "pact_broker/logging"
2
+
3
+ module PactBroker
4
+ module Api
5
+ module Middleware
6
+ class HttpDebugLogs
7
+ include PactBroker::Logging
8
+
9
+ EXCLUDE_HEADERS = ["puma.", "rack.", "pactbroker."]
10
+ RACK_SESSION = "rack.session"
11
+
12
+ def initialize(app)
13
+ @app = app
14
+ @logger = logger
15
+ end
16
+
17
+ def call(env)
18
+ env_to_log = env.reject { | header, _ | header.start_with?(*EXCLUDE_HEADERS) }
19
+ env_to_log["rack.session"] = env["rack.session"].to_hash if env["rack.session"]
20
+ env_to_log["rack.input"] = request_body(env) if env["rack.input"]
21
+ logger.debug("env", payload: env_to_log)
22
+ status, headers, body = @app.call(env)
23
+ logger.debug("response", payload: { "status" => status, "headers" => headers, "body" => body })
24
+ [status, headers, body]
25
+ end
26
+
27
+ def request_body(env)
28
+ buffer = env["rack.input"]
29
+ request_body = buffer.read
30
+ buffer.respond_to?(:rewind) && buffer.rewind
31
+ JSON.parse(request_body) rescue request_body
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end