Skip to content

Commit 36bdd33

Browse files
committed
add docker fine grained permission to the plugin
1 parent 8daf9e5 commit 36bdd33

File tree

9 files changed

+15
-9
lines changed

9 files changed

+15
-9
lines changed

Examples/APIGateway/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ To build the package, type the following commands.
2222

2323
```bash
2424
swift build
25-
swift package archive --disable-sandbox
25+
swift package archive --allow-network-access docker
2626
```
2727

2828
If there is no error, there is a ZIP file ready to deploy.

Examples/HelloWorld/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ To build & archive the package, type the following commands.
1818

1919
```bash
2020
swift build
21-
swift package archive --disable-sandbox
21+
swift package archive --allow-network-access docker
2222
```
2323

2424
If there is no error, there is a ZIP file ready to deploy.

Package.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ let package = Package(
5555
verb: "archive",
5656
description:
5757
"Archive the Lambda binary and prepare it for uploading to AWS. Requires docker on macOS or non Amazonlinux 2 distributions."
58-
)
58+
),
59+
permissions: [
60+
.allowNetworkConnections(
61+
scope: .docker,
62+
reason: "This plugin uses Docker to create the AWS Lambda ZIP package."
63+
)
64+
]
5965
)
6066
),
6167
.testTarget(

Plugins/AWSLambdaPackager/Plugin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ struct AWSLambdaPackager: CommandPlugin {
287287
288288
REQUIREMENTS: To use this plugin, you must have docker installed and started.
289289
290-
USAGE: swift package --disable-sandbox archive [--help] [--verbose]
290+
USAGE: swift package --allow-network-access docker archive [--help] [--verbose]
291291
[--output-directory <path>]
292292
[--products <list of products>]
293293
[--configuration debug | release]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
swift package --disable-sandbox plugin archive
1+
swift package --allow-network-access docker plugin archive
22

Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/04-01-03-plugin-archive.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
swift package --disable-sandbox plugin archive
1+
swift package --allow-network-access docker archive
22

33
-------------------------------------------------------------------------
44
building "squarenumberlambda" in docker

Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/04-01-04-plugin-archive.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
swift package --disable-sandbox plugin archive
1+
swift package --allow-network-access docker archive
22

33
-------------------------------------------------------------------------
44
building "squarenumberlambda" in docker

Sources/AWSLambdaRuntimeCore/Documentation.docc/quick-setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ AWS Lambda runtime runs on Amazon Linux. You must compile your code for Amazon L
106106
> Be sure to have [Docker](https://docs.docker.com/desktop/install/mac-install/) installed for this step.
107107
108108
```sh
109-
swift package --disable-sandbox plugin archive
109+
swift package --allow-network-access docker archive
110110

111111
-------------------------------------------------------------------------
112112
building "squarenumberlambda" in docker

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ try await runtime.run()
8383

8484
```bash
8585
swift build
86-
swift package archive --disable-sandbox
86+
swift package archive --allow-network-access docker
8787
```
8888

8989
If there is no error, there is a ZIP file ready to deploy.

0 commit comments

Comments
 (0)