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

Disallow grafana plugin on the cse #281

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/backend/rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ export default class RestApiBackend implements Backend {
'The data source specified the Checkmk Raw Edition, but a Checkmk commercial edition was detected. Some functionality may not be available. Choose commercial editions in the data source settings to enable all features.'
);
}
if (result.data.edition === 'cse') {
throw new Error('Detected Checkmk Cloud (SaaS). Can not query data from Checkmk Cloud (SaaS).');
}
// The REST API would be ok with other users, but the autocompleter are not
if (!(await this.isAutomationUser(this.datasource.getUsername()))) {
throw new Error('This data source must authenticate against Checkmk using an automation user.');
Expand Down Expand Up @@ -255,6 +258,10 @@ export default class RestApiBackend implements Backend {

// check for cloud edition header
const checkmkEdition = result.headers.get('X-Checkmk-Edition');
// CSE is never supported
if (checkmkEdition === 'cse') {
throw new Error('Cannot query data from Checkmk Cloud (SaaS).');
}
const allowedEditions = new Set(['cce', 'cme']);
if (process.env.BUILD_EDITION === 'CLOUD' && !allowedEditions.has(checkmkEdition || '')) {
throw new Error(
Expand Down
Loading