Skip to content

[exporter/awss3] Fix outdated StorageClass and ACL validation by using AWS SDK types#46846

Open
57Ajay wants to merge 1 commit intoopen-telemetry:mainfrom
57Ajay:fix/awss3exporter-storage-class-validation
Open

[exporter/awss3] Fix outdated StorageClass and ACL validation by using AWS SDK types#46846
57Ajay wants to merge 1 commit intoopen-telemetry:mainfrom
57Ajay:fix/awss3exporter-storage-class-validation

Conversation

@57Ajay
Copy link
Contributor

@57Ajay 57Ajay commented Mar 11, 2026

fixes #46825

Problem

The awss3exporter config validation in config.go uses hardcoded maps to validate StorageClass and ACL values. The StorageClass allowlist was missing several valid AWS S3 storage classes:

Storage Class Status
GLACIER_IR Missing -- rejected as invalid
REDUCED_REDUNDANCY Missing -- rejected as invalid
EXPRESS_ONEZONE Missing -- rejected as invalid

This caused users configuring any of these storage classes to receive the error:

Error: invalid configuration: exporters::awss3: invalid StorageClass

The same maintenance concern applies to the ACL validation map - while it happens to be complete today, it is equally susceptible to going stale if AWS introduces new canned ACL values in the future.

Root Cause

The exporter treats StorageClass and ACL as pass-through values - the config string is cast directly to the corresponding AWS SDK type (s3types.StorageClass / s3types.ObjectCannedACL) and forwarded to the S3 API with no class-specific or ACL-specific logic. The hardcoded validation maps were therefore both redundant and incomplete.

Fix

Replaced both hardcoded validation maps with dynamic lookups using the AWS SDK's own type values:

  • StorageClass: now validated against s3types.StorageClassStandard.Values()
  • ACL: now validated against s3types.ObjectCannedACLPrivate.Values()

This ensures validation stays in sync with the AWS SDK automatically, eliminating the need for manual updates when AWS introduces new storage classes or ACL types.

Testing

  • Added test cases to TestConfig_Validate for GLACIER_IR, REDUCED_REDUNDANCY, and EXPRESS_ONEZONE storage classes -- these fail against the old code and pass with the fix.
  • Added a negative test case for a truly invalid storage class (FAKE_CLASS) to verify rejection still works correctly.

Changes

File Change
exporter/awss3exporter/config.go Replaced hardcoded validStorageClasses and validACLs maps with AWS SDK .Values() lookups
exporter/awss3exporter/config_test.go Added test cases for missing storage classes and invalid class rejection
.chloggen/fix-awss3exporter-storage-class-acl-validation.yaml Changelog entry

…lidation

Signed-off-by: 57Ajay <57ajay.u@gmail.com>
@57Ajay
Copy link
Contributor Author

57Ajay commented Mar 11, 2026

/rerun

Copy link
Member

@paulojmdias paulojmdias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The list of valid S3 storage classes is out of date in awss3exporter

3 participants