cloudflare/pint

Public

mirrored from https://github.com/cloudflare/pintAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.28.4

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

docs/checks/rule/link.md

112lines · modecode

1---
2layout: default
3parent: Checks
4grand_parent: Documentation
5---
6
7# rule/link
8
9This check allows to validate if URLs passed in alerting rule
10annotations. It will send a GET request to each link matching
11configured regexp and warn if it gets a non-200 response.
12
13## Configuration
14
15Syntax:
16
17```js
18link "$pattern" {
19 severity = "bug|warning|info"
20 uri = "..."
21 timeout = "1m"
22 headers = { ... }
23}
24```
25
26- `$pattern` - regexp pattern to match, each rule will only check link
27 URLs that match this patter. This can be templated to reference checked
28 rule fields, see [Configuration](../../configuration.md) for details.
29- `uri` - optional URI rewrite rule, this will be used as the URI for all
30 requests if specified, regexp capture groups can be referenced here.
31- `severity` - set custom severity for reported issues, defaults to a bug.
32- `timeout` - timeout to be used for all request, defaults to 1 minute.
33- `headers` - a list of HTTP headers to set on all requests.
34
35## How to enable it
36
37This check is not enabled by default as it requires explicit configuration
38to work.
39To enable it add one or more `rule {...}` blocks and specify all rejected patterns
40there.
41
42Examples:
43
44Validate all links found in alert annotations:
45
46```js
47rule {
48 link "https?://.+" {}
49}
50```
51
52Only validate HTTPS links, ignore plain HTTP.
53
54```js
55rule {
56 link "https://.+" {}
57}
58```
59
60Only validate specific hostname.
61
62```js
63rule {
64 link "https?://runbooks.example.com/.+" {}
65}
66```
67
68Rewrite URI to use `http://docs.internal.example.com/foo.html` instead of
69`https://docs.example.com/foo.html`:
70
71```js
72rule {
73 link "https?://docs.example.com/(.+)" {
74 uri = "http://docs.internal.example.com/$1"
75 }
76}
77```
78
79Set `X-Auth` header for all requests.
80
81```js
82rule {
83 link "https?://runbooks.example.com/.+" {
84 headers = {
85 X-Auth = "secret key"
86 }
87 }
88}
89```
90
91## How to disable it
92
93You can disable this check globally by adding this config block:
94
95```js
96checks {
97 disabled = ["rule/link"]
98}
99```
100
101Or you can disable it per rule by adding a comment to it.
102
103`# pint disable rule/link`
104
105If you want to disable only individual instances of this check
106you can add a more specific comment.
107
108`# pint disable rule/link($pattern)`
109
110Example:
111
112`# pint disable rule/link(^https?://.+$)`
113