feat: add IAM OIDC provider tagging actions

Adds `TagOpenIDConnectProvider`, `UntagOpenIDConnectProvider` and `ListOpenIDConnectProviderTags` to the standalone IAM service, backed by both the internal and Vault storers. They follow the user and role tagging actions in most respects — the tag action merges into the provider's existing tags and rejects a repeated key, untag removal is idempotent, and the tag listing is sorted by key and paginated, with the per-request member count and the per-provider tag total enforced as separate quotas so replacing a tag on a provider already at the 50-tag cap still succeeds — but differ in the one respect IAM itself draws: OIDC provider tag keys are compared exactly, not case-insensitively. On a provider `env` and `ENV` are two independent tags, both may be supplied in a single request, only a byte-identical repeat is a duplicate (reported without the "Tag keys are case insensitive" note the user and role actions carry), and untagging `env` leaves `ENV` in place.

That distinction is now carried by `iamutil.TagKeyCase`, which `ParseTags` uses for duplicate detection and which `mergeTags`, `removeTags` and the tag listing's marker lookup use for key matching. `CreateOpenIDConnectProvider` moves onto the exact comparison too, so a provider created with case-differing tag keys keeps both.

All three actions are authorized against the target provider's ARN, so `aws:ResourceTag/<key>` reads the provider's own tags, and the tag and untag actions populate `aws:RequestTag/<key>` and `aws:TagKeys` respectively, so a tag-scoped policy Condition governs which tags a caller may set or remove. All three report a missing provider with the wording `DeleteOpenIDConnectProvider` uses rather than the one `GetOpenIDConnectProvider` uses, which is why the Vault provider read now takes the not-found error its calling action reports.

The WebGUI gains a Tags section in the OIDC provider manage view, replacing the read-only tag row, and the shared tag editor gains a case-sensitive mode that changes its duplicate-key check, its diffing of an edited set into an untag and tag pair, and the wording of its guidance.
This commit is contained in:
niksis02
2026-08-28 00:49:21 +04:00
parent 1bbcd64195
commit 4901afe27b
19 changed files with 2086 additions and 94 deletions
+88 -5
View File
@@ -61,7 +61,7 @@ func (c IAMApiController) CreateUser(ctx fiber.Ctx) (*Response, error) {
return nil, err
}
tags, err := iamutil.ParseTags(ctx)
tags, err := iamutil.ParseTags(ctx, iamutil.TagKeysFolded)
if err != nil {
return nil, err
}
@@ -244,7 +244,7 @@ func (c IAMApiController) TagUser(ctx fiber.Ctx) (*Response, error) {
return nil, err
}
tags, err := iamutil.ParseTags(ctx)
tags, err := iamutil.ParseTags(ctx, iamutil.TagKeysFolded)
if err != nil {
return nil, err
}
@@ -662,7 +662,7 @@ func (c IAMApiController) CreateRole(ctx fiber.Ctx) (*Response, error) {
return nil, err
}
tags, err := iamutil.ParseTags(ctx)
tags, err := iamutil.ParseTags(ctx, iamutil.TagKeysFolded)
if err != nil {
return nil, err
}
@@ -826,7 +826,7 @@ func (c IAMApiController) TagRole(ctx fiber.Ctx) (*Response, error) {
return nil, err
}
tags, err := iamutil.ParseTags(ctx)
tags, err := iamutil.ParseTags(ctx, iamutil.TagKeysFolded)
if err != nil {
return nil, err
}
@@ -1069,7 +1069,7 @@ func (c IAMApiController) CreateOpenIDConnectProvider(ctx fiber.Ctx) (*Response,
thumbprints = iamutil.NormalizeThumbprintList(thumbprints)
}
tags, err := iamutil.ParseTags(ctx)
tags, err := iamutil.ParseTags(ctx, iamutil.TagKeysExact)
if err != nil {
return nil, err
}
@@ -1214,6 +1214,89 @@ func (c IAMApiController) UpdateOpenIDConnectProviderThumbprint(ctx fiber.Ctx) (
return &Response{Data: &types.UpdateOpenIDConnectProviderThumbprintResponse{}}, nil
}
// TagOpenIDConnectProvider adds or replaces tags on an existing OIDC
// provider. Unlike the user and role tag actions, provider tag keys are
// compared exactly, so "env" and "ENV" are two distinct tags.
func (c IAMApiController) TagOpenIDConnectProvider(ctx fiber.Ctx) (*Response, error) {
arn, err := iamutil.GetOIDCProviderArn(ctx, "TagOpenIDConnectProvider")
if err != nil {
return nil, err
}
tags, err := iamutil.ParseTags(ctx, iamutil.TagKeysExact)
if err != nil {
return nil, err
}
if len(tags) == 0 {
debuglogger.Logf("missing required TagOpenIDConnectProvider parameter: Tags")
return nil, iamerr.MissingValue("tags")
}
if err := c.store.TagOIDCProvider(ctx.Context(), arn, tags); err != nil {
debuglogger.Logf("failed to tag IAM OIDC provider %q: %v", arn, err)
return nil, err
}
return &Response{Data: &types.TagOpenIDConnectProviderResponse{}}, nil
}
// UntagOpenIDConnectProvider removes the named tags from an existing OIDC
// provider. Removal is idempotent: a key naming no current tag is not an
// error.
func (c IAMApiController) UntagOpenIDConnectProvider(ctx fiber.Ctx) (*Response, error) {
arn, err := iamutil.GetOIDCProviderArn(ctx, "UntagOpenIDConnectProvider")
if err != nil {
return nil, err
}
tagKeys, err := iamutil.ParseTagKeys(ctx)
if err != nil {
return nil, err
}
if len(tagKeys) == 0 {
debuglogger.Logf("missing required UntagOpenIDConnectProvider parameter: TagKeys")
return nil, iamerr.MissingValue("tagKeys")
}
if err := c.store.UntagOIDCProvider(ctx.Context(), arn, tagKeys); err != nil {
debuglogger.Logf("failed to untag IAM OIDC provider %q: %v", arn, err)
return nil, err
}
return &Response{Data: &types.UntagOpenIDConnectProviderResponse{}}, nil
}
func (c IAMApiController) ListOpenIDConnectProviderTags(ctx fiber.Ctx) (*Response, error) {
arn, err := iamutil.GetOIDCProviderArn(ctx, "ListOpenIDConnectProviderTags")
if err != nil {
return nil, err
}
maxItems, err := iamutil.ParseMaxItems(ctx, "ListOpenIDConnectProviderTags")
if err != nil {
return nil, err
}
marker, _ := iamutil.RequestParam(ctx, "Marker")
out, err := c.store.ListOIDCProviderTags(ctx.Context(), storage.ListOIDCProviderTagsInput{
Arn: arn,
Marker: marker,
MaxItems: maxItems,
})
if err != nil {
debuglogger.Logf("failed to list IAM OIDC provider %q tags: %v", arn, err)
return nil, err
}
return &Response{Data: &types.ListOpenIDConnectProviderTagsResponse{
Result: types.ListOpenIDConnectProviderTagsResult{
Tags: types.Tags{Members: out.Tags},
IsTruncated: out.IsTruncated,
Marker: out.Marker,
},
}}, nil
}
func (c IAMApiController) AssumeRoleWithWebIdentity(ctx fiber.Ctx) (*Response, error) {
rawRoleArn, ok := iamutil.RequestParam(ctx, "RoleArn")
if !ok || rawRoleArn == "" {