From: Kevin Parsons <kevpar@microsoft.com>
Date: Wed, 24 Mar 2021 01:46:30 -0700
Subject: Add ArgsEscaped field to image config

This change officially adds ArgsEscaped to the image config. This field
has already been used by Docker for several years, so adding it here
allows images that depend on its behavior to work with other runtimes.

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
Signed-off-by: Justin Terry <jlterry@amazon.com>
---
 config.md                 | 7 +++++++
 media-types.md            | 2 ++
 schema/config-schema.json | 3 +++
 specs-go/v1/config.go     | 9 +++++++++
 4 files changed, 21 insertions(+)

diff --git a/config.md b/config.md
index 5a47a6a..1f31fed 100644
--- a/config.md
+++ b/config.md
@@ -183,6 +183,13 @@ Note: Any OPTIONAL field MAY also be set to null, which is equivalent to being a
 
     The field contains the system call signal that will be sent to the container to exit. The signal can be a signal name in the format `SIGNAME`, for instance `SIGKILL` or `SIGRTMIN+3`.
 
+  - **ArgsEscaped** *boolean*, OPTIONAL
+
+    `[Deprecated]` - This field is present only for legacy compatibility with Docker and should not be used by new image builders.
+    It is used by Docker for Windows images to indicate that the `Entrypoint` or `Cmd` or both, contains only a single element array, that is a pre-escaped, and combined into a single string `CommandLine`.
+    If `true` the value in `Entrypoint` or `Cmd` should be used as-is to avoid double escaping.
+    Note, the exact behavior of `ArgsEscaped` is complex and subject to implementation details in Moby project.
+
   - **Memory** *integer*, OPTIONAL
 
     This property is *reserved* for use, to [maintain compatibility](media-types.md#compatibility-matrix).
diff --git a/media-types.md b/media-types.md
index e0d324a..1afe749 100644
--- a/media-types.md
+++ b/media-types.md
@@ -69,6 +69,8 @@ This section shows where the OCI Image Specification is compatible with formats
   - `.config.MemorySwap`: only present in Docker, and reserved in OCI
   - `.config.CpuShares`: only present in Docker, and reserved in OCI
   - `.config.Healthcheck`: only present in Docker, and reserved in OCI
+- [Moby/Docker](https://github.com/moby/moby)
+  - `.config.ArgsEscaped`: Windows-specific Moby/Docker extension, deprecated in OCI, available for compatibility with older images.
 
 `.config.StopSignal` and `.config.Labels` are accidentally undocumented in Docker Image Spec v1.2, but these fields are not OCI-specific concepts.
 
diff --git a/schema/config-schema.json b/schema/config-schema.json
index f85f8cd..5bd411f 100644
--- a/schema/config-schema.json
+++ b/schema/config-schema.json
@@ -95,6 +95,9 @@
         },
         "StopSignal": {
           "type": "string"
+        },
+        "ArgsEscaped": {
+          "type": "boolean"
         }
       }
     },
diff --git a/specs-go/v1/config.go b/specs-go/v1/config.go
index ffff4b6..e6aa113 100644
--- a/specs-go/v1/config.go
+++ b/specs-go/v1/config.go
@@ -48,6 +48,15 @@ type ImageConfig struct {
 
 	// StopSignal contains the system call signal that will be sent to the container to exit.
 	StopSignal string `json:"StopSignal,omitempty"`
+
+	// ArgsEscaped `[Deprecated]` - This field is present only for legacy
+	// compatibility with Docker and should not be used by new image builders.
+	// It is used by Docker for Windows images to indicate that the `Entrypoint`
+	// or `Cmd` or both, contains only a single element array, that is a
+	// pre-escaped, and combined into a single string `CommandLine`. If `true`
+	// the value in `Entrypoint` or `Cmd` should be used as-is to avoid double
+	// escaping.
+	ArgsEscaped bool `json:"ArgsEscaped,omitempty"`
 }
 
 // RootFS describes a layer content addresses
