Files
sdk/docs/SecurityAPI.md

14 KiB

\SecurityAPI

All URIs are relative to https://api.hanzo.ai

Method HTTP request Description
GetSecurityFindings Get /v1/security/findings Is the org's findings — rule, severity, path, line, masked preview and fingerprint — newest first, across scans or within one.
GetSecurityFindingsById Get /v1/security/findings/{id} Returns a single finding: which rule fired, where (path and line), the masked preview and the SHA-256 fingerprint of the secret — the raw secret is not stored and cannot be read back.
GetSecurityHealth Get /v1/security/health Reports that the scanning subsystem is serving and how many secret-detection rules the engine holds.
GetSecurityRules Get /v1/security/rules Is the secret-detection catalog the engine scans with.
GetSecurityScans Get /v1/security/scans Is the org's scan history, newest first, each as the same summary the submission answered — files read, findings fired, tally by severity.
GetSecurityScansById Get /v1/security/scans/{id} Returns one scan together with every finding on it, so the detail view is one round-trip rather than a list call per scan.
PostSecurityScans Post /v1/security/scans Runs the detection engine over a batch of files and answers 201 with the scan summary: how many files were read, how many findings fired, and the tally by severity.

GetSecurityFindings

SecurityFindingList GetSecurityFindings(ctx).ScanId(scanId).MinSeverity(minSeverity).Limit(limit).Execute()

Is the org's findings — rule, severity, path, line, masked preview and fingerprint — newest first, across scans or within one.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	scanId := "scanId_example" // string | ScanID narrows to a single scan. (optional)
	minSeverity := "minSeverity_example" // string | MinSeverity drops everything below that rank: critical, high, medium or low. A value outside that set is refused rather than quietly ignored, so a filter typo cannot read as \"no findings\". (optional)
	limit := int64(789) // int64 | Limit caps the page. (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SecurityAPI.GetSecurityFindings(context.Background()).ScanId(scanId).MinSeverity(minSeverity).Limit(limit).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SecurityAPI.GetSecurityFindings``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetSecurityFindings`: SecurityFindingList
	fmt.Fprintf(os.Stdout, "Response from `SecurityAPI.GetSecurityFindings`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiGetSecurityFindingsRequest struct via the builder pattern

Name Type Description Notes
scanId string ScanID narrows to a single scan.
minSeverity string MinSeverity drops everything below that rank: critical, high, medium or low. A value outside that set is refused rather than quietly ignored, so a filter typo cannot read as "no findings".
limit int64 Limit caps the page.

Return type

SecurityFindingList

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetSecurityFindingsById

SecurityFindingView GetSecurityFindingsById(ctx, id).Execute()

Returns a single finding: which rule fired, where (path and line), the masked preview and the SHA-256 fingerprint of the secret — the raw secret is not stored and cannot be read back.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | ID is the finding the URL names.

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SecurityAPI.GetSecurityFindingsById(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SecurityAPI.GetSecurityFindingsById``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetSecurityFindingsById`: SecurityFindingView
	fmt.Fprintf(os.Stdout, "Response from `SecurityAPI.GetSecurityFindingsById`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string ID is the finding the URL names.

Other Parameters

Other parameters are passed through a pointer to a apiGetSecurityFindingsByIdRequest struct via the builder pattern

Name Type Description Notes

Return type

SecurityFindingView

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetSecurityHealth

SecurityRuleset GetSecurityHealth(ctx).Execute()

Reports that the scanning subsystem is serving and how many secret-detection rules the engine holds.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SecurityAPI.GetSecurityHealth(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SecurityAPI.GetSecurityHealth``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetSecurityHealth`: SecurityRuleset
	fmt.Fprintf(os.Stdout, "Response from `SecurityAPI.GetSecurityHealth`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetSecurityHealthRequest struct via the builder pattern

Return type

SecurityRuleset

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetSecurityRules

SecurityRuleList GetSecurityRules(ctx).Execute()

Is the secret-detection catalog the engine scans with.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SecurityAPI.GetSecurityRules(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SecurityAPI.GetSecurityRules``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetSecurityRules`: SecurityRuleList
	fmt.Fprintf(os.Stdout, "Response from `SecurityAPI.GetSecurityRules`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetSecurityRulesRequest struct via the builder pattern

Return type

SecurityRuleList

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetSecurityScans

SecurityScanList GetSecurityScans(ctx).Limit(limit).Execute()

Is the org's scan history, newest first, each as the same summary the submission answered — files read, findings fired, tally by severity.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	limit := int64(789) // int64 | Limit caps the page. (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SecurityAPI.GetSecurityScans(context.Background()).Limit(limit).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SecurityAPI.GetSecurityScans``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetSecurityScans`: SecurityScanList
	fmt.Fprintf(os.Stdout, "Response from `SecurityAPI.GetSecurityScans`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiGetSecurityScansRequest struct via the builder pattern

Name Type Description Notes
limit int64 Limit caps the page.

Return type

SecurityScanList

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetSecurityScansById

SecurityScanDetail GetSecurityScansById(ctx, id).Execute()

Returns one scan together with every finding on it, so the detail view is one round-trip rather than a list call per scan.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | ID is the scan the URL names.

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SecurityAPI.GetSecurityScansById(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SecurityAPI.GetSecurityScansById``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetSecurityScansById`: SecurityScanDetail
	fmt.Fprintf(os.Stdout, "Response from `SecurityAPI.GetSecurityScansById`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string ID is the scan the URL names.

Other Parameters

Other parameters are passed through a pointer to a apiGetSecurityScansByIdRequest struct via the builder pattern

Name Type Description Notes

Return type

SecurityScanDetail

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PostSecurityScans

SecurityScanView PostSecurityScans(ctx).SecuritySubmitReq(securitySubmitReq).Execute()

Runs the detection engine over a batch of files and answers 201 with the scan summary: how many files were read, how many findings fired, and the tally by severity.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	securitySubmitReq := *openapiclient.NewSecuritySubmitReq([]openapiclient.SecurityScan{*openapiclient.NewSecurityScan()}) // SecuritySubmitReq | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SecurityAPI.PostSecurityScans(context.Background()).SecuritySubmitReq(securitySubmitReq).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SecurityAPI.PostSecurityScans``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `PostSecurityScans`: SecurityScanView
	fmt.Fprintf(os.Stdout, "Response from `SecurityAPI.PostSecurityScans`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiPostSecurityScansRequest struct via the builder pattern

Name Type Description Notes
securitySubmitReq SecuritySubmitReq

Return type

SecurityScanView

Authorization

bearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]