Skip to content

Commit

Permalink
Merge pull request #1047 from SpecterOps/bed-5132-api-contract
Browse files Browse the repository at this point in the history
feat: bed-5132 - updated openapi spec for posture page api contract
  • Loading branch information
sircodemane authored Jan 27, 2025
2 parents c3a6464 + 4272426 commit de72020
Show file tree
Hide file tree
Showing 8 changed files with 361 additions and 40 deletions.
1 change: 0 additions & 1 deletion packages/go/graphschema/ad/ad.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/go/graphschema/azure/azure.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/go/graphschema/common/common.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

286 changes: 286 additions & 0 deletions packages/go/openapi/doc/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -12479,6 +12479,157 @@
}
}
},
"/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": [
{
"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": {
"environment_ids": {
"type": "array",
"items": {
"type": "string"
}
},
"finding": {
"type": "string"
},
"display_title": {
"type": "string"
},
"display_type": {
"type": "string"
},
"composite_risk": {
"type": "number",
"format": "double"
},
"finding_count_start": {
"type": "integer"
},
"finding_count_end": {
"type": "integer"
},
"finding_count_increase": {
"type": "integer"
},
"finding_count_decrease": {
"type": "integer"
},
"finding_impact_count": {
"type": "integer",
"nullable": true
},
"finding_exposure_count": {
"type": "integer",
"nullable": true
}
}
}
},
"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 +13527,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 +16597,18 @@
}
}
]
},
"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",
"attack-paths"
]
}
},
"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
Loading

0 comments on commit de72020

Please sign in to comment.