Skip to content
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

feat: bed-5132 - updated openapi spec for posture page api contract #1047

Open
wants to merge 6 commits into
base: BED-5083
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
267 changes: 267 additions & 0 deletions packages/go/openapi/doc/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -12479,6 +12479,139 @@
}
}
},
"/api/v2/attack-paths/finding-trends": {
"parameters": [
{
"$ref": "#/components/parameters/header.prefer"
}
],
"get": {
"operationId": "FindingTrendsForEnvironment",
"summary": "List finding trends",
"description": "Lists findings and their changes in between two dates for an environment",
"tags": [
"Attack Paths",
"Enterprise"
],
"parameters": [
benwaples marked this conversation as resolved.
Show resolved Hide resolved
{
"name": "environments",
"description": "Environment IDs",
"in": "query",
"required": true,
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
{
"name": "start",
"description": "Beginning datetime of range (inclusive) in RFC-3339 format; Defaults to current datetime minus 30 days",
"in": "query",
"schema": {
"type": "string",
"format": "date-time"
}
},
{
"name": "end",
"description": "Ending datetime of range (exclusive) in RFC-3339 format; Defaults to current datetime",
"in": "query",
"schema": {
"type": "string",
"format": "date-time"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"allOf": [
{
"$ref": "#/components/schemas/api.response.time-window"
},
{
"type": "object",
"properties": {
"environments": {
"type": "array",
"items": {
"type": "string"
}
},
"data": {
"type": "object",
"properties": {
"findings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"finding": {
"type": "string"
},
"display_title": {
"type": "string"
},
"display_type": {
"type": "string"
},
"finding_count_start": {
"type": "integer"
},
"finding_count_end": {
"type": "integer"
},
"finding_count_increase": {
"type": "integer"
},
"finding_count_decrease": {
"type": "integer"
}
}
}
},
"total_finding_count_start": {
"type": "integer"
},
"total_finding_count_end": {
"type": "integer"
}
}
}
}
}
]
}
}
}
},
"400": {
"$ref": "#/components/responses/bad-request"
},
"401": {
"$ref": "#/components/responses/unauthorized"
},
"403": {
"$ref": "#/components/responses/forbidden"
},
"404": {
"$ref": "#/components/responses/not-found"
},
"429": {
"$ref": "#/components/responses/too-many-requests"
},
"500": {
"$ref": "#/components/responses/internal-server-error"
}
}
}
},
"/api/v2/attack-path-types": {
"parameters": [
{
Expand Down Expand Up @@ -13376,6 +13509,129 @@
}
}
},
"/api/v2/posture-history/{data_type}": {
"parameters": [
{
"$ref": "#/components/parameters/header.prefer"
},
{
"name": "data_type",
"description": "The type of posture data to return",
"in": "path",
"required": true,
"schema": {
"$ref": "#/components/schemas/enum.posture-history-type"
}
}
],
"get": {
"operationId": "PostureHistoryForEnvironments",
"summary": "Get Posture History",
"description": "Gets posture data count changes over a time period",
"tags": [
"Risk Posture",
"Enterprise"
],
"parameters": [
{
"name": "environments",
"description": "Environment IDs",
"in": "query",
"required": true,
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
{
"name": "start",
"description": "Beginning datetime of range (inclusive) in RFC-3339 format; Defaults to current datetime minus 30 days",
"in": "query",
"schema": {
"type": "string",
"format": "date-time"
}
},
{
"name": "end",
"description": "Ending datetime of range (exclusive) in RFC-3339 format; Defaults to current datetime",
"in": "query",
"schema": {
"type": "string",
"format": "date-time"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"allOf": [
{
"$ref": "#/components/schemas/api.response.time-window"
},
{
"type": "object",
"properties": {
"environments": {
"type": "array",
"items": {
"type": "string"
}
},
"data_type": {
"$ref": "#/components/schemas/enum.posture-history-type"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"date": {
"type": "string",
"format": "date-time",
"readOnly": true
},
"value": {
"type": "number",
"format": "double",
"readOnly": true
}
}
}
}
}
}
]
}
}
}
},
"400": {
"$ref": "#/components/responses/bad-request"
},
"401": {
"$ref": "#/components/responses/unauthorized"
},
"403": {
"$ref": "#/components/responses/forbidden"
},
"404": {
"$ref": "#/components/responses/not-found"
},
"429": {
"$ref": "#/components/responses/too-many-requests"
},
"500": {
"$ref": "#/components/responses/internal-server-error"
}
}
}
},
"/api/v2/meta/{object_id}": {
"parameters": [
{
Expand Down Expand Up @@ -16323,6 +16579,17 @@
}
}
]
},
"enum.posture-history-type": {
"type": "string",
"description": "This enum describes the valid data types for posture history results.",
"enum": [
"findings",
"exposure",
"assets",
"session_completeness",
"group_completeness"
sircodemane marked this conversation as resolved.
Show resolved Hide resolved
]
}
},
"responses": {
Expand Down
8 changes: 4 additions & 4 deletions packages/go/openapi/src/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,8 @@ paths:
# attack paths
/api/v2/domains/{domain_id}/attack-path-findings:
$ref: './paths/attack-paths.domains.id.attack-path-findings.yaml'
# /api/v2/domains/{environment_id}/finding-trends:
# $ref: './paths/attack-paths.environment.id.finding-trends.yaml'
/api/v2/attack-paths/finding-trends:
$ref: './paths/attack-paths.attack-paths.finding-trends.yaml'
/api/v2/attack-path-types:
$ref: './paths/attack-paths.attack-path-types.yaml'
/api/v2/attack-paths:
Expand All @@ -664,8 +664,8 @@ paths:
# risk posture
/api/v2/posture-stats:
$ref: './paths/risk-posture.posture-stats.yaml'
# /api/v2/domains/{environment_id}/posture-history/{data_type}:
# $ref: './paths/risk-posture.environment.id.posture-history.type.yaml'
/api/v2/posture-history/{data_type}:
$ref: './paths/risk-posture.posture-history.data-type.yaml'

# meta entity
/api/v2/meta/{object_id}:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@

parameters:
- $ref: './../parameters/header.prefer.yaml'
- name: environment_id
description: Environment ID
in: path
required: true
schema:
type: string

get:
operationId: FindingTrendsForEnvironment
summary: List finding trends
Expand All @@ -30,11 +25,14 @@ get:
- Attack Paths
- Enterprise
parameters:
# - name: sort_by
# description: Sortable columns are composite_risk, start_count, end_count, change.
# in: query
# schema:
# $ref: './../schemas/api.params.query.sort-by.yaml'
- name: environments
description: Environment IDs
in: query
required: true
schema:
type: array
items:
type: string
- name: start
description: Beginning datetime of range (inclusive) in RFC-3339 format; Defaults
to current datetime minus 30 days
Expand All @@ -59,6 +57,10 @@ get:
- $ref: './../schemas/api.response.time-window.yaml'
- type: object
properties:
environments:
type: array
items:
type: string
data:
type: object
properties:
Expand All @@ -67,17 +69,24 @@ get:
items:
type: object
properties:
environment_id:
type: string
# environments: // TODO: to be determined if useful
# type: array
# items:
# type: string
finding:
type: string
composite_risk:
type: number
format: double
display_title:
type: string
display_type:
type: string
finding_count_start:
type: integer
finding_count_end:
type: integer
finding_count_increase:
type: integer
finding_count_decrease:
type: integer
total_finding_count_start:
type: integer
total_finding_count_end:
Expand Down
Loading
Loading