You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(lambda-go): add security warnings for goBuildFlags and commandHooks
- Add CDK annotations warning about potential security risks
- Warn when goBuildFlags or commandHooks are used during bundling
- Update documentation with security best practices
- Add tests to verify warning generation
Copy file name to clipboardExpand all lines: packages/@aws-cdk/aws-lambda-go-alpha/README.md
+102-4Lines changed: 102 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -170,6 +170,8 @@ new go.GoFunction(this, 'handler', {
170
170
});
171
171
```
172
172
173
+
**⚠️ Security Warning**: Build flags are passed directly to the Go build command and can execute arbitrary commands during bundling. Only use trusted values and avoid flags like `-toolexec` with untrusted arguments. Be especially cautious with third-party CDK constructs that may contain malicious build flags. The CDK will display a warning during synthesis when `goBuildFlags` is used.
174
+
173
175
By default this construct doesn't use any Go module proxies. This is contrary to
174
176
a standard Go installation, which would use the Google proxy by default. To
175
177
recreate that behavior, do the following:
@@ -200,19 +202,21 @@ new go.GoFunction(this, 'GoFunction', {
200
202
201
203
## Command hooks
202
204
203
-
It is possible to run additional commands by specifying the `commandHooks` prop:
205
+
It is possible to run additional commands by specifying the `commandHooks` prop:
204
206
205
-
```text
206
-
// This example only available in TypeScript
207
+
```ts
207
208
// Run additional commands on a GoFunction via `commandHooks` property
'goBuildFlags can execute arbitrary commands during bundling. Ensure all flags come from trusted sources. See: https://docs.aws.amazon.com/cdk/latest/guide/security.html',
'commandHooks can execute arbitrary commands during bundling. Ensure all commands come from trusted sources. See: https://docs.aws.amazon.com/cdk/latest/guide/security.html',
0 commit comments