-
Notifications
You must be signed in to change notification settings - Fork 11
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
fix: use tostring to match url #64
Conversation
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.
LGTM - should we have a test to cover each of these type given
scenarios (future issue to harden test suite perhaps)
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.
How about this?
Subject: [PATCH] fix: tweak api7:2023-concerning-url-parameter
---
Index: src/ruleset.ts
<+>UTF-8
===================================================================
diff --git a/src/ruleset.ts b/src/ruleset.ts
--- a/src/ruleset.ts (revision d233da88b881d1486cc9aa762b77c99d2e44e47b)
+++ b/src/ruleset.ts (date 1710170011929)
@@ -1,6 +1,5 @@
import {
defined,
- undefined,
truthy,
pattern,
schema,
@@ -16,6 +15,9 @@
formats: [oas2, oas3],
aliases: {
+ PathItem: ['$.paths[*]'],
+ OperationObject: ['#PathItem[get,put,post,delete,options,head,patch,trace]'],
+
ArrayProperties: {
targets: [
{
@@ -716,10 +718,15 @@
description:
"Using external resource based on user input for webhooks, file fetching from URLs, custom SSO, URL previews, or redirects, can lead to a wide variety of security issues.\n\nLearn more about Server Side Request Forgery here: https://owasp.org/API-Security/editions/2023/en/0xa7-server-side-request-forgery/",
severity: DiagnosticSeverity.Information,
- given:
- '$.paths..parameters[*][?(@property === "name" && (@ === "callback" || @ === "redirect" || @.match(/(_url|Url|-url)$/)))]^',
+ given: [
+ '#PathItem.parameters[*].name',
+ '#OperationObject.parameters[*].name',
+ ],
then: {
- function: undefined,
+ function: pattern,
+ functionOptions: {
+ notMatch: /(^(callback|redirect)|(_url|Url|-url))$/,
+ }
},
},
Co-authored-by: Jakub Rożek <[email protected]>
🎉 This PR is included in version 2.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Fixes #63