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
24 changes: 24 additions & 0 deletions internal/core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,21 @@ type MakefileConfig struct {
Enabled Option[bool] `yaml:"enabled"` // this is a pointer to bool to treat an absence as true for backwards compatibility
}

// Metadata appears in type Configuration.
type Metadata struct {
URL string `yaml:"url"`
}

// IsSAPProject returns whether the project URL is below one of the scopes known to belong to SAP.
func (m Metadata) IsSAPProject() bool {
return strings.HasPrefix(m.URL, "https://github.com/sapcc/") ||
strings.HasPrefix(m.URL, "https://github.com/SAP-cloud-infrastructure/") ||
strings.HasPrefix(m.URL, "https://github.com/cobaltcore-dev/") ||
strings.HasPrefix(m.URL, "https://github.com/ironcore-dev/") ||
strings.HasPrefix(m.URL, "https://github.wdf.sap.corp/") ||
strings.HasPrefix(m.URL, "https://github.tools.sap/")
}

type NixConfig struct {
ExtraLibraries []string `yaml:"extraLibraries"`
ExtraPackages []string `yaml:"extraPackages"`
Expand Down Expand Up @@ -316,4 +327,17 @@ func (c *Configuration) Validate() {
}
}
}

// for SAP projects, we require the use of:
// - Renovate as a Software Composition Analysis tool
// - GitHub Advanced Security (specifically CodeQL) as a Security Check tool
// in order to satisfy compliance requirements
if c.Metadata.IsSAPProject() {
if ghwCfg != nil && !ghwCfg.SecurityChecks.IsEnabled() {
logg.Fatal("githubWorkflow.securityChecks.enabled may not be set to false (CodeQL is required for SAP projects to satisfy compliance requirements)")
}
if !c.Renovate.Enabled {
logg.Fatal("renovate.enabled must be set to true (Renovate is required for SAP projects to satisfy compliance requirements)")
}
}
}
7 changes: 1 addition & 6 deletions internal/makefile/makefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@ func newMakefile(cfg core.Configuration, sr golang.ScanResult) *makefile {
runControllerGen := cfg.ControllerGen.Enabled.UnwrapOr(sr.KubernetesController)
// TODO: checking on GoVersion is only an aid until we can properly detect rust applications
isGolang := sr.GoVersion != ""
isSAPCC := strings.HasPrefix(cfg.Metadata.URL, "https://github.com/sapcc/") ||
strings.HasPrefix(cfg.Metadata.URL, "https://github.com/SAP-cloud-infrastructure/") ||
strings.HasPrefix(cfg.Metadata.URL, "https://github.com/cobaltcore-dev/") ||
strings.HasPrefix(cfg.Metadata.URL, "https://github.com/ironcore-dev/") ||
strings.HasPrefix(cfg.Metadata.URL, "https://github.wdf.sap.corp/") ||
strings.HasPrefix(cfg.Metadata.URL, "https://github.tools.sap/")
isSAPCC := cfg.Metadata.IsSAPProject()

///////////////////////////////////////////////////////////////////////////
// General
Expand Down
Loading