| 255 | } |
| 256 | |
| 257 | func confirmRemoteIncludes(dockerCli command.Cli, options buildOptions, assumeYes bool) error { |
| 258 | if assumeYes { |
| 259 | return nil |
| 260 | } |
| 261 | |
| 262 | var remoteIncludes []string |
| 263 | remoteLoaders := options.ProjectOptions.remoteLoaders(dockerCli) //nolint:staticcheck |
| 264 | for _, cf := range options.ProjectOptions.ConfigPaths { //nolint:staticcheck |
| 265 | for _, loader := range remoteLoaders { |
| 266 | if loader.Accept(cf) { |
| 267 | remoteIncludes = append(remoteIncludes, cf) |
| 268 | break |
| 269 | } |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | if len(remoteIncludes) == 0 { |
| 274 | return nil |
| 275 | } |
| 276 | |
| 277 | _, _ = fmt.Fprintln(dockerCli.Out(), "\nWarning: This Compose project includes files from remote sources:") |
| 278 | for _, include := range remoteIncludes { |
| 279 | _, _ = fmt.Fprintf(dockerCli.Out(), " - %s\n", include) |
| 280 | } |
| 281 | _, _ = fmt.Fprintln(dockerCli.Out(), "\nRemote includes could potentially be malicious. Make sure you trust the source.") |
| 282 | |
| 283 | msg := "Do you want to continue? [y/N]: " |
| 284 | confirmed, err := prompt.NewPrompt(dockerCli.In(), dockerCli.Out()).Confirm(msg, false) |
| 285 | if err != nil { |
| 286 | return err |
| 287 | } |
| 288 | if !confirmed { |
| 289 | return fmt.Errorf("operation cancelled by user") |
| 290 | } |
| 291 | |
| 292 | return nil |
| 293 | } |