Skip to content
Open
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
9 changes: 8 additions & 1 deletion santa/santa.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ type Config struct {
type Rule struct {
RuleType RuleType `json:"rule_type" toml:"rule_type"`
Policy Policy `json:"policy" toml:"policy"`
SHA256 string `json:"sha256" toml:"sha256"`
SHA256 string `json:"sha256,omitempty" toml:"sha256,omitempty"`
Identifier string `json:"identifier,omitempty" toml:"identifier,omitempty"`
CustomMessage string `json:"custom_msg,omitempty" toml:"custom_msg,omitempty"`
}

Expand Down Expand Up @@ -65,6 +66,8 @@ const (
// This is a powerful rule type that has a much broader reach than an individual binary rule .
// A signing certificate can sign any number of binaries.
Certificate

TeamID
)

func (r *RuleType) UnmarshalText(text []byte) error {
Expand All @@ -73,6 +76,8 @@ func (r *RuleType) UnmarshalText(text []byte) error {
*r = Binary
case "CERTIFICATE":
*r = Certificate
case "TEAMID":
*r = TeamID
default:
return errors.Errorf("unknown rule_type value %q", t)
}
Expand All @@ -85,6 +90,8 @@ func (r RuleType) MarshalText() ([]byte, error) {
return []byte("BINARY"), nil
case Certificate:
return []byte("CERTIFICATE"), nil
case TeamID:
return []byte("TEAMID"), nil
default:
return nil, errors.Errorf("unknown rule_type %d", r)
}
Expand Down