Repository: buildpacks/pack (Go)

Issue:
Warn when volume mounting into `/workspace`
### Description

This isn’t a super common problem, but we do occasionally see people mount into workspace.

a.) It doesn’t make a ton of sense. /workspace is your app files, so if you want it there, just include it with your app files.
b.) Buildpacks can delete files in /workspace. For example, if you do a source build it’s common to delete all the source code so it’s not in the production image. Well, if you volume map into /workspace, your mapped files might get deleted too.

### Proposed solution
Warn so users know it's not a good idea


Discussion:
Is anyone currently contributing to this issue?, I would like to pick up the issue.
Looks like maybe @anthonydahanne is working on it?
yes, already submitted a PR #2238 



Patch:
diff --git a/pkg/client/process_volumes.go b/pkg/client/process_volumes.go
index b079c6bf6c..6e36b8e2c9 100644
--- a/pkg/client/process_volumes.go
+++ b/pkg/client/process_volumes.go
@@ -29,9 +29,9 @@ func processVolumes(imgOS string, volumes []string) (processed []string, warning
 			return nil, nil, errors.Wrapf(err, "platform volume %q has invalid format", v)
 		}
 
-		sensitiveDirs := []string{"/cnb", "/layers"}
+		sensitiveDirs := []string{"/cnb", "/layers", "/workspace"}
 		if imgOS == "windows" {
-			sensitiveDirs = []string{`c:/cnb`, `c:\cnb`, `c:/layers`, `c:\layers`}
+			sensitiveDirs = []string{`c:/cnb`, `c:\cnb`, `c:/layers`, `c:\layers`, `c:/workspace`, `c:\workspace`}
 		}
 		for _, p := range sensitiveDirs {
 			if strings.HasPrefix(strings.ToLower(volume.Spec.Target), p) {
diff --git a/pkg/client/process_volumes_darwin.go b/pkg/client/process_volumes_darwin.go
index 35ea69cc96..030bf3e71d 100644
--- a/pkg/client/process_volumes_darwin.go
+++ b/pkg/client/process_volumes_darwin.go
@@ -17,7 +17,7 @@ func processVolumes(imgOS string, volumes []string) (processed []string, warning
 		if err != nil {
 			return nil, nil, err
 		}
-		sensitiveDirs := []string{"/cnb", "/layers"}
+		sensitiveDirs := []string{"/cnb", "/layers", "/workspace"}
 		if imgOS == "windows" {
 			sensitiveDirs = []string{`c:/cnb`, `c:\cnb`, `c:/layers`, `c:\layers`}
 		}


Test patch:
diff --git a/pkg/client/build_test.go b/pkg/client/build_test.go
index b645421f8f..987786acd6 100644
--- a/pkg/client/build_test.go
+++ b/pkg/client/build_test.go
@@ -2925,6 +2925,8 @@ api = "0.2"
 						"/cnb/nested",
 						"/layers",
 						"/layers/nested",
+						"/workspace",
+						"/workspace/bindings",
 					} {
 						p := p
 						it(fmt.Sprintf("warns when mounting to '%s'", p), func() {
@@ -2997,7 +2999,7 @@ api = "0.2"
 
 					when("mounting onto cnb spec'd dir", func() {
 						for _, p := range []string{
-							`/cnb`, `/cnb/buildpacks`, `/layers`,
+							`/cnb`, `/cnb/buildpacks`, `/layers`, `/workspace`,
 						} {
 							p := p
 							it(fmt.Sprintf("warns when mounting to '%s'", p), func() {
@@ -3067,7 +3069,7 @@ api = "0.2"
 
 					when("mounting onto cnb spec'd dir", func() {
 						for _, p := range []string{
-							`c:\cnb`, `c:\cnb\buildpacks`, `c:\layers`,
+							`c:\cnb`, `c:\cnb\buildpacks`, `c:\layers`, `c:\workspace`,
 						} {
 							p := p
 							it(fmt.Sprintf("warns when mounting to '%s'", p), func() {