stacklok / stacklok/toolhive

Fix misleading 'enforced by webhook' comment in MCPExternalAuthConfig

Open Beginner friendly
#4,626 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api enhancement go kubernetes operator
Dominant language
Go
Stars
2.2k
Forks
300
Avg merge
1d 15h
Merged PRs (30d)
184

Description

Summary

A comment on the AWS STS configuration claims validation is "enforced by webhook" but no validating webhook exists in the codebase. The enforcement is actually performed by validateAWSSts() during reconciliation. This is misleading for developers and contributors.

Severity: SHOULD FIX
Area: Code Accuracy
Breaking: No

Location

  • cmd/thv-operator/api/v1alpha1/mcpexternalauthconfig_types.go:622

Problem

// At least one of FallbackRoleArn or RoleMappings must be configured
// (enforced by webhook)

The project uses a CEL + reconciler validation model (no webhooks). This comment is either a leftover from a planned-but-unimplemented webhook or was written inaccurately.

Impact

  • Misleading for developers who may search for a webhook implementation
  • Contributors may believe a webhook exists and skip adding CEL validation because they think the webhook handles it
  • Inaccurate documentation of the validation architecture

Recommended Fix

Update the comment to reflect the actual enforcement mechanism:

// At least one of FallbackRoleArn or RoleMappings must be configured
// (enforced during reconciliation by validateAWSSts).

Optionally, also add a CEL rule to enforce this at admission time:

// +kubebuilder:validation:XValidation:rule=
//   "has(self.fallbackRoleArn) || (has(self.roleMappings) &&
//    size(self.roleMappings) > 0)",
//   message="at least one of fallbackRoleArn or roleMappings is required"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open cmd/thv-operator/api/v1alpha1/mcpexternalauthconfig_types.go at line 622 and inspect the surrounding MCPExternalAuthConfig definition. Confirm that validateAWSSts() performs the enforcement during reconciliation, then update the misleading webhook comment so it accurately describes that mechanism.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
infrastructure
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.