Skip to content

Commit 1b4554f

Browse files
committed
Fix publish sensitive data detection
Signed-off-by: CodeLoopdroid <214800619+CodeLoopdroid@users.noreply.github.com>
1 parent 7df4329 commit 1b4554f

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

pkg/compose/publish.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ func composeFileAsByteReader(ctx context.Context, filePath string, project *type
477477
if err != nil {
478478
return nil, fmt.Errorf("failed to open compose file %s: %w", filePath, err)
479479
}
480-
model, err := loader.LoadModelWithContext(ctx, types.ConfigDetails{
480+
configDetails := types.ConfigDetails{
481481
WorkingDir: project.WorkingDir,
482482
Environment: project.Environment,
483483
ConfigFiles: []types.ConfigFile{
@@ -486,18 +486,29 @@ func composeFileAsByteReader(ctx context.Context, filePath string, project *type
486486
Content: composeFile,
487487
},
488488
},
489-
}, func(options *loader.Options) {
489+
}
490+
loadOptions := func(options *loader.Options) {
490491
options.SkipValidation = true
491492
options.SkipExtends = true
492493
options.SkipConsistencyCheck = true
493494
options.ResolvePaths = true
494495
options.SkipInterpolation = true
495496
options.SkipResolveEnvironment = true
496-
})
497+
}
498+
499+
base, err := loader.LoadWithContext(ctx, configDetails, loadOptions)
500+
if err == nil {
501+
in, err := base.MarshalYAML()
502+
if err != nil {
503+
return nil, err
504+
}
505+
return bytes.NewBuffer(in), nil
506+
}
507+
508+
model, err := loader.LoadModelWithContext(ctx, configDetails, loadOptions)
497509
if err != nil {
498510
return nil, err
499511
}
500-
501512
in, err := yaml.Marshal(model)
502513
if err != nil {
503514
return nil, err

0 commit comments

Comments
 (0)