-
Couldn't load subscription status.
- Fork 2.1k
Open
Labels
Description
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
- Identification: Access Key IDs are designed to be identifiers and are safer to display
- Consistency: AWS and other cloud detectors show the ID in the Raw field
- Verification: IDs make it easier to verify which credential was found without exposing sensitive data
- 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