View a markdown version of this page

Managing supply chain policies - AWS Continuum

Managing supply chain policies

Note

AWS Continuum for software supply chain is in preview release and is subject to change.

A policy tells AWS Continuum for software supply chain which packages to deny. You can create one customer managed policy for each account in each AWS Region. The policy is deny-only and holds one or more rules, and Continuum for software supply chain denies a package when a rule in enforce mode matches it. For the terms that this topic uses, such as rules, conditions, signals, and enforcement modes, see AWS Continuum for software supply chain concepts.

You manage policies with the aws continuum commands of the AWS Command Line Interface (AWS CLI). Run the commands with credentials for the account and an AWS Region where Continuum for software supply chain is available. For the Regions, see Regions and endpoints. In the examples, replace region with one of those Regions, such as us-east-1.

Creating a policy

To create your policy, save it in a JSON file and run the create-supply-chain-policy command. The command calls the CreateSupplyChainPolicy operation. The file holds the policy, which has the following fields:

  • name – A name for the policy.

  • description – An optional description.

  • rules – One or more rules. Each rule has a ruleId, an enforcementMode of AUDIT or ENFORCE, and a denyWhen member with an allOf list of conditions. Each condition has a signal, an operator, and, for most signals, a value. A rule matches a package when every condition in allOf is true.

For the signals, operators, and values that you can use in a rule, see Signals, operators, and values.

Save your policy as policy.json. The following file is shortened. For complete policies, see Policy examples.

{ "name": "block-event-stream", "description": "Block the compromised event-stream release", "rules": [ ... ] }

Create the policy. The output includes the policy's ID, which you use in the other policy commands:

PROMPT> aws continuum create-supply-chain-policy \ --region region \ --policy file://policy.json { "id": "policy-id", "arn": "policy-arn", "policy": { "name": "block-event-stream", ... }, "createdAt": "timestamp", "updatedAt": "timestamp" }
Note

If you receive errors when you run AWS CLI commands, see Troubleshooting errors for the AWS CLI in the AWS CLI User Guide. Also, make sure that you're using the most recent AWS CLI version.

The AWS CLI fills in an idempotency token for you. If the AWS CLI retries the command, for example after a network error, the retry returns the policy that the first attempt created.

To tag the policy as you create it, add the --tags option:

PROMPT> aws continuum create-supply-chain-policy \ --region region \ --policy file://policy.json \ --tags key1=value1,key2=value2

Continuum for software supply chain authorizes those tags on the create action through the aws:RequestTag/${TagKey} and aws:TagKeys condition keys. You don't need a separate continuum:TagResource permission to tag a policy when you create it. For the permissions that control access to Continuum for software supply chain, see Identity and access management for AWS Continuum. For tagging, see Tagging software supply chain resources.

Note

The KEV signal takes only the PRESENT operator and no value. Continuum for software supply chain denies a package for a KEV match only when you add a rule that uses the KEV signal. Continuum for software supply chain doesn't block KEV packages by default. The default protection is the malicious-package baseline. For more information, see The malicious-package baseline.

Policy examples

Each of the following example policies shows the contents of a policy.json file for the create-supply-chain-policy command. In this example, the policy has one enforce-mode rule that denies a specific package based on the package's identity. The rule uses the PACKAGE_IDENTITY signal with the MATCHES operator:

{ "name": "block-event-stream", "description": "Block the compromised event-stream release", "rules": [ { "ruleId": "deny-event-stream", "enforcementMode": "ENFORCE", "denyWhen": { "allOf": [ { "signal": "PACKAGE_IDENTITY", "operator": "MATCHES", "value": { "packageIdentity": { "ecosystem": "npm", "name": "event-stream", "version": "3.3.6" } } } ] } } ] }

The following policy has one enforce-mode rule that denies a package when its severity is at least HIGH. The rule uses the INSPECTOR_SEVERITY signal with the AT_LEAST operator:

{ "name": "block-high-severity", "description": "Block packages rated HIGH or higher", "rules": [ { "ruleId": "deny-high-severity", "enforcementMode": "ENFORCE", "denyWhen": { "allOf": [ { "signal": "INSPECTOR_SEVERITY", "operator": "AT_LEAST", "value": { "severity": "HIGH" } } ] } } ] }

A rule that matches on the CISA Known Exploited Vulnerabilities (KEV) catalog uses the KEV signal with the PRESENT operator and no value. The following condition shows this match:

{ "signal": "KEV", "operator": "PRESENT" }

You can also match a set of severity values with the IN operator. The value is a set of severity names, such as the following condition:

{ "signal": "INSPECTOR_SEVERITY", "operator": "IN", "value": { "stringSet": ["HIGH", "UNTRIAGED"] } }

