Skip to content

oscal-compass/oscal-sdk-go

oscal-sdk-go

Go Report Card GoDoc OpenSSF Scorecard

oscal-sdk-go complements the compliance-trestle SDK by providing the core SDK functionality in Go.

WARNING: This project is currently under initial development. APIs may be changed incompatibly from one commit to another.

Supported Functionality

Below is a table to show what is currently supported by the SDK.

SDK Functionality Supported
OSCAL Types with Basic Trestle Extensions ✔️
OSCAL Schema Validation
Target Components Extension
Multiple Parameters per Rule
OSCAL to OSCAL Transformation ✔️
OSCAL Constraints Validation

Get Started

Add the module as dependency to your project:

go get github.com/oscal-compass/oscal-sdk-go

SDK Terms

Extensions: oscal-compass uses OSCAL properties to extend OSCAL.
Rules: Rules are associated with Components and define a mechanism to verify the proper implementation of technical controls.
Settings: Settings define adjustments to fine-tune pre-defined options in Rules for the implementation of a specific compliance framework.

Perform a Transformation

import (
	...
	oscalTypes "github.com/defenseunicorns/go-oscal/src/types/oscal-1-1-2"

	"github.com/oscal-compass/oscal-sdk-go/generators"
	"github.com/oscal-compass/oscal-sdk-go/transformers"
)

func main() {
	file, err := os.Open("path-to-my-compdef")
	if err != nil {
		log.Fatalf("failed to open component definition, %v", err)
	}
	definition, err := generators.NewComponentDefinition(file)
	if err != nil {
		log.Fatalf("failed to read component definition, %v", err)
	}

	if definition != nil {
		assessmentPlan, err := transformers.ComponentDefinitionsToAssessmentPlan(context.Background(), []oscalTypes.ComponentDefinition{*definition}, "example-framework")
		if err != nil {
			log.Fatalf("failed to create assessment plan, %v", err)
		}
		assessmentPlanJSON, err := json.MarshalIndent(assessmentPlan, "", " ")
		if err != nil {
			log.Fatalf("failed to marshal assessment plan, %v", err)
		}
		fmt.Println(assessmentPlanJSON)
	}
}

Contributing

Our project welcomes external contributions. Please see CONTRIBUTING.md to get started.

Code of Conduct

Participation in the OSCAL Compass community is governed by the Code of Conduct.

Acknowledgments

This project leverages go_oscal to provide Go types for the OSCAL schema.

About

OSCAL SDK for the Go programming language

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •