You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[XMSSecretInResponse] Enhanced rule to check definitions properties, exclude enum properties (enum and x-ms-enum), exclude properties containing 'public' in their name, and report errors at definition level
message: `Property '${prpName}' contains secret keyword and does not have 'x-ms-secret' annotation. To ensure security, must add the 'x-ms-secret' annotation to this property.`,
3268
3271
path: [...path,prpName],
@@ -3780,8 +3783,8 @@ const ruleset = {
3780
3783
description: `When defining the response model for an ARM PUT/GET/POST operation, any property that contains sensitive information (such as passwords, keys, tokens, credentials, or other secrets) must include the "x-ms-secret": true annotation. This ensures that secrets are properly identified and handled according to ARM security guidelines.`,
description: "Synchronous POST must return 200 when a response body is required or 204 when no body is needed; LRO POST must initially return 202, with the final response returning 200 if a body is expected or 204 if not.",
183
+
description:
184
+
"Synchronous POST must return 200 when a response body is required or 204 when no body is needed; LRO POST must initially return 202, with the final response returning 200 if a body is expected or 204 if not.",
properties[prpName]["x-ms-secret"]!==true&&// not explicitly marked as secret
38
39
!keyValuePairCheck&&// not a key-value pair key
39
-
properties[prpName].type==="string"// property type is string
40
+
properties[prpName].type==="string"&&// property type is string
41
+
!properties[prpName].enum&&// not a standard enum property
42
+
!properties[prpName]["x-ms-enum"]// not an x-ms-enum property
40
43
){
41
44
errors.push({
42
45
message: `Property '${prpName}' contains secret keyword and does not have 'x-ms-secret' annotation. To ensure security, must add the 'x-ms-secret' annotation to this property.`,
Copy file name to clipboardExpand all lines: packages/rulesets/src/spectral/test/xms-secret-in-response.test.ts
+44-37Lines changed: 44 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@ import linterForRule from "./utils"
4
4
letlinter: Spectral
5
5
6
6
constERROR_MESSAGE=`Property '{prpName}' contains secret keyword and does not have 'x-ms-secret' annotation. To ensure security, must add the 'x-ms-secret' annotation to this property.`
0 commit comments