Skip to content

Commit eab08e9

Browse files
CLOUDP-278402: Add security override validation
1 parent 689c913 commit eab08e9

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tools/spectral/.spectral.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ rules:
174174
functionOptions:
175175
match: "^mms(,[a-zA-Z0-9_-]+)*$"
176176
message: "'additionalServices' must start with 'mms' and can include additional services in a comma-separated format."
177-
no-slash-before-custom-method:
177+
178+
no-slash-before-custom-method:
178179
description: "Custom methods (e.g., ':applyItem') should not be preceded by a '/'."
179180
message: "The path '{{path}}' contains a '/' before a custom method. Custom methods should not start with a '/'."
180181
severity: error
@@ -185,6 +186,20 @@ rules:
185186
functionOptions:
186187
notMatch: "/[^/]+/:[a-zA-Z]+$"
187188

189+
xgen-security-override:
190+
description: "Security must not be set at resource or method level because it is set globally. Use @Unauthenticated annotation to set no security. https://go/openapi-unauthenticated-annotation"
191+
severity: error
192+
given: "#OperationObject.security"
193+
then:
194+
function: schema
195+
functionOptions:
196+
schema:
197+
type: array
198+
items:
199+
type: object
200+
minItems: 0
201+
maxItems: 0
202+
188203
overrides:
189204
- files: # load sample data has an issue with different path param names for different VERBS
190205
- "*.yaml#/paths/~1api~1atlas~1v1.0~1groups~1%7BgroupId%7D~1sampleDatasetLoad~1%7BsampleDatasetId%7D"

0 commit comments

Comments
 (0)