Skip to content

# Alibaba Cloud Detector Should Display Access Key ID Instead of Secret in Raw Field #4496

@jhonxie369-star

Description

@jhonxie369-star

Alibaba Cloud Detector Should Display Access Key ID Instead of Secret in Raw Field

Issue Description

The Alibaba Cloud detector currently displays the Access Key Secret in the Raw field instead of the Access Key ID, which is inconsistent with other cloud provider detectors and less useful for identification purposes.

Current Behavior

When detecting Alibaba Cloud credentials, TruffleHog outputs:

Raw result: [30-character secret value]

Expected Behavior

It should display the Access Key ID for better identification:

Raw result: LTAI[20-character identifier]

Why This Matters

  1. Identification: Access Key IDs are designed to be identifiers and are safer to display
  2. Consistency: AWS and other cloud detectors show the ID in the Raw field
  3. Verification: IDs make it easier to verify which credential was found without exposing sensitive data
  4. User Experience: Users expect to see the identifier, not the secret value

Code Analysis

In pkg/detectors/alibaba/alibaba.go, the current implementation assigns:

s1 := detectors.Result{
    Raw:   []byte(resMatch),              // Currently: Secret
    RawV2: []byte(resMatch + resIdMatch), // Currently: Secret+ID
}

Should be (consistent with AWS detector):

s1 := detectors.Result{
    Raw:   []byte(resIdMatch),            // Should be: ID
    RawV2: []byte(resIdMatch + ":" + resMatch), // Should be: ID:Secret
}

Comparison with AWS Detector

The AWS detector correctly shows:

  • Raw: Access Key ID (AKIA...)
  • RawV2: ID:Secret combination

The Alibaba detector should follow the same pattern for consistency.

Impact

  • Security: Reduces exposure of sensitive secret values in output
  • Usability: Makes it easier to identify which credential was detected
  • Consistency: Aligns with established patterns in other detectors

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions