View a markdown version of this page

Managing policy exceptions - AWS Continuum

Managing policy exceptions

Note

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

A policy exception suppresses specific rules of one policy for packages that match one package identity. An exception in AWS Continuum for software supply chain never allows a package by itself. It only suppresses rules, and other rules still apply to that package. An exception needs a justification and an expiry. For the concepts that this topic uses, see Policy exceptions. For the policy that an exception references, see Managing supply chain policies.

You manage exceptions with the AWS Command Line Interface (AWS CLI). Each aws continuum command in this topic calls one configuration operation of the Continuum for software supply chain API. For the Regions where Continuum for software supply chain is available, see Regions and endpoints. In the examples, replace region with one of those Regions, such as us-east-1.

Before you begin

An exception references one policy. This can be your customer managed policy or the service-managed malicious-package baseline. An exception has the following members, and all six are required:

  • name – A name for the exception.

  • policyArn – The Amazon Resource Name (ARN) of the policy that the exception references, in the same account and AWS Region.

  • ruleIds – The rule IDs that the exception suppresses. Every rule ID must exist in the referenced policy. Otherwise, the command to create the exception returns a ValidationException.

  • package – The package identity that the exception applies to. It has an ecosystem, a name, and optionally a version or version range.

  • justification – The reason for the exception.

  • expiresAt – The expiry time. It must be in the future and can be up to 365 days after you first create the exception.

Continuum for software supply chain judges the expiry at the time it evaluates a package. After an exception expires, Continuum for software supply chain no longer suppresses the rules that the exception names.

Exceptions on the malicious-package baseline

An exception can target the malicious-package baseline. The baseline is a service-managed policy with the managed policy ID malicious and a single rule with the rule ID malicious-package. You read the baseline with the aws continuum get-supply-chain-managed-policy --region region --id malicious command, which calls the GetSupplyChainManagedPolicy operation. For the steps, see Service-managed policies.

Before you create an exception on the baseline, read the warning in Exception for the baseline.

Creating an exception

To create an exception, use the create-supply-chain-policy-exception command, which calls the CreateSupplyChainPolicyException operation. Save the six required fields of the exception in a JSON file, and pass the file with the --exception option. The examples that follow show the file and the command. If a create would raise the number of active exceptions on a rule above the per-rule quota, the command returns a ValidationException. For the quota, see Quotas.

As when you create a policy, if the AWS CLI retries the command, the retry returns the exception that the first attempt created. For more information, see Creating a policy.

You can pass the --tags option, as in --tags key1=value1,key2=value2, to tag the exception as 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.

Exception for a customer rule

The following exception suppresses the deny-high-severity rule of a customer managed policy for one version of a package. The policyArn references the customer managed policy.

Save the following as exception.json:

{ "name": "allow-left-pad-temporarily", "policyArn": "arn:aws:continuum:us-east-1:111122223333:supply-chain-policy/policy-id", "ruleIds": ["deny-high-severity"], "package": { "ecosystem": "npm", "name": "left-pad", "version": "1.3.0" }, "justification": "Temporary allowance while we remediate the finding.", "expiresAt": "2027-01-15T00:00:00Z" }

Create the exception. The output includes the exception's ID and its status:

PROMPT> aws continuum create-supply-chain-policy-exception \ --region region \ --exception file://exception.json { "id": "exception-id", "arn": "exception-arn", "exception": { "name": "allow-left-pad-temporarily", ... }, "status": "ACTIVE", "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.

Exception for the baseline

The following exception targets the malicious-package baseline. The policyArn references the managed policy ID malicious, and ruleIds lists the one rule, malicious-package.

Save the following as baseline-exception.json:

{ "name": "allow-flagged-internal-build", "policyArn": "arn:aws:continuum:us-east-1:111122223333:supply-chain-managed-policy/malicious", "ruleIds": ["malicious-package"], "package": { "ecosystem": "npm", "name": "example-internal-package", "version": "2.0.1" }, "justification": "Confirmed safe after review of the flagged internal build.", "expiresAt": "2027-01-15T00:00:00Z" }

Create the exception:

PROMPT> aws continuum create-supply-chain-policy-exception \ --region region \ --exception file://baseline-exception.json { "id": "exception-id", "arn": "exception-arn", "exception": { "name": "allow-flagged-internal-build", ... }, "status": "ACTIVE", "createdAt": "timestamp", "updatedAt": "timestamp" }
Warning

An active exception on the malicious-package baseline lets the package that it names install even though the package is known to be malicious. The exception applies only to that package and to the malicious-package rule, and it expires after the time you set, up to 365 days. You can't turn off or audit the baseline, so an exception on the baseline is the only way to let a specific package install when the baseline matches it.

Viewing and listing exceptions

To read one exception, pass its ID to the get-supply-chain-policy-exception command, which calls the GetSupplyChainPolicyException operation. The output holds the same fields as the output of the create command, together with the computed status:

PROMPT> aws continuum get-supply-chain-policy-exception \ --region region \ --id exception-id { "id": "exception-id", "arn": "exception-arn", "exception": { "name": "allow-left-pad-temporarily", ... }, "status": "ACTIVE", "createdAt": "timestamp", "updatedAt": "timestamp" }

An unknown ID returns a ResourceNotFoundException.

To list the exceptions in your account, use the list-supply-chain-policy-exceptions command, which calls the ListSupplyChainPolicyExceptions operation. The list takes no filters. The AWS CLI pages through the results automatically. To control paging, use the --max-items and --starting-token options. Each entry has the id, arn, name, policyArn, ruleIds, status, expiresAt, createdAt, and updatedAt fields:

PROMPT> aws continuum list-supply-chain-policy-exceptions --region region { "exceptions": [ { "id": "exception-id", "arn": "exception-arn", "name": "allow-left-pad-temporarily", "policyArn": "arn:aws:continuum:us-east-1:111122223333:supply-chain-policy/policy-id", "ruleIds": ["deny-high-severity"], "status": "ACTIVE", "expiresAt": "2027-01-15T00:00:00Z", "createdAt": "timestamp", "updatedAt": "timestamp" } ] }

Status and expiry

Continuum for software supply chain computes the status of an exception, ACTIVE or EXPIRED, from its expiresAt time, judged when it evaluates a package. For what the status means, see Scope, expiry, and status.

Continuum for software supply chain keeps an exception until you delete it, or for 45 days after it expires. After 45 days, Continuum for software supply chain removes the expired exception.

Updating an exception

To change an active exception, use the update-supply-chain-policy-exception command, which calls the UpdateSupplyChainPolicyException operation. The name and policyArn in the file must match the existing exception. The exception ID, ARN, and tags don't change.

Note

You can't update an expired exception. The command returns a ConflictException with the following message: Expired policy exception '<id>' cannot be updated. Create a new exception instead. To change an expired exception, create a new one.

For example, to change the justification of the exception from Exception for a customer rule, save the following as exception.json:

{ "name": "allow-left-pad-temporarily", "policyArn": "arn:aws:continuum:us-east-1:111122223333:supply-chain-policy/policy-id", "ruleIds": ["deny-high-severity"], "package": { "ecosystem": "npm", "name": "left-pad", "version": "1.3.0" }, "justification": "Temporary allowance while we roll out the patched version.", "expiresAt": "2027-01-15T00:00:00Z" }

Update the exception:

PROMPT> aws continuum update-supply-chain-policy-exception \ --region region \ --id exception-id \ --exception file://exception.json { "id": "exception-id", "arn": "exception-arn", "exception": { "name": "allow-left-pad-temporarily", ... }, "status": "ACTIVE", "createdAt": "timestamp", "updatedAt": "timestamp" }

What you can change

An update can change some parts of an active exception but not others:

You can
  • Change the rules that the exception suppresses.

  • Change the package.

  • Change the justification and the expiry.

You can't
  • Change the name or the referenced policy. To change either one, create a new exception.

Deleting an exception

To delete an exception, pass its ID to the delete-supply-chain-policy-exception command, which calls the DeleteSupplyChainPolicyException operation. The command returns no output.

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

After you delete an exception, later package decisions no longer consider it. Deleting an exception also frees its slot for each rule it covers under the per-rule quota. Expired exceptions don't count toward that quota.

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

Quotas

Exceptions have the following quota during the preview:

  • 10 active exceptions for each policy rule. The 11th create-supply-chain-policy-exception command for the same rule returns a ValidationException.

Expired exceptions don't count toward this quota, and deleting an active exception frees a slot. You can't increase this quota during the preview. For more information about quotas, see AWS Continuum quotas.