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 +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +6 -3
- data/lib/standard_audit/checks/retention.rb +9 -4
- data/lib/standard_audit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 052265cb7a2b77f0bdbbec540a7603112a26ad20173828a0009a5aee72d68270
|
|
4
|
+
data.tar.gz: 3dd110875c9356705e363437c97ef35b27e8412eed4f54c523894d9dc8173ca2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
953
|
-
|
|
954
|
-
|
|
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"
|
|
23
|
-
#
|
|
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
|
|
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
|