Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.17] [ResponseOps][Rules] Validate timezone in rule routes (#201508) #208299

Open
wants to merge 2 commits into
base: 8.17
Choose a base branch
from

Conversation

cnasikas
Copy link
Member

Backport

This will backport the following commits from main to 8.17:

Questions ?

Please refer to the Backport tool documentation

## Summary

This PR adds validation only for internal routes that use the `rRule`
schema.

## Testing

1. Create a rule in main.
2. Snooze the rule by using the API as

```
POST /internal/alerting/rule/<ruleId>/_snooze
{
    "snooze_schedule": {
        "id": "e58e2340-dba6-454c-8308-b2ca66a7cf7b",
        "duration": 86400000,
        "rRule": {
            "dtstart": "2024-09-04T09:27:37.011Z",
            "tzid": "invalid",
            "freq": 2,
            "interval": 1,
            "byweekday": [
                "invalid"
            ]
        }
    }
}
```

4. Go to the rules page and verify that the rules are not loaded.
5. Switch to my PR.
6. Go to the rules page and verify that the rules load.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit 9a3fc89)

# Conflicts:
#	packages/kbn-rrule/validate.test.ts
#	packages/kbn-rrule/validate.ts
#	x-pack/packages/kbn-cloud-security-posture/common/types/graph/latest.ts
#	x-pack/platform/plugins/shared/alerting/server/lib/snooze/is_snooze_active.test.ts
#	x-pack/platform/plugins/shared/alerting/server/lib/snooze/is_snooze_active.ts
#	x-pack/plugins/alerting/common/routes/r_rule/request/schemas/v1.ts
#	x-pack/plugins/alerting/common/routes/r_rule/validation/index.ts
#	x-pack/plugins/alerting/common/routes/r_rule/validation/validate_recurrence_by/v1.ts
#	x-pack/plugins/alerting/server/application/rule/methods/snooze/snooze_rule.test.ts
#	x-pack/plugins/alerting/server/lib/snooze/get_active_snooze_if_exist.test.ts
#	x-pack/plugins/alerting/server/lib/snooze/get_active_snooze_if_exist.ts
#	x-pack/plugins/alerting/server/lib/snooze/is_snooze_active.test.ts
#	x-pack/plugins/alerting/server/lib/snooze/is_snooze_active.ts
#	x-pack/plugins/triggers_actions_ui/tsconfig.json
@cnasikas
Copy link
Member Author

Blocked by #208182.

@elasticmachine
Copy link
Contributor

elasticmachine commented Jan 25, 2025

⏳ Build in-progress, with failures

Failed CI Steps

History

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants