Help Center/ Host Security Service/ API Reference/ API Description/ Container Images/ Listing Images Impacted by Build Commands
Updated on 2026-04-03 GMT+08:00

Listing Images Impacted by Build Commands

Function

This API is used to query the list of images affected by the image build command.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.

URI

GET /v5/{project_id}/image/build-command-risks/images

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID, which is used to specify the project that an asset belongs to. After the project ID is configured, you can query assets in the project using the project ID. For details about how to obtain it, see Obtaining a Project ID.

Constraints

N/A

Range

The value can contain 1 to 256 characters.

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

Definition

Enterprise project ID, which is used to filter assets in different enterprise projects. For details, see Obtaining an Enterprise Project ID.

To query assets in all enterprise projects, set this parameter to all_granted_eps.

Constraints

You need to set this parameter only after the enterprise project function is enabled.

Range

The value can contain 1 to 256 characters.

Default Value

0: default enterprise project.

offset

No

Integer

Definition

Offset, which specifies the start position of the record to be returned.

Constraints

N/A

Range

The value range is 0 to 2,000,000.

Default Value

The default value is 0.

limit

No

Integer

Definition

Number of records displayed on each page.

Constraints

N/A

Range

Value range: 10-200

Default Value

10

image_type

Yes

String

Definition

Image type.

Constraints

N/A

Range

  • **cicd **: CI/CD image

  • registry: repository image

The value can contain 1 to 32 characters.

Default Value

N/A

rule_id

Yes

String

Definition

Risk detection rule ID.

Constraints

N/A

Range

The value contains 1 to 64 characters.

Default Value

N/A

image_id

No

String

Definition

Image ID.

Constraints

N/A

Range

The value can contain 0 to 128 characters.

Default Value

N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token, which contains user identity and permissions. The token can be used for identity authentication when an API is called. For details about how to obtain the token, see Obtaining a User Token.

Constraints

N/A

Range

The value can contain 1 to 32,768 characters.

Default Value

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total_num

Integer

Definition

Total amount of image data affected by image build instructions

Range

0 to 2,147,483,547

data_list

Array of BuildCommandRisksImageResponseInfo objects

Definition

List of images affected by the image build command.

Range

The value range is 0 to 200.

Table 5 BuildCommandRisksImageResponseInfo

Parameter

Type

Description

namespace

String

Definition

Organization name

Range

The value contains 0 to 64 characters.

image_digest

String

Definition

Image digest.

Range

The value contains 0 to 128 characters.

image_id

String

Definition

Image ID.

Range

The value can contain 0 to 128 characters.

image_name

String

Definition

Image name

Range

The value contains 0 to 128 characters.

image_version

String

Definition

Image version

Range

The value contains 0 to 128 characters.

image_type

String

Definition

Image type

** Value range**:

  • private_image

  • shared_image

  • instance_image: enterprise image

  • harbor

  • jfrog

  • cicd:

image_size

Long

Definition

Version Size

Range

0 to 9223372036854775807

latest_scan_time

Long

Definition

Last detection time, in ms.

Range

0 to 9223372036854775807

risk_detail_info

BuildCommandRiskDetailListResponseInfo object

Table 6 BuildCommandRiskDetailListResponseInfo

Parameter

Type

Description

risk_num

Integer

Definition

Total number of image build instruction risks

Range

0 to 2,147,483,547

risk_list

Array of BuildCommandRiskDetailResponseInfo objects

Definition

Risk details list of image build commands

Range

The value range is 0 to 2,147,483,647.

Table 7 BuildCommandRiskDetailResponseInfo

Parameter

Type

Description

remediation

String

Definition

Risk Handling Suggestion

Range

The value can contain 0 to 65,534 characters.

build_instruction

String

Definition

Risky build instructions

Range

The value can contain 0 to 256 characters.

Example Requests

None

Example Responses

Status code: 200

Request succeeded.

{
  "total_num" : 1,
  "data_list" : [ {
    "namespace" : "library",
    "image_digest" : "sha256:xxx",
    "image_id" : "xxx",
    "image_name" : "my_image_name",
    "image_version" : "3.2.0",
    "image_type" : "private_image",
    "image_size" : 152610175,
    "latest_scan_time" : 1691748641788,
    "risk_detail_info" : {
      "risk_num" : 1,
      "risk_list" : [ {
        "build_instruction" : "--",
        "remediation" : "Add the following line to the Dockerfile: USER <non root username>"
      } ]
    }
  } ]
}

Status Codes

Status Code

Description

200

Request succeeded.

Error Codes

See Error Codes.