Repository navigation
fix(platform): let audit logs be kept for 180 days - #4080
Merged
Merged
Conversation
The audit-log retention floor was 365 days twice over: the bounds every new organization is seeded with, and a hard floor in the bounds schema that refuses any operator file going lower. So no admin could choose fewer than 365 days, and an operator who lowered the file broke the organization's retention editor instead. The hard floor is now 180 days and the bundled bounds start there, so a new organization can keep audit logs for 180 to 3650 days. PCI DSS asks for 12 months; an organization bound by it raises the floor in its own file or through TALE_RETENTION_AUDIT_MIN. A refused file's error now names every floor instead of pointing at a constant in the source. The docs-screenshot catalog's bounds file still carried the retired promptTemplates category, so it never parsed and its organizations had no bounds; it now matches the builtin catalog, and a test holds both shipped files to the schema, to every category and to their own seeded policy.
An organization whose retention.yml exists but does not parse — a floor below its compliance floor, a retired category — reads as having no bounds file at all: the editor shows no allowed ranges and every save fails, and nothing said why. The loader now logs the file's validation error, naming the floors, the way the governance policy reader does; a missing file stays quiet. The self-hosted retention guide documents the fixed floors (audit logs 180 days, login attempts 90), what an operator sees when a file undercuts one, the bundled 180–3650-day audit range, and that an organization created by an earlier release keeps auditLog.min: 365 in its own file until the operator lowers it.
Four retention categories carried a range in their helper text beside
the "Allowed: {min}–{max}" line the editor renders from the operator's
bounds, and two of them contradicted it: audit logs said 30–365 days
where the bounds now allow 180–3650, login attempts 7–365 where they
allow 90–365. The bounds line is the one source; the helper text now
says only what the category deletes, in en, de and fr.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Admins could not set audit-log retention below 365 days ("Unter Operator-Untergrenze (min 365 Tage)"). Two things enforced that floor:
governance/retention.yml(auditLog.min: 365), andRETENTION_COMPLIANCE_FLOORS.auditLog = 365). That floor refused any operator file going lower, so even an operator edit could not allow 180 days: the org's retention editor lost its bounds, and every save failed withRETENTION_CONFIG_MISSING.What changes
retention.yml. A new organization can keep audit logs for 180–3650 days. The comment now says what the floor is for and how an organization that needs 12 months (PCI DSS 10.5.1) raises it: in its own file or withTALE_RETENTION_AUDIT_MIN. The old comment cited SOC 2 / ISO 27001, neither of which sets a period.loadOrgRetentionConfigused to drop the validation error silently. It now logs[retention] bounds file unreadable for org <slug>: …compliance floor violation: auditLog.min >= 180, loginAttempt.min >= 90, matching the governance policy reader. The floor message is built from the floor map, so it can't drift again.tests/e2e/fixtures/config/docs-demo/governance/retention.jsonstill carried the retiredpromptTemplatescategory. It had not parsed since July, so demo orgs had no retention bounds. It now matches the builtin catalog.Existing organizations
An org keeps the bounds file it was seeded with; a regular upgrade does not rewrite it. Orgs created before this change still have
auditLog.min: 365. To allow 180 days there, the operator setsauditLog.min: 180in$TALE_CONFIG_DIR/<org>/governance/retention.yml, and an admin applies the bounds proposal under Settings › Governance › Policies & limits. No DB migration: the change only loosens validation, and every existing file stays valid.Rollback note: an image from before this change refuses a bounds file with
auditLog.minbelow 365. On such an image, an org created by this release (or lowered by an operator) shows no bounds and cannot save its retention policy until the file goes back to 365. Cleanup keeps using the applied snapshot.Verification
lib/shared/schemas/retention.test.ts(180 accepted; 179 and a login floor of 89 refused, naming both floors),backend/core/governance/shipped_retention.test.ts(both shipped catalogs parse, declare every category, admit 180 audit days, seed a policy inside their own bounds),backend/domains/retention/service.bounds-file.test.ts(refused file logged, missing file quiet). All 9 new assertions fail againstmainand pass here.lint:manual,lint:links, full platformoxlint --type-awareandtsc --noEmitgreen.auditLog.min: 180;auditLog: min — → 180;Not run locally:
backend:integration. CI's Backend integration check covers it; its fixtures useauditLog.min: 365, which stays valid.