Profile Applicability:

  • Level 1

Description:

AWS AppSync is a fully managed service that makes it easy to develop GraphQL APIs by handling the heavy lifting of securely connecting to data sources. GraphQL is a query language for your API, and AppSync enables real-time data synchronization and offline programming capabilities.

API keys are one of the methods of authentication for AWS AppSync APIs, but they are not recommended for production environments as they are simple, static, and provide a low level of security. API keys are typically intended for development, testing, or public-facing APIs. For production environments, more secure authentication methods like AWS IAMCognito User Pools, or OpenID Connect should be used.

This SOP ensures that AWS AppSync GraphQL APIs are not using API keys for authentication, which helps to increase security and reduce the potential for unauthorized access.

Rationale:

Using API keys for authentication in production environments can lead to:

  • Low Security: API keys are static and can easily be compromised, providing a vulnerability for unauthorized access.

  • Lack of Fine-Grained Access Control: API keys do not provide features like user authentication, authorization, or role-based access control.

  • Increased Risk of Abuse: Since API keys do not have fine-grained security controls, they can be misused, leading to potential security breaches.

By ensuring AppSync GraphQL APIs do not use API keys, the authentication will be more robust, offering better control over who can access the APIs and protecting sensitive data and operations.

Impact:

Pros:

  • Improved Security: Using more secure authentication methods such as IAMCognito User Pools, or OpenID Connect ensures better protection and access control.

  • Granular Access Control: More secure authentication methods allow for role-based access control, enabling fine-grained permission management for users.

  • Compliance: Meeting security compliance standards by avoiding insecure authentication mechanisms like API keys.

  • Real-time Authentication: Methods like Cognito or IAM support real-time user authentication and authorization.

Cons:

  • Increased Complexity: Setting up more advanced authentication methods, such as Cognito User Pools or IAM, may introduce additional complexity compared to API keys.

  • Implementation Time: Switching from API key authentication to more secure methods may require additional time for configuration and testing.

Default Value:

By default, AWS AppSync allows the use of API keys for authentication. To improve security, it is recommended to disable API keys and enable more secure authentication methods, such as AWS IAMCognito User Pools, or OpenID Connect.

Pre-requisite:

  • AWS IAM Permissions:

    • appsync:UpdateGraphqlApi

    • appsync:DescribeGraphqlApi

    • cognito-idp:ListUsers

    • cognito-idp:AdminCreateUser

    • appsync:ListGraphqlApis

  • AWS CLI installed and configured.

  • Amazon Cognito User Pools set up if using Cognito for authentication.

  • AWS IAM Roles set up for access control if using IAM-based authentication.

Remediation:

Test Plan:

Using AWS Console:

  1. Sign in to the AWS Management Console.

  2. Navigate to AWS AppSync under Services.

  3. In the AppSync Dashboard, select the GraphQL API you want to verify.

  4. Go to the Authentication settings under the API settings.

  5. Check if API Key is listed as one of the authentication methods.

  6. If API Key is enabled, remove it and configure one of the more secure methods (e.g., IAMCognito User Pools, or OpenID Connect).

  7. Save the configuration and ensure that the changes are applied successfully.

  8. Test the API to verify that the authentication method is working properly without API keys.

Using AWS CLI:

To check the authentication settings for an AppSync API, run:

aws appsync get-graphql-api --api-id <api-id> --query 'graphqlApi.authenticationType'

If the result indicates that API_KEY is being used, you will need to update the API to disable API key authentication:

aws appsync update-graphql-api --api-id <api-id> --authentication-type <IAM or Cognito or OpenID>

To list all AppSync APIs and verify the authentication type for each:

aws appsync list-graphql-apis --query 'graphqlApis[*].{APIId:id,AuthType:authenticationType}'


Implementation Steps:

Using AWS Console:

  1. Log in to the AWS Management Console and navigate to AppSync.

  2. Select the GraphQL API you want to modify.

  3. In the API Settings, go to the Authentication section.

  4. Ensure that API Key is not selected.

  5. Configure a more secure authentication method such as:

    • IAM: For users and services using IAM roles for accessing the GraphQL API.

    • Cognito User Pools: For user authentication via Cognito.

    • OpenID Connect: For integrating with third-party identity providers.

  6. Save the changes and apply them to the GraphQL API.

Using AWS CLI:

To disable API Key and enable IAM or Cognito authentication, run:

aws appsync update-graphql-api --api-id <api-id> --authentication-type <IAM or Cognito or OpenID>

Confirm the authentication method by checking the authentication type for the GraphQL API:

aws appsync get-graphql-api --api-id <api-id> --query 'graphqlApi.authenticationType'

To create a new GraphQL API with IAM or Cognito authentication, use:

aws appsync create-graphql-api --name <api-name> --authentication-type <IAM or Cognito or OpenID>


Backout Plan:

Console Process

  1. Go to AppSync in the AWS Console and select your API.

  2. Change the authentication type in Settings to Amazon CognitoIAM, or OIDC.

  3. Delete the API key after transitioning.

CLI Process

Update authentication type:

aws appsync update-graphql-api --api-id <api-id> --authentication-type AMAZON_COGNITO_USER_POOLS

  1. Delete the API key:

    aws appsync delete-api-key --api-id <api-id> --id <key-id>

Note :

  • Test in Development: Before applying these changes to production, test the configuration in a development or staging environment to avoid disruptions.

  • Monitoring: Set up CloudWatch Logs and AWS CloudTrail to monitor access and detect unauthorized attempts to access the GraphQL API.

References:

CIS Controls Mapping:

Version

Control ID

Control Description

IG1

IG2

IG3

v8

3.4

Encrypt Data on End-User Devices – Ensure data encryption during file system access.

v8

6.7

Implement Application Layer Filtering and Content Control – Ensure appropriate content filtering is applied to sensitive files.

v8

6.8

Define and Maintain Role-Based Access Control – Implement and manage role-based access for file systems.

v8

14.6

Protect Information Through Access Control Lists – Apply strict access control to file systems.