Skip to content

Commit

Permalink
add profobufs and fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Bertschy <[email protected]>
  • Loading branch information
matthyx committed Sep 6, 2024
1 parent 72918a9 commit 2da000d
Show file tree
Hide file tree
Showing 11 changed files with 1,229 additions and 706 deletions.
9 changes: 1 addition & 8 deletions pkg/apis/softwarecomposition/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,5 @@ type NetworkDirection string

const (
Inbound NetworkDirection = "inbound"
Outbound NetworkDirection = "inbound"
)

type IsInternal string

const (
True IsInternal = "true"
False IsInternal = "false"
Outbound NetworkDirection = "outbound"
)
3 changes: 1 addition & 2 deletions pkg/apis/softwarecomposition/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ type Arg struct {
type HTTPEndpoint struct {
Endpoint string
Methods []string
Internal consts.IsInternal
Internal bool
Direction consts.NetworkDirection
Headers map[string][]string
}
Expand All @@ -631,7 +631,6 @@ func (e *HTTPEndpoint) Equal(other *HTTPEndpoint) bool {
return e == other
}
return e.Endpoint == other.Endpoint && e.Direction == other.Direction && e.Internal == other.Internal

}

type SpecBase struct {
Expand Down
1,878 changes: 1,199 additions & 679 deletions pkg/apis/softwarecomposition/v1beta1/generated.pb.go

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions pkg/apis/softwarecomposition/v1beta1/generated.proto

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

14 changes: 7 additions & 7 deletions pkg/apis/softwarecomposition/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ type ApplicationProfileContainer struct {
Opens []OpenCalls `json:"opens" patchStrategy:"merge" patchMergeKey:"path" protobuf:"bytes,4,rep,name=opens"`
Syscalls []string `json:"syscalls" protobuf:"bytes,5,rep,name=syscalls"`
SeccompProfile SingleSeccompProfile `json:"seccompProfile,omitempty" protobuf:"bytes,6,opt,name=seccompProfile"`
Endpoints []HTTPEndpoint `json:"endpoints" patchStrategy:"merge" patchMergeKey:"endpoint"`
Endpoints []HTTPEndpoint `json:"endpoints" patchStrategy:"merge" patchMergeKey:"endpoint" protobuf:"bytes,7,rep,name=endpoints"`
}

type ExecCalls struct {
Expand Down Expand Up @@ -474,7 +474,7 @@ type SBOMSyftFiltered struct {
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

Spec SBOMSyftSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
Status SBOMSyftStatus `json:"status,omitempty " protobuf:"bytes,3,opt,name=status"`
Status SBOMSyftStatus `json:"status,omitempty\t" protobuf:"bytes,3,opt,name=status"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down Expand Up @@ -563,11 +563,11 @@ type Syscall struct {
}

type HTTPEndpoint struct {
Endpoint string `json:"endpoint,omitempty"`
Methods []string `json:"methods,omitempty"`
Internal consts.IsInternal `json:"internal,omitempty"`
Direction consts.NetworkDirection `json:"direction,omitempty"`
Headers map[string][]string `json:"headers,omitempty"`
Endpoint string `json:"endpoint,omitempty" protobuf:"bytes,1,opt,name=endpoint"`
Methods []string `json:"methods,omitempty" protobuf:"bytes,2,opt,name=methods"`
Internal bool `json:"internal,omitempty" protobuf:"bytes,3,opt,name=internal"`
Direction consts.NetworkDirection `json:"direction,omitempty" protobuf:"bytes,4,opt,name=direction"`
Headers map[string][]string `json:"headers,omitempty" protobuf:"bytes,5,opt,name=headers"`
}

// Arg defines the specific syscall in seccomp.
Expand Down

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

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

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

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

1 change: 0 additions & 1 deletion pkg/registry/file/applicationprofile_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func deflateApplicationProfileContainer(container softwarecomposition.Applicatio
logger.L().Debug("failed to analyze endpoints", loggerhelpers.Error(err))
endpoints = container.Endpoints
}

return softwarecomposition.ApplicationProfileContainer{
Name: container.Name,
Capabilities: mapset.Sorted(mapset.NewThreadUnsafeSet(container.Capabilities...)),
Expand Down
4 changes: 2 additions & 2 deletions pkg/registry/file/applicationprofile_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestApplicationProfileProcessor_PreSave(t *testing.T) {
{
Endpoint: "http://localhost:8080",
Methods: []string{"GET"},
Internal: consts.False,
Internal: false,
Direction: consts.Inbound,
Headers: map[string][]string{},
},
Expand Down Expand Up @@ -129,7 +129,7 @@ func TestApplicationProfileProcessor_PreSave(t *testing.T) {
{
Endpoint: "http://localhost:8080",
Methods: []string{"GET"},
Internal: consts.False,
Internal: false,
Direction: consts.Inbound,
Headers: map[string][]string{},
},
Expand Down

0 comments on commit 2da000d

Please sign in to comment.