Compare commits

..

No commits in common. "ffa8f99d67773b7090e869927c126574aad1cb2a" and "c582a66b014d6f8c02665fe3327a48c4b19d7b25" have entirely different histories.

3 changed files with 3 additions and 8 deletions

View File

@ -69,7 +69,7 @@ steps:
resources: resources:
limits: limits:
cpu: 250 cpu: 250
memory: 500M memory: 250M
- name: email-notification - name: email-notification
environment: environment:

View File

@ -39,7 +39,6 @@ func GetDefaultConfiguration() (*types.Config, error) {
func Read(cnfFile string) (*types.Config, error) { func Read(cnfFile string) (*types.Config, error) {
// Load burned in configuration if config not available // Load burned in configuration if config not available
if _, err := os.Stat(cnfFile); os.IsNotExist(err) { if _, err := os.Stat(cnfFile); os.IsNotExist(err) {
// #nosec G301
if err := os.MkdirAll(filepath.Dir(cnfFile), 0755); err != nil { if err := os.MkdirAll(filepath.Dir(cnfFile), 0755); err != nil {
return nil, fmt.Errorf("failed to create directory: %w", err) return nil, fmt.Errorf("failed to create directory: %w", err)
} }
@ -58,12 +57,11 @@ func Read(cnfFile string) (*types.Config, error) {
return cnf, nil return cnf, nil
} }
// #nosec G304
f, err := os.Open(cnfFile) f, err := os.Open(cnfFile)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to open file: %w", err) return nil, fmt.Errorf("failed to open file: %w", err)
} }
defer func() { _ = f.Close() }() defer f.Close()
cnf := new(types.Config) cnf := new(types.Config)
jsonDecoder := json.NewDecoder(f) jsonDecoder := json.NewDecoder(f)
@ -99,19 +97,17 @@ func Read(cnfFile string) (*types.Config, error) {
// Write config into a file // Write config into a file
func Write(cnf *types.Config, cnfFile string) error { func Write(cnf *types.Config, cnfFile string) error {
if _, err := os.Stat(filepath.Dir(cnfFile)); os.IsNotExist(err) { if _, err := os.Stat(filepath.Dir(cnfFile)); os.IsNotExist(err) {
// #nosec G301
err := os.MkdirAll(filepath.Dir(cnfFile), 0755) err := os.MkdirAll(filepath.Dir(cnfFile), 0755)
if err != nil { if err != nil {
return err return err
} }
} }
// #nosec G304
f, err := os.Create(cnfFile) f, err := os.Create(cnfFile)
if err != nil { if err != nil {
return fmt.Errorf("failed to create file %v: %v", cnfFile, err) return fmt.Errorf("failed to create file %v: %v", cnfFile, err)
} }
defer func() { _ = f.Close() }() defer f.Close()
jsonEncoder := json.NewEncoder(f) jsonEncoder := json.NewEncoder(f)
jsonEncoder.SetIndent("", " ") jsonEncoder.SetIndent("", " ")

View File

@ -46,7 +46,6 @@ func (u *NSUpdate) execute(ctx context.Context, nsUpdateCmd string) error {
errBuffer := new(bytes.Buffer) errBuffer := new(bytes.Buffer)
// #nosec G204
cmd := exec.CommandContext(ctx, "nsupdate", "-y", fmt.Sprintf("%v:%v:%v", u.tsigKey.Algorithm, u.tsigKey.Name, u.tsigKey.Secret)) cmd := exec.CommandContext(ctx, "nsupdate", "-y", fmt.Sprintf("%v:%v:%v", u.tsigKey.Algorithm, u.tsigKey.Name, u.tsigKey.Secret))
// cmd.Stdout = os.Stdout // cmd.Stdout = os.Stdout
cmd.Stderr = bufio.NewWriter(errBuffer) cmd.Stderr = bufio.NewWriter(errBuffer)