Skip to content
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
27 changes: 19 additions & 8 deletions packages/cubejs-api-gateway/src/sql-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,25 @@ export class SQLServer {
};
},
checkSqlAuth: async ({ request, user, password }) => {
const { password: returnedPassword, superuser, securityContext, skipPasswordCheck } = await checkSqlAuth(request, user, password);

return {
password: returnedPassword,
superuser: superuser || false,
securityContext,
skipPasswordCheck,
};
try {
const { password: returnedPassword, superuser, securityContext, skipPasswordCheck } = await checkSqlAuth(request, user, password);

return {
password: returnedPassword,
superuser: superuser || false,
securityContext,
skipPasswordCheck,
};
} catch (e) {
this.apiGateway.log({
Copy link
Member

@ovr ovr Jun 9, 2025

Choose a reason for hiding this comment

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

It's just another problem related to how users write check_sql_auth.

Default example from the documentation:
https://cube.dev/docs/product/configuration/reference/config#check_sql_auth

It will throw an exception for incorrect username/password, but the biggest problem is that we will start to spam it in our logs.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it's a problem. In a common standard flow, there will be no exceptions thrown as every real good user would be authorized and logged in. While any auth denial is an outstanding event and might be a reason to look into it.

Copy link
Member

Choose a reason for hiding this comment

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

type: 'Auth Error',
protocol: (request as any).protocol,
method: (request as any).method,
apiType: 'sql',
error: (e as Error).stack || (e as Error).toString(),
});
throw e;
}
},
meta: async ({ request, session, onlyCompilerId }) => {
const context = await this.apiGateway.contextByReq(<any> request, session.securityContext, request.id);
Expand Down
Loading