Skip to content

Commit 5a95ca5

Browse files
committed
add security notice in readme and oenapi.yaml
1 parent fe3b1cb commit 5a95ca5

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

Examples/quoteapi/README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
This application illustrates how to deploy a Server-Side Swift workload on AWS using the [AWS Serverless Application Model (SAM)](https://aws.amazon.com/serverless/sam/) toolkit. The workload is a simple REST API that returns a string from an Amazon API Gateway. Requests to the API Gateway endpoint are handled by an AWS Lambda Function written in Swift.
44

5-
65
## Prerequisites
76

87
To build this sample application, you need:
@@ -81,3 +80,20 @@ When finished with your application, use SAM to delete it from your AWS account.
8180
```bash
8281
sam delete
8382
```
83+
84+
## ⚠️ Security and Reliability Notice
85+
86+
This is an example application for demonstration purposes. When deploying such infrastructure in production environments, we strongly encourage you to follow these best practices for improved security and resiliency:
87+
88+
- Enable access logging on API Gateway ([documentation](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html))
89+
- Ensure that AWS Lambda function is configured for function-level concurrent execution limit ([concurrency documentation](https://docs.aws.amazon.com/lambda/latest/dg/lambda-concurrency.html), [configuration guide](https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html))
90+
- Check encryption settings for Lambda environment variables ([documentation](https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars-encryption.html))
91+
- Ensure that AWS Lambda function is configured for a Dead Letter Queue (DLQ) ([documentation](https://docs.aws.amazon.com/lambda/latest/dg/invocation-async-retain-records.html#invocation-dlq))
92+
- Ensure that AWS Lambda function is configured inside a VPC when it needs to access private resources ([documentation](https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html), [code example](https://github.com/swift-server/swift-aws-lambda-runtime/tree/main/Examples/ServiceLifecycle%2BPostgres))
93+
94+
**Note:** The `openapi.yaml` file in this example is not suited for production. In real-world scenarios, you must:
95+
1. Ensure that the global security field has rules defined
96+
2. Ensure that security operations is not empty ([OpenAPI Security Specification](https://learn.openapis.org/specification/security.html))
97+
3. Follow proper authentication, authorization, input validation, and error handling practices
98+
99+
As per Checkov CKV_OPENAPI_4 and CKV_OPENAPI_5 security checks.

Examples/quoteapi/template.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@ AWSTemplateFormatVersion: '2010-09-09'
22
Transform: AWS::Serverless-2016-10-31
33
Description: SAM Template for QuoteService
44

5+
# This is an example SAM template for the purpose of this project.
6+
# When deploying such infrastructure in production environment,
7+
# we strongly encourage you to follow these best practices for improved security and resiliency
8+
# - Enable access loggin on API Gateway
9+
# See: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html)
10+
# - Ensure that AWS Lambda function is configured for function-level concurrent execution limit
11+
# See: https://docs.aws.amazon.com/lambda/latest/dg/lambda-concurrency.html
12+
# https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html
13+
# - Check encryption settings for Lambda environment variable
14+
# See: https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars-encryption.html
15+
# - Ensure that AWS Lambda function is configured for a Dead Letter Queue(DLQ)
16+
# See: https://docs.aws.amazon.com/lambda/latest/dg/invocation-async-retain-records.html#invocation-dlq
17+
# - Ensure that AWS Lambda function is configured inside a VPC when it needs to access private resources
18+
# See: https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html
19+
# Code Example: https://github.com/swift-server/swift-aws-lambda-runtime/tree/main/Examples/ServiceLifecycle%2BPostgres
20+
521
Globals:
622
Function:
723
Timeout: 60

0 commit comments

Comments
 (0)