Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
19 changes: 14 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ IMG ?= controller:latest
ENVTEST_K8S_VERSION = 1.26.1
# Default Test Path for a single integration test. Defaults to root
TEST_PATH ?= ./...
# Number of times to run integration tests (set >1 to hunt flakes)
INTEGRATION_RUNS ?= 1

BLUE := $(shell printf "\033[34m")
YELLOW := $(shell printf "\033[33m")
Expand Down Expand Up @@ -63,11 +65,18 @@ test: swag ## Run tests
$(OK) Tests passed

.PHONY: test-integration
test-integration: swag ## Run tests
@if ! go test ./... -coverprofile cover.out -v --tags integration; then \
$(WARN) "Tests failed"; \
exit 1; \
fi ; \
test-integration: swag ## Run integration tests (set INTEGRATION_RUNS>1 for flakiness detection)
@for run in $$(seq 1 $(INTEGRATION_RUNS)); do \
$(INFO) "Integration run $$run/$(INTEGRATION_RUNS)"; \
coverprofile_flag=""; \
if [ "$$run" -eq "$(INTEGRATION_RUNS)" ]; then \
coverprofile_flag="-coverprofile cover.out"; \
fi; \
if ! go test ./... -count=1 $$coverprofile_flag -v --tags integration; then \
$(WARN) "Tests failed on run $$run"; \
exit 1; \
fi ; \
done ; \
$(OK) Tests passed


Expand Down
298 changes: 298 additions & 0 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -17648,6 +17648,70 @@ const docTemplate = `{
]
}
},
"/risks/{id}/accept": {
"post": {
"description": "Accepts a risk with required justification and a future review deadline.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Risks"
],
"summary": "Accept risk",
"parameters": [
{
"type": "string",
"description": "Risk ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Accept payload",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.acceptRiskRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.GenericDataResponse-handler_riskResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api.Error"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
},
"security": [
{
"OAuth2Password": []
}
]
}
},
"/risks/{id}/components": {
"get": {
"description": "Lists components linked to a risk.",
Expand Down Expand Up @@ -18079,6 +18143,70 @@ const docTemplate = `{
]
}
},
"/risks/{id}/review": {
"post": {
"description": "Records a structured review for an accepted risk. nextReviewDeadline is required for decision=extend and must be omitted for decision=reopen.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Risks"
],
"summary": "Review risk",
"parameters": [
{
"type": "string",
"description": "Risk ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Review payload",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.reviewRiskRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.GenericDataResponse-handler_riskResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api.Error"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
},
"security": [
{
"OAuth2Password": []
}
]
}
},
"/risks/{id}/subjects": {
"get": {
"description": "Lists subjects linked to a risk.",
Expand Down Expand Up @@ -18570,6 +18698,148 @@ const docTemplate = `{
]
}
},
"/ssp/{sspId}/risks/{id}/accept": {
"post": {
"description": "Accepts a risk by ID scoped to an SSP.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Risks"
],
"summary": "Accept risk for SSP",
"parameters": [
{
"type": "string",
"description": "SSP ID",
"name": "sspId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Risk ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Accept payload",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.acceptRiskRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.GenericDataResponse-handler_riskResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api.Error"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
},
"security": [
{
"OAuth2Password": []
}
]
}
},
"/ssp/{sspId}/risks/{id}/review": {
"post": {
"description": "Records a risk review by ID scoped to an SSP. nextReviewDeadline is required for decision=extend and must be omitted for decision=reopen.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Risks"
],
"summary": "Review risk for SSP",
"parameters": [
{
"type": "string",
"description": "SSP ID",
"name": "sspId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Risk ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Review payload",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.reviewRiskRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.GenericDataResponse-handler_riskResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api.Error"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
},
"security": [
{
"OAuth2Password": []
}
]
}
},
"/subject-templates": {
"get": {
"description": "List subject templates with optional filters and pagination.",
Expand Down Expand Up @@ -24067,6 +24337,17 @@ const docTemplate = `{
"handler.UserHandler": {
"type": "object"
},
"handler.acceptRiskRequest": {
"type": "object",
"properties": {
"justification": {
"type": "string"
},
"reviewDeadline": {
"type": "string"
}
}
},
"handler.addComponentLinkRequest": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -24173,6 +24454,23 @@ const docTemplate = `{
}
}
},
"handler.reviewRiskRequest": {
"type": "object",
"properties": {
"decision": {
"type": "string"
},
"nextReviewDeadline": {
"type": "string"
},
"notes": {
"type": "string"
},
"reviewedAt": {
"type": "string"
}
}
},
"handler.riskControlLinkResponse": {
"type": "object",
"properties": {
Expand Down
Loading