Skip to content

Commit 9ebb5c0

Browse files
committed
fix: enforce encryption by default and simplify validation logic
1 parent 1899dad commit 9ebb5c0

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

pkg/lib/operation/project/local/template/use/operation.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ func (p *TemplatePlan) Invoke(ctx context.Context) (*Result, error) {
277277
return nil, err
278278
}
279279

280-
// Encrypt values
280+
// Encrypt values - ALWAYS, except when creating template tests (SkipEncrypt flag)
281281
if !p.options.SkipEncrypt {
282282
if err := encrypt.Run(ctx, p.options.ProjectState, encrypt.Options{DryRun: false, LogEmpty: false}, p.deps); err != nil {
283283
return nil, err
@@ -298,7 +298,8 @@ func (p *TemplatePlan) Invoke(ctx context.Context) (*Result, error) {
298298
}
299299

300300
// Validate schemas and encryption
301-
if err := validate.Run(ctx, p.options.ProjectState, validate.Options{ValidateSecrets: !p.options.SkipSecretsValidation, ValidateJSONSchema: true}, p.deps); err != nil {
301+
validateSecrets := p.options.SkipEncrypt && !p.options.SkipSecretsValidation
302+
if err := validate.Run(ctx, p.options.ProjectState, validate.Options{ValidateSecrets: validateSecrets, ValidateJSONSchema: true}, p.deps); err != nil {
302303
logger.Warn(ctx, errors.Format(errors.PrefixError(err, "warning"), errors.FormatAsSentences()))
303304
logger.Warn(ctx, "")
304305
logger.Warn(ctx, `Please correct the problems listed above.`)

pkg/lib/operation/project/sync/push/operation.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ func Run(ctx context.Context, projectState *project.State, o Options, d dependen
4040

4141
logger := d.Logger()
4242

43-
// Encrypt before push?
44-
if o.Encrypt {
45-
if err := encrypt.Run(ctx, projectState, encrypt.Options{DryRun: o.DryRun, LogEmpty: true}, d); err != nil {
46-
return err
47-
}
43+
// Encrypt before push - ALWAYS (--encrypt flag kept for backwards compatibility)
44+
if err := encrypt.Run(ctx, projectState, encrypt.Options{DryRun: o.DryRun, LogEmpty: false}, d); err != nil {
45+
return err
4846
}
4947

5048
// Change description - optional arg
@@ -58,7 +56,7 @@ func Run(ctx context.Context, projectState *project.State, o Options, d dependen
5856
// Validate
5957
if !o.SkipValidation {
6058
validateOptions := validate.Options{
61-
ValidateSecrets: !o.Encrypt || !o.DryRun,
59+
ValidateSecrets: false, // Already encrypted above
6260
ValidateJSONSchema: true,
6361
}
6462
if err := validate.Run(ctx, projectState, validateOptions, d); err != nil {

0 commit comments

Comments
 (0)