Viewing and listing policies

To read your customer managed policy, run the get-supply-chain-policy command with the policy ID. The command calls the GetSupplyChainPolicy operation.

The output holds the policy that you created. It also includes the policy ID, the Amazon Resource Name (ARN), the created and updated times, and the policy's tags if it has any:

PROMPT> aws continuum get-supply-chain-policy --region region --id policy-id { "id": "policy-id", "arn": "policy-arn", "policy": { "name": "block-event-stream", ... }, "createdAt": "timestamp", "updatedAt": "timestamp" }

An unknown ID returns a ResourceNotFoundException.

To list the policies in your account, run the list-supply-chain-policies command. The command calls the ListSupplyChainPolicies operation.

Without a filter, the list returns both types. Each entry is either a policy object for your customer managed policy or a managedPolicy object for a service-managed policy. Each summary in the list omits the policy's rules.

PROMPT> aws continuum list-supply-chain-policies --region region { "policies": [ { "policy": { "id": "policy-id", "policyType": "CUSTOMER_MANAGED", "arn": "policy-arn", "name": "block-event-stream", "createdAt": "timestamp", "updatedAt": "timestamp" } }, { "managedPolicy": { "id": "malicious", "policyType": "SERVICE_MANAGED", "arn": "managed-policy-arn", "managedBy": "managed-by", "name": "managed-policy-name" } } ] }

Use the --policy-type option to filter the list. It takes CUSTOMER_MANAGED for your own policy or SERVICE_MANAGED for the baseline. For example, the following command lists only your own policy:

PROMPT> aws continuum list-supply-chain-policies \ --region region \ --policy-type CUSTOMER_MANAGED

Service-managed policies

The malicious-package baseline is a service-managed policy. To read it, first list the service-managed policies to get its ID:

PROMPT> aws continuum list-supply-chain-policies \ --region region \ --policy-type SERVICE_MANAGED

Then run the get-supply-chain-managed-policy command with the ID. The command calls the GetSupplyChainManagedPolicy operation.

PROMPT> aws continuum get-supply-chain-managed-policy \ --region region \ --id malicious { "id": "malicious", "arn": "managed-policy-arn", "managedBy": "managed-by", "policy": { ... } }

The baseline has the managed policy ID malicious and a single rule with the rule ID malicious-package. GetSupplyChainManagedPolicy is read-only. You can read the baseline, but you can't change it or delete it. For more information about the baseline, see The malicious-package baseline.

Updating a policy

To change your policy, save the changed policy as policy.json and run the update-supply-chain-policy command with the policy ID. The command calls the UpdateSupplyChainPolicy operation.

PROMPT> aws continuum update-supply-chain-policy \ --region region \ --id policy-id \ --policy file://policy.json { "id": "policy-id", "arn": "policy-arn", "policy": { "name": "block-event-stream", ... }, "createdAt": "timestamp", "updatedAt": "timestamp" }

The update changes the existing policy in place. It doesn't replace the policy. The name in the file must match the existing name, and rules must include every existing rule ID. The policy ID and ARN don't change.

What you can change

An update can change some parts of a policy but not others:

You can
  • Change the description.

  • Add rules.

  • Change a rule that has no active policy exception, including its enforcement mode.

You can't
  • Change the policy name.

  • Remove an existing rule.

  • Change a rule that has an active policy exception. To change the rule, wait for the exception to expire, or delete the exception first.

Switching a rule from audit to enforce

To move a rule from audit mode to enforce mode, run the update-supply-chain-policy command with a policy file in which the rule's enforcementMode is changed from AUDIT to ENFORCE. Keep the rule's ruleId and its conditions the same, and include every other existing rule ID in the file. After the change, Continuum for software supply chain denies a package that the rule matches. For a walkthrough of this change, see Step 4: Switch the rule to enforce mode. For more information about enforcement modes, see Enforcement modes.

Deleting a policy

To delete your policy, run the delete-supply-chain-policy command with the policy ID. The command calls the DeleteSupplyChainPolicy operation and doesn't produce any output.

PROMPT> aws continuum delete-supply-chain-policy --region region --id policy-id

Deleting a policy ID that doesn't exist succeeds. If the policy changes while the delete is in progress, the command returns a ConflictException.

Effect on exceptions

Warning

Deleting a policy also deletes every policy exception that references it. Continuum for software supply chain removes those exceptions with the policy, and you can't recover them.

Quotas

Policies have the following quotas during the preview:

  • 1 customer managed policy for each account in each AWS Region. Creating a second policy returns a ValidationException.

  • 5 rules for each policy.

  • 20 conditions for each rule.

You can't increase these quotas during the preview. For more information about quotas, see AWS Continuum quotas.