standard_audit 0.14.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05062631e84ab99965b101b5381535c345929c0282cb4c0ca645f2636a5d42b3
4
- data.tar.gz: 9acf2c4b4f8059ca4290655e065ce2e0fbd093a5747b87658ea426ec2b6d32f6
3
+ metadata.gz: 052265cb7a2b77f0bdbbec540a7603112a26ad20173828a0009a5aee72d68270
4
+ data.tar.gz: 3dd110875c9356705e363437c97ef35b27e8412eed4f54c523894d9dc8173ca2
5
5
  SHA512:
6
- metadata.gz: 48c43519e8dfff7d04ea521ca6700cd85b3ac9096f89288b4c2bdc3a94a1b51d1c941fa6c9f7278e06672e9f1318805b0d0c34e0da282b65fcd85e67cf07ee0f
7
- data.tar.gz: 59d4d4dbba01407436d16c6c6007b09b63ac0024f58c7f44d8880dac7f46f38baf279c5142264e2e03a150fec1ca1dcba0ce538d8105fa2c96a0c2fb29979cc2
6
+ metadata.gz: abba2f5dac90739c1a96b1470030f81bcc967261af6effab9a3561edc1ec57115e19695aa7cebebb716b20a406bdfca2200a89afda7d826acd7de9a5379d5206
7
+ data.tar.gz: 60985a94ecd78c1c47a9e66ffe7fb0df0ffd26928361c4a0b4ee1417a14eea31762aca75cb1e4805e117af3df668cd5e99f473ff3ddf05b6a920e48c35ef2f40
data/CHANGELOG.md CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.14.1] - 2026-10-22
11
+
12
+ ### Changed
13
+
14
+ - **`Checks::Retention` fails closed on `APP_ENVIRONMENT`.** Only `staging`,
15
+ `preview`, `development` and `test` are non-production; any other set value
16
+ is production, so a misspelt `APP_ENVIRONMENT` can no longer silence the
17
+ unbounded-retention advisory (before, only the exact value `production`
18
+ counted). Surrounding whitespace is ignored and matching is case-sensitive
19
+ (`Staging` is production). Unset or blank still falls back to
20
+ `Rails.env.production?`. The estate
21
+ convention shared with standard_id, standard_health and standard_singpass.
22
+
10
23
  ## [0.14.0] - 2026-10-22
11
24
 
12
25
  ### Added
data/README.md CHANGED
@@ -949,9 +949,12 @@ StandardHealth.configure do |c|
949
949
  end
950
950
  ```
951
951
 
952
- When `APP_ENVIRONMENT == "production"` (falling back to `Rails.env.production?`
953
- when that var is unset — so staging is not flagged) and `retention_days` is nil,
954
- the check returns `:warn`. With `:indefinite` it returns `:ok` with
952
+ On a production deployment with `retention_days` nil, the check returns `:warn`.
953
+ "Production" follows the estate's `APP_ENVIRONMENT` convention: when the variable
954
+ is set (surrounding whitespace ignored, matched case-sensitively), only
955
+ `staging`, `preview`, `development` and `test` are non-production, so staging is
956
+ not flagged, and any other value, a typo included, counts as production. When it
957
+ is unset or blank, `Rails.env.production?` decides. With `:indefinite` it returns `:ok` with
955
958
  `retention: "indefinite"`. That rolls `GET /health/ready` up to `:degraded`,
956
959
  which is **still HTTP 200** — it surfaces the advisory in the readiness JSON
957
960
  without failing the probe or blocking a deploy. The check is duck-typed and has
@@ -19,10 +19,15 @@ module StandardAudit
19
19
  # the probe or blocking a deploy. Only a *critical* check failure returns
20
20
  # 503, and this check is never critical.
21
21
  #
22
- # "Production" is ENV["APP_ENVIRONMENT"] == "production" when that var is
23
- # set (so staging — which also runs RAILS_ENV=production — is not flagged);
22
+ # "Production" follows the estate's APP_ENVIRONMENT convention (shared
23
+ # with standard_id, standard_health and standard_singpass): when that var
24
+ # is set, only staging, preview, development and test are non-production
25
+ # (so staging, which also runs RAILS_ENV=production, is not flagged) and
26
+ # any other value is production, so a typo never silences the advisory;
24
27
  # otherwise it falls back to Rails.env.production?.
25
28
  class Retention
29
+ NON_PRODUCTION_APP_ENVIRONMENTS = %w[staging preview development test].freeze
30
+
26
31
  def initialize(name: :audit_retention, critical: false)
27
32
  @name = name
28
33
  @critical = critical
@@ -51,8 +56,8 @@ module StandardAudit
51
56
  private
52
57
 
53
58
  def production?
54
- app_env = ENV["APP_ENVIRONMENT"].to_s
55
- return app_env == "production" unless app_env.empty?
59
+ app_env = ENV["APP_ENVIRONMENT"].to_s.strip
60
+ return !NON_PRODUCTION_APP_ENVIRONMENTS.include?(app_env) unless app_env.empty?
56
61
 
57
62
  defined?(Rails) && Rails.respond_to?(:env) && Rails.env.production?
58
63
  end
@@ -1,3 +1,3 @@
1
1
  module StandardAudit
2
- VERSION = "0.14.0"
2
+ VERSION = "0.14.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard_audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaryl Sim