Skip to content

Commit 9b30c56

Browse files
janiszclaude
andcommitted
refactor: rename init() to Register*() in hipaa_164 compliance checks
Renamed all package-level init() functions to explicit Register*() functions in 3 hipaa_164 compliance check files. Created pkg/compliance/checks/hipaa_164/init.go to call all register functions explicitly. Removed all.go with blank imports. This prevents automatic execution for all components in the busybox binary. Compliance checks now only run when explicitly initialized via checks.Init() in central/app/app.go. Files changed: - check308a3iib/check.go: init() → RegisterCheck308a3iib() - check308a4/check.go: init() → RegisterCheck308a4() - check312e1/check.go: init() → RegisterCheck312e1() - all.go: deleted (blank imports no longer needed) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 6744213 commit 9b30c56

5 files changed

Lines changed: 18 additions & 11 deletions

File tree

‎pkg/compliance/checks/hipaa_164/all.go‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎pkg/compliance/checks/hipaa_164/check308a3iib/check.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"github.com/stackrox/rox/pkg/compliance/checks/standards"
66
)
77

8-
func init() {
8+
func RegisterCheck308a3iib() {
99
standards.RegisterChecksForStandard(standards.Hipaa164, map[string]*standards.CheckAndMetadata{
1010
standards.HIPAA164CheckName("308_a_3_ii_b"): clusterIsCompliant(),
1111
})

‎pkg/compliance/checks/hipaa_164/check308a4/check.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"github.com/stackrox/rox/pkg/compliance/checks/standards"
66
)
77

8-
func init() {
8+
func RegisterCheck308a4() {
99
standards.RegisterChecksForStandard(standards.Hipaa164, map[string]*standards.CheckAndMetadata{
1010
standards.HIPAA164CheckName("308_a_4"): clusterIsCompliant(),
1111
})

‎pkg/compliance/checks/hipaa_164/check312e1/check.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"github.com/stackrox/rox/pkg/compliance/checks/standards"
66
)
77

8-
func init() {
8+
func RegisterCheck312e1() {
99
standards.RegisterChecksForStandard(standards.Hipaa164, map[string]*standards.CheckAndMetadata{
1010
standards.HIPAA164CheckName("312_e_1"): clusterIsCompliant(),
1111
})
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package hipaa164
2+
3+
import (
4+
"github.com/stackrox/rox/pkg/compliance/checks/hipaa_164/check308a3iib"
5+
"github.com/stackrox/rox/pkg/compliance/checks/hipaa_164/check308a4"
6+
"github.com/stackrox/rox/pkg/compliance/checks/hipaa_164/check312e1"
7+
)
8+
9+
// Init registers all HIPAA 164 compliance checks.
10+
// Called explicitly from pkg/compliance/checks/init.go instead of package init().
11+
func Init() {
12+
check308a3iib.RegisterCheck308a3iib()
13+
check308a4.RegisterCheck308a4()
14+
check312e1.RegisterCheck312e1()
15+
}

0 commit comments

Comments
 (0)