Skip to content

Commit

Permalink
Require activity log retention months at least the minimum (hashicorp…
Browse files Browse the repository at this point in the history
…#20078)

* reject retention month updates that are less than min retention months

* add changelog

* reword error

* switch to retention_months
  • Loading branch information
miagilepner committed Apr 11, 2023
1 parent 65297e5 commit 4b6ec40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelog/20078.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
core/activity: error when attempting to update retention configuration below the minimum
```
4 changes: 4 additions & 0 deletions vault/logical_system_activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ func (b *SystemBackend) handleActivityConfigUpdate(ctx context.Context, req *log
return logical.ErrorResponse("retention_months cannot be 0 while enabled"), logical.ErrInvalidRequest
}

if a.core.censusLicensingEnabled && config.RetentionMonths < a.configOverrides.MinimumRetentionMonths {
return logical.ErrorResponse("retention_months must be at least %d while Reporting is enabled", a.configOverrides.MinimumRetentionMonths), logical.ErrInvalidRequest
}

// Store the config
entry, err := logical.StorageEntryJSON(path.Join(activitySubPath, activityConfigKey), config)
if err != nil {
Expand Down

0 comments on commit 4b6ec40

Please sign in to comment.