From 7f66fa8f756af1c39d7ac63094be080e2b98cc1e Mon Sep 17 00:00:00 2001 From: Phil Sturgeon <67381+philsturgeon@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:35:03 +0100 Subject: [PATCH] simplified regex thanks to @P0lip --- __tests__/owasp-api9-2023-inventory-access.test.ts | 2 +- __tests__/owasp-api9-2023-inventory-environment.test.ts | 2 +- src/ruleset.ts | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/__tests__/owasp-api9-2023-inventory-access.test.ts b/__tests__/owasp-api9-2023-inventory-access.test.ts index b2a3eeb..210101e 100644 --- a/__tests__/owasp-api9-2023-inventory-access.test.ts +++ b/__tests__/owasp-api9-2023-inventory-access.test.ts @@ -1,7 +1,7 @@ import { DiagnosticSeverity } from "@stoplight/types"; import testRule from "./__helpers__/helper"; -testRule("owasp:api8:2023-inventory-access", [ +testRule("owasp:api9:2023-inventory-access", [ { name: "valid case: declares x-internal as either true or false", document: { diff --git a/__tests__/owasp-api9-2023-inventory-environment.test.ts b/__tests__/owasp-api9-2023-inventory-environment.test.ts index fd90257..d788d69 100644 --- a/__tests__/owasp-api9-2023-inventory-environment.test.ts +++ b/__tests__/owasp-api9-2023-inventory-environment.test.ts @@ -1,7 +1,7 @@ import { DiagnosticSeverity } from "@stoplight/types"; import testRule from "./__helpers__/helper"; -testRule("owasp:api8:2023-inventory-environment", [ +testRule("owasp:api9:2023-inventory-environment", [ { name: "valid case: mentions one keyword in each server", document: { diff --git a/src/ruleset.ts b/src/ruleset.ts index 78a0cb6..f48560a 100644 --- a/src/ruleset.ts +++ b/src/ruleset.ts @@ -858,13 +858,13 @@ export default { * How to prevent * - 🟠 Servers, define which environment is the API running in (e.g. production, staging, test, development) * - ✅ Require servers use x-internal true/false to explicitly explain what is public or internal for documentation tools - * - 🟠 There is no retirement plan for each API version. + * - 🤷‍♂️ There is no retirement plan for each API version. */ /** * @author: Phil Sturgeon */ - "owasp:api8:2023-inventory-access": { + "owasp:api9:2023-inventory-access": { message: "Declare intended audience of every server by defining servers{{property}} as true/false.", description: @@ -881,7 +881,7 @@ export default { /** * @author: Phil Sturgeon */ - "owasp:api8:2023-inventory-environment": { + "owasp:api9:2023-inventory-environment": { message: "Declare intended environment in server descriptions using terms like local, staging, production.", description: @@ -894,7 +894,7 @@ export default { function: pattern, functionOptions: { match: - "((l|L)ocal|(a|A)lpha|(b|B)eta|(t|T)est|testing|stag|(s|S)taging|(p|P)rod|(p|P)roduction|(n|N)ext|(p|P)reprod)", + "/(local|alpha|beta|test|testing|stag|staging|prod|production|next|preprod)/i", }, }, },