Implement comprehensive checks to prevent accidental exposure of sensitive data through multiple vectors in configuration files and deployment artifacts. This includes validating environment variables, file permissions, bind mounts, and individual configuration files before publishing or deployment.
Implement comprehensive checks to prevent accidental exposure of sensitive data through multiple vectors in configuration files and deployment artifacts. This includes validating environment variables, file permissions, bind mounts, and individual configuration files before publishing or deployment.
Key practices:
Example implementation:
func preChecks(project *types.Project, options api.PublishOptions) error {
if !options.WithEnvironment {
for _, service := range project.Services {
if len(service.Environment) > 0 {
return fmt.Errorf("service %q has environment variable(s) declared. To avoid leaking sensitive data, " +
"you must either explicitly allow the sending of environment variables by using the --with-env flag")
}
}
}
// Check individual files, not just final model
// Validate bind mounts with user warnings
// Apply restrictive permissions for secrets
}
This approach ensures multiple layers of protection against sensitive data exposure while maintaining usability through explicit opt-in mechanisms.
Enter the URL of a public GitHub repository