Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix schema authz check for non-CCloud message viewer instances #958

Open
shouples opened this issue Jan 24, 2025 · 0 comments
Open

Fix schema authz check for non-CCloud message viewer instances #958

shouples opened this issue Jan 24, 2025 · 0 comments
Assignees
Labels
direct resources Connecting to or interacting with Kafka or Schema Registry through a "direct" connection. local resources Discoverability or interactions with locally-running Kafka, Schema Registry, etc. RBAC/authorization Relates to how the extension handles RBAC checks or authorization for actions

Comments

@shouples
Copy link
Contributor

shouples commented Jan 24, 2025

#654 started using LocalEnvironments and introduced DirectEnvironments, but there is still an old leftover assumption that local Kafka topics don't have an associated environmentId (which is false, since they have the vscode-local-connection ID):

export async function canAccessSchemaTypeForTopic(
topic: KafkaTopic,
type: "key" | "value",
): Promise<boolean> {
if (!topic.environmentId) {
// no way of checking local topic schemas currently
return true;
}
const environmentId: string = topic.environmentId;
const schemaRegistry: CCloudSchemaRegistry | null =
await getResourceManager().getCCloudSchemaRegistry(environmentId);
if (!schemaRegistry) {
logger.debug(
"no Schema Registry in extension state matching CCloud topic's environment ID; assuming user can access (non-existent) schemas",
{ environmentId },
);
// if we had schemas, we would have a schema registry
return true;
}

So when opening message viewer for a local/direct Kafka topic, we see these in the logs:

no Schema Registry in extension state matching CCloud topic's environment ID; assuming user can access (non-existent) schemas { environmentId: "vscode-local-connection" / <UUID> }

We need to update this to correctly handle local/direct environments and migrate it to using the appropriate ResourceLoader instances.

@shouples shouples self-assigned this Jan 24, 2025
@shouples shouples added local resources Discoverability or interactions with locally-running Kafka, Schema Registry, etc. RBAC/authorization Relates to how the extension handles RBAC checks or authorization for actions direct resources Connecting to or interacting with Kafka or Schema Registry through a "direct" connection. labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
direct resources Connecting to or interacting with Kafka or Schema Registry through a "direct" connection. local resources Discoverability or interactions with locally-running Kafka, Schema Registry, etc. RBAC/authorization Relates to how the extension handles RBAC checks or authorization for actions
Projects
None yet
Development

No branches or pull requests

1 participant