-
Notifications
You must be signed in to change notification settings - Fork 7
feat(spec): validate webhookEndpoint format on PATCH /config #496
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,14 @@ properties: | |||||||||||||
| example: mycompany.com | ||||||||||||||
| webhookEndpoint: | ||||||||||||||
| type: string | ||||||||||||||
| format: uri | ||||||||||||||
| pattern: '^https://' | ||||||||||||||
| minLength: 9 | ||||||||||||||
|
Comment on lines
+8
to
+10
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: openapi/components/schemas/config/PlatformConfigUpdateRequest.yaml
Line: 8-10
Comment:
`minLength: 9` is derived from `len("https://") + 1 = 9`, which means `https://x` technically passes all three constraints (pattern, minLength, and loosely format:uri). The description already calls out that raw hostnames are rejected, but a value of `minLength: 11` would guarantee at least a minimal `host.tld` form. Consider either raising the value to match your shortest real-world endpoint or dropping it in favour of relying solely on `format: uri` + `pattern`.
```suggestion
format: uri
pattern: '^https://'
minLength: 11
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||||||||||
| description: | | ||||||||||||||
| HTTPS URL where Grid will POST webhook events. Must use the `https://` scheme; | ||||||||||||||
| `http://`, raw hostnames, and empty strings are rejected. Localhost and private | ||||||||||||||
| hostnames are not supported in production. To clear the webhook endpoint, omit | ||||||||||||||
| this field from the request rather than sending an empty string. | ||||||||||||||
| example: https://api.mycompany.com/webhooks/uma | ||||||||||||||
| supportedCurrencies: | ||||||||||||||
| type: array | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format: urienforcement is optional in JSON Schema Draft 2019-09 and later — validators are permitted to treat it as an annotation rather than a constraint. SDK generators that follow the spec loosely may skip it entirely, leavingpattern: '^https://'as the only reliably-enforced check. A string likehttps://not a urlorhttps:// spaceswould pass pattern + minLength but fail a strict URI parse. Addingpattern: '^https://[^\s]+'(or a stricter host regex) would give deterministic client-side rejection regardless of validator behaviour.Prompt To Fix With AI