Merge branch 'master' into ai-assistant

This commit is contained in:
SPRINX0\prochazka
2025-02-05 15:01:50 +01:00
32 changed files with 270 additions and 109 deletions

View File

@@ -39,6 +39,7 @@ jobs:
repository: dbgate/dbgate-pro repository: dbgate/dbgate-pro
token: '${{ secrets.GH_TOKEN }}' token: '${{ secrets.GH_TOKEN }}'
path: dbgate-pro path: dbgate-pro
ref: a770b7e7a4d0ced5f1ade7cba4ba516220765648
- name: Merge dbgate/dbgate-pro - name: Merge dbgate/dbgate-pro
run: | run: |
mkdir ../dbgate-pro mkdir ../dbgate-pro

View File

@@ -39,6 +39,7 @@ jobs:
repository: dbgate/dbgate-pro repository: dbgate/dbgate-pro
token: '${{ secrets.GH_TOKEN }}' token: '${{ secrets.GH_TOKEN }}'
path: dbgate-pro path: dbgate-pro
ref: a770b7e7a4d0ced5f1ade7cba4ba516220765648
- name: Merge dbgate/dbgate-pro - name: Merge dbgate/dbgate-pro
run: | run: |
mkdir ../dbgate-pro mkdir ../dbgate-pro

View File

@@ -36,6 +36,7 @@ jobs:
repository: dbgate/dbgate-pro repository: dbgate/dbgate-pro
token: '${{ secrets.GH_TOKEN }}' token: '${{ secrets.GH_TOKEN }}'
path: dbgate-pro path: dbgate-pro
ref: a770b7e7a4d0ced5f1ade7cba4ba516220765648
- name: Merge dbgate/dbgate-pro - name: Merge dbgate/dbgate-pro
run: | run: |
mkdir ../dbgate-pro mkdir ../dbgate-pro

View File

@@ -44,6 +44,7 @@ jobs:
repository: dbgate/dbgate-pro repository: dbgate/dbgate-pro
token: '${{ secrets.GH_TOKEN }}' token: '${{ secrets.GH_TOKEN }}'
path: dbgate-pro path: dbgate-pro
ref: a770b7e7a4d0ced5f1ade7cba4ba516220765648
- name: Merge dbgate/dbgate-pro - name: Merge dbgate/dbgate-pro
run: | run: |
mkdir ../dbgate-pro mkdir ../dbgate-pro

View File

@@ -32,6 +32,7 @@ jobs:
repository: dbgate/dbgate-pro repository: dbgate/dbgate-pro
token: '${{ secrets.GH_TOKEN }}' token: '${{ secrets.GH_TOKEN }}'
path: dbgate-pro path: dbgate-pro
ref: a770b7e7a4d0ced5f1ade7cba4ba516220765648
- name: Merge dbgate/dbgate-pro - name: Merge dbgate/dbgate-pro
run: | run: |
mkdir ../dbgate-pro mkdir ../dbgate-pro

View File

@@ -8,6 +8,7 @@ name: Build test containers
- master - master
- develop - develop
- feature/** - feature/**
- hotfix/**
paths: paths:
- e2e-tests/containers/** - e2e-tests/containers/**
jobs: jobs:

View File

@@ -8,6 +8,7 @@ name: Cypress tests with screenshots PREMIUM
- master - master
- develop - develop
- feature/** - feature/**
- hotfix/**
jobs: jobs:
e2e-tests: e2e-tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -25,6 +26,7 @@ jobs:
repository: dbgate/dbgate-pro repository: dbgate/dbgate-pro
token: '${{ secrets.GH_TOKEN }}' token: '${{ secrets.GH_TOKEN }}'
path: dbgate-pro path: dbgate-pro
ref: a770b7e7a4d0ced5f1ade7cba4ba516220765648
- name: Merge dbgate/dbgate-pro - name: Merge dbgate/dbgate-pro
run: | run: |
mkdir ../dbgate-pro mkdir ../dbgate-pro
@@ -84,7 +86,7 @@ jobs:
mysql-ssh-login: mysql-ssh-login:
image: 'ghcr.io/dbgate/mysql-ssh-login:latest' image: 'ghcr.io/dbgate/mysql-ssh-login:latest'
ports: ports:
- '16006:22' - '16012:22'
mysql-ssh-keyfile: mysql-ssh-keyfile:
image: 'ghcr.io/dbgate/mysql-ssh-keyfile:latest' image: 'ghcr.io/dbgate/mysql-ssh-keyfile:latest'
ports: ports:

View File

@@ -8,6 +8,7 @@ name: Integration and unit tests
- master - master
- develop - develop
- feature/** - feature/**
- hotfix/**
jobs: jobs:
all-tests: all-tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@@ -8,6 +8,13 @@ Builds:
- linux - application for linux - linux - application for linux
- win - application for Windows - win - application for Windows
### 6.1.6
- FIXED: Hotfix build process for premium edition
### 6.1.5
- FIXED: Serious security hotfix (for Docker and NPM, when using LOGIN and PASSWORD environment variables or LOGIN_PASSWORD_xxx)
- no changes for desktop app and for Team premium edition, when using storage DB
### 6.1.4 ### 6.1.4
- CHANGED: Show Data/Structure button in one place #1015 - CHANGED: Show Data/Structure button in one place #1015
- ADDED: Data view coloring (every second row) #1014 - ADDED: Data view coloring (every second row) #1014

View File

@@ -17,6 +17,11 @@ staticClients:
enablePasswordDB: true enablePasswordDB: true
staticPasswords: staticPasswords:
- email: "test@example.com" - email: "test@example.com"
emailVerified: true
hash: "$2y$10$JcmlXnV1y7.egUdKwYNbseOnqYVIGc323gtvvHh4ZuSPZB30veYZy" hash: "$2y$10$JcmlXnV1y7.egUdKwYNbseOnqYVIGc323gtvvHh4ZuSPZB30veYZy"
username: "test" username: "test"
userID: "1234" userID: "1234"
allowedScopes:
- openid
- email
- profile

View File

@@ -47,7 +47,7 @@ describe('Add connection', () => {
cy.get('[data-testid=ConnectionSshTunnelFields_useSshTunnel]').check(); cy.get('[data-testid=ConnectionSshTunnelFields_useSshTunnel]').check();
cy.get('[data-testid=ConnectionSshTunnelFields_sshLogin]').clear().type('root'); cy.get('[data-testid=ConnectionSshTunnelFields_sshLogin]').clear().type('root');
cy.get('[data-testid=ConnectionSshTunnelFields_sshPassword]').clear().type('root'); cy.get('[data-testid=ConnectionSshTunnelFields_sshPassword]').clear().type('root');
cy.get('[data-testid=ConnectionSshTunnelFields_sshPort]').clear().type('16006'); cy.get('[data-testid=ConnectionSshTunnelFields_sshPort]').clear().type('16012');
cy.get('[data-testid=ConnectionTab_buttonSave]').click(); cy.get('[data-testid=ConnectionTab_buttonSave]').click();
cy.get('[data-testid=ConnectionTab_buttonConnect]').click(); cy.get('[data-testid=ConnectionTab_buttonConnect]').click();
cy.contains('performance_schema'); cy.contains('performance_schema');

View File

@@ -4,7 +4,7 @@ beforeEach(() => {
}); });
describe('Team edition tests', () => { describe('Team edition tests', () => {
it('Data archive editor - macros', () => { it('Team edition screens', () => {
cy.testid('LoginPage_linkAdmin').click(); cy.testid('LoginPage_linkAdmin').click();
cy.testid('LoginPage_password').type('adminpwd'); cy.testid('LoginPage_password').type('adminpwd');
cy.testid('LoginPage_submitLogin').click(); cy.testid('LoginPage_submitLogin').click();
@@ -27,4 +27,56 @@ describe('Team edition tests', () => {
cy.contains('OAuth 2.0').click(); cy.contains('OAuth 2.0').click();
cy.themeshot('authadmin'); cy.themeshot('authadmin');
}); });
it('OAuth authentication', () => {
cy.testid('LoginPage_linkAdmin').click();
cy.testid('LoginPage_password').type('adminpwd');
cy.testid('LoginPage_submitLogin').click();
cy.testid('AdminMenuWidget_itemAuthentication').click();
// cy.testid('AdminAuthForm_disableButton_local').click();
// cy.testid('AdminAuthForm_disableButton_none').click();
// fill OAuth
cy.contains('Add authentication').click();
cy.contains('OAuth 2.0').click();
cy.testid('AdminAuthForm_oauthAuth_oauth').type('http://localhost:16009/dex/auth');
cy.testid('AdminAuthForm_oauthToken_oauth').type('http://localhost:16009/dex/token');
cy.testid('AdminAuthForm_oauthScope_oauth').type('openid email profile');
cy.testid('AdminAuthForm_oauthClient_oauth').type('my-app');
cy.testid('AdminAuthForm_oauthClientSecret_oauth').type('my-secret');
cy.testid('AdminAuthForm_oauthLoginField_oauth').type('name');
cy.testid('AdminAuthForm_oauthSaveNotDefinedLogins_oauth').click();
cy.testid('AdminAuthForm_oauthEmailField_oauth').type('email');
cy.testid('AdminAuthTab_saveButton').click();
cy.testid('WidgetIconPanel_menu').click();
cy.contains('File').click();
cy.contains('Logout').click();
cy.testid('LoginPage_linkRegularUser').click();
// login two times
for (let index of [1, 2]) {
// login as OAuth
cy.testid('LoginPage_loginButton_OAuth 2.0').click();
// login on DEX
cy.get('#login').clear().type('test@example.com');
cy.get('#password').clear().type('test');
cy.get('#submit-login').click();
// logout
cy.testid('WidgetIconPanel_menu').click();
cy.contains('File').click();
cy.contains('Logout').click();
cy.testid('NotLoggedPage_loginButton').click();
}
// Logout and login again as admin
cy.testid('LoginPage_linkAdmin').click();
cy.testid('LoginPage_password').type('adminpwd');
cy.testid('LoginPage_submitLogin').click();
cy.testid('AdminMenuWidget_itemUsers').click();
cy.contains('test@example.com');
cy.contains('Rows: 1');
});
}); });

View File

@@ -22,7 +22,7 @@ services:
restart: always restart: always
ports: ports:
- 16005:3306 - 16005:3306
- "16006:22" - "16012:22"
mysql-ssh-keyfile: mysql-ssh-keyfile:
build: containers/mysql-ssh-keyfile build: containers/mysql-ssh-keyfile

View File

@@ -1,6 +1,6 @@
{ {
"private": true, "private": true,
"version": "6.1.5-beta.3", "version": "6.1.7-premium-beta.1",
"name": "dbgate-all", "name": "dbgate-all",
"workspaces": [ "workspaces": [
"packages/*", "packages/*",
@@ -23,6 +23,7 @@
"start:api:storage": "yarn workspace dbgate-api start:storage | pino-pretty", "start:api:storage": "yarn workspace dbgate-api start:storage | pino-pretty",
"start:api:storage:built": "yarn workspace dbgate-api start:storage:built | pino-pretty", "start:api:storage:built": "yarn workspace dbgate-api start:storage:built | pino-pretty",
"start:api:azure": "yarn workspace dbgate-api start:azure | pino-pretty", "start:api:azure": "yarn workspace dbgate-api start:azure | pino-pretty",
"start:api:e2e:team": "yarn workspace dbgate-api start:e2e:team | pino-pretty",
"sync:pro": "cd sync && yarn start", "sync:pro": "cd sync && yarn start",
"start:web": "yarn workspace dbgate-web dev", "start:web": "yarn workspace dbgate-web dev",
"start:sqltree": "yarn workspace dbgate-sqltree start", "start:sqltree": "yarn workspace dbgate-sqltree start",

View File

@@ -75,6 +75,7 @@
"start:storage:built": "env-cmd -f env/storage/.env cross-env DEVMODE= BUILTWEBMODE=1 node dist/bundle.js --listen-api", "start:storage:built": "env-cmd -f env/storage/.env cross-env DEVMODE= BUILTWEBMODE=1 node dist/bundle.js --listen-api",
"start:singleconn": "env-cmd node src/index.js --server localhost --user root --port 3307 --engine mysql@dbgate-plugin-mysql --password test --listen-api", "start:singleconn": "env-cmd node src/index.js --server localhost --user root --port 3307 --engine mysql@dbgate-plugin-mysql --password test --listen-api",
"start:azure": "env-cmd -f env/azure/.env node src/index.js --listen-api", "start:azure": "env-cmd -f env/azure/.env node src/index.js --listen-api",
"start:e2e:team": "cross-env DEVWEB=1 DEVMODE=1 env-cmd -f ../../e2e-tests/env/team/.env node src/index.js --listen-api",
"ts": "tsc", "ts": "tsc",
"build": "webpack", "build": "webpack",
"build:doc": "jsdoc2md --template doctpl.hbs ./src/shell/* > ../../../dbgate.github.io/_docs/apidoc.md" "build:doc": "jsdoc2md --template doctpl.hbs ./src/shell/* > ../../../dbgate.github.io/_docs/apidoc.md"

View File

@@ -218,7 +218,7 @@ class LoginsProvider extends AuthProviderBase {
}; };
} }
if (password == process.env[`LOGIN_PASSWORD_${login}`]) { if (password && password == process.env[`LOGIN_PASSWORD_${login}`]) {
return { return {
accessToken: jwt.sign( accessToken: jwt.sign(
{ {

View File

@@ -401,6 +401,10 @@ module.exports = {
structure_meta: true, structure_meta: true,
async structure({ conid, database, modelTransFile = null }, req) { async structure({ conid, database, modelTransFile = null }, req) {
if (!conid || !database) {
return {};
}
testConnectionPermission(conid, req); testConnectionPermission(conid, req);
if (conid == '__model') { if (conid == '__model') {
const model = await importDbModel(database); const model = await importDbModel(database);

View File

@@ -63,6 +63,12 @@ export function formatQueryWithoutParams(driver: EngineDriver, sql: string) {
return dmp.s; return dmp.s;
} }
export async function runQueryFmt(driver, conn, query, ...args) {
const dmp = driver.createDumper();
dmp.put(query, ...args);
await driver.query(conn, dmp.s);
}
export const driverBase = { export const driverBase = {
analyserClass: null, analyserClass: null,
dumperClass: SqlDumper, dumperClass: SqlDumper,

View File

@@ -30,8 +30,8 @@
{/if} {/if}
<div class="button"> <div class="button">
<FormStyledButton value="Log In" on:click={handleLogin} /> <FormStyledButton value="Log In" on:click={handleLogin} data-testid="NotLoggedPage_loginButton" />
<FormStyledButton value="Log Out" on:click={doLogout} /> <FormStyledButton value="Log Out" on:click={doLogout} data-testid="NotLoggedPage_logoutButton" />
</div> </div>
</div> </div>
</SpecialPageLayout> </SpecialPageLayout>

View File

@@ -97,6 +97,10 @@ await dbgateApi.deployDb(${JSON.stringify(
title: 'Compare', title: 'Compare',
icon: 'img compare', icon: 'img compare',
tabComponent: 'CompareModelTab', tabComponent: 'CompareModelTab',
props: {
conid: $currentDatabase?.connection?._id,
database: $currentDatabase?.name,
}
}, },
{ {
editor: { editor: {

View File

@@ -196,13 +196,17 @@
title: 'Compare', title: 'Compare',
icon: 'img compare', icon: 'img compare',
tabComponent: 'CompareModelTab', tabComponent: 'CompareModelTab',
props: {
conid: $currentDatabase?.connection?._id,
database: $currentDatabase?.name,
},
}, },
{ {
editor: { editor: {
sourceConid: _.get($currentDatabase, 'connection._id'), sourceConid: connection?._id,
sourceDatabase: _.get($currentDatabase, 'name'), sourceDatabase: name,
targetConid: _.get(connection, '_id'), targetConid: $currentDatabase?.connection?._id,
targetDatabase: name, targetDatabase: $currentDatabase?.name,
}, },
} }
); );

View File

@@ -16,7 +16,7 @@
</script> </script>
<div class="button" class:disabled {title}> <div class="button" class:disabled {title}>
<div class="inner" class:disabled on:click={handleClick}> <div class="inner" class:disabled on:click={handleClick} data-testid={$$props['data-testid']}>
<span class="icon" class:disabled><FontIcon {icon} /></span> <span class="icon" class:disabled><FontIcon {icon} /></span>
<slot /> <slot />
{#if iconAfter} {#if iconAfter}

View File

@@ -22,7 +22,7 @@ const doServerPing = value => {
} }
apiCall('server-connections/ping', { apiCall('server-connections/ping', {
conidArray, conidArray: _.compact(conidArray),
strmid, strmid,
}); });
}; };

View File

@@ -1,77 +1,32 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools --> <svg height="800px" width="800px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> viewBox="0 0 56 56" xml:space="preserve">
<svg fill="#000000" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="800px" height="800px" viewBox="0 0 550.801 550.801"
xml:space="preserve">
<g> <g>
<path style="fill:#E9E9E0;" d="M36.985,0H7.963C7.155,0,6.5,0.655,6.5,1.926V55c0,0.345,0.655,1,1.463,1h40.074
c0.808,0,1.463-0.655,1.463-1V12.978c0-0.696-0.093-0.92-0.257-1.085L37.607,0.257C37.442,0.093,37.218,0,36.985,0z"/>
<polygon style="fill:#D9D7CA;" points="37.5,0.151 37.5,12 49.349,12 "/>
<path style="fill:#E96360;" d="M48.037,56H7.963C7.155,56,6.5,55.345,6.5,54.537V39h43v15.537C49.5,55.345,48.845,56,48.037,56z"/>
<g> <g>
<g> <path style="fill:#FFFFFF;" d="M22.947,47.682c0,0.829-0.089,1.538-0.267,2.126s-0.403,1.08-0.677,1.477s-0.581,0.709-0.923,0.937
<path d="M283.948,460.825h-10.335v37.778c2.987,0.391,6.56,0.391,11.728,0.391c13.722,0,25.851-5.168,25.851-19.279 s-0.672,0.398-0.991,0.513c-0.319,0.114-0.611,0.187-0.875,0.219C18.95,52.984,18.754,53,18.627,53h-3.814V42.924h3.035
C311.191,466.198,299.062,460.825,283.948,460.825z"/> c0.848,0,1.593,0.135,2.235,0.403s1.176,0.627,1.6,1.073s0.74,0.955,0.95,1.524C22.842,46.494,22.947,47.08,22.947,47.682z
<path d="M308.006,422.656c0-10.136-7.757-15.504-21.479-15.504c-6.561,0-10.333,0.39-12.92,0.785v31.214h9.945 M18.08,51.797c1.112,0,1.914-0.355,2.406-1.066s0.738-1.741,0.738-3.09c0-0.419-0.05-0.834-0.15-1.244
C299.463,439.162,308.006,432.602,308.006,422.656z"/> c-0.101-0.41-0.294-0.781-0.581-1.114s-0.677-0.602-1.169-0.807s-1.13-0.308-1.914-0.308h-0.957v7.629H18.08z"/>
<path d="M149.347,408.344c-6.75,0-11.129,0.591-13.708,1.191v87.677c2.586,0.601,6.76,0.601,10.533,0.601 <path style="fill:#FFFFFF;" d="M30.098,47.695c0.209,0.027,0.433,0.096,0.67,0.205c0.237,0.109,0.458,0.265,0.663,0.465
c27.433,0.201,45.333-14.913,45.333-46.923C191.706,423.052,175.403,408.344,149.347,408.344z"/> s0.376,0.444,0.513,0.731s0.205,0.617,0.205,0.991c0,0.456-0.068,0.848-0.205,1.176s-0.308,0.6-0.513,0.813
<path d="M475.095,131.997c-0.031-2.526-0.828-5.021-2.562-6.992L366.325,3.694c-0.021-0.034-0.053-0.045-0.085-0.076 s-0.429,0.383-0.67,0.506c-0.242,0.123-0.474,0.217-0.697,0.28c-0.224,0.063-0.422,0.103-0.595,0.116
c-0.633-0.707-1.36-1.29-2.141-1.804c-0.232-0.15-0.464-0.287-0.707-0.422c-0.686-0.366-1.392-0.67-2.13-0.892 C29.295,52.993,29.182,53,29.127,53H25.34V42.924h2.898c0.428,0,0.843,0.05,1.244,0.15c0.401,0.101,0.756,0.26,1.066,0.479
c-0.2-0.058-0.38-0.14-0.58-0.192C359.87,0.119,359.048,0,358.204,0H97.2c-11.907,0-21.6,9.693-21.6,21.601v507.6 c0.31,0.219,0.556,0.504,0.738,0.854c0.182,0.351,0.273,0.768,0.273,1.251c0,0.282-0.046,0.54-0.137,0.772
c0,11.913,9.692,21.601,21.6,21.601h356.4c11.918,0,21.6-9.688,21.6-21.601V133.207 c-0.091,0.232-0.205,0.436-0.342,0.608s-0.294,0.316-0.472,0.431S30.262,47.659,30.098,47.695z M28.197,47.23
C475.2,132.796,475.137,132.398,475.095,131.997z M201.454,504.173c-14.123,11.733-35.598,17.297-61.836,17.297 c0.2,0,0.405-0.005,0.615-0.014c0.209-0.009,0.405-0.06,0.588-0.15c0.182-0.091,0.33-0.246,0.444-0.465
c-15.715,0-26.844-0.997-34.404-1.983V387.861c11.14-1.793,25.65-2.784,40.964-2.784c25.449,0,41.958,4.577,54.875,14.312 c0.114-0.219,0.171-0.533,0.171-0.943c0-0.164-0.023-0.335-0.068-0.513c-0.046-0.178-0.137-0.34-0.273-0.485
c13.922,10.341,22.663,26.842,22.663,50.509C223.715,475.549,214.368,493.235,201.454,504.173z M329.084,509.341 s-0.333-0.265-0.588-0.355c-0.255-0.091-0.593-0.137-1.012-0.137H26.98v3.063h0.068H28.197z M29.031,51.797
c-9.745,7.757-26.046,12.129-52.689,12.129c-14.916,0-26.051-0.997-32.812-1.983V387.861c7.966-1.592,24.058-2.784,39.169-2.784 c0.483,0,0.861-0.155,1.135-0.465s0.41-0.725,0.41-1.244c0-0.492-0.142-0.907-0.424-1.244c-0.283-0.337-0.697-0.506-1.244-0.506
c18.493,0,29.826,1.793,39.571,7.552c9.345,4.973,16.105,14.111,16.105,26.24c0,11.929-6.961,23.066-22.075,28.635v0.401 H26.98v3.459H29.031z"/>
c15.314,4.171,26.642,15.704,26.642,33.001C343.006,493.035,337.427,502.58,329.084,509.341z M445.596,410.928h-51.501v30.617 <path style="fill:#FFFFFF;" d="M36.168,44.168v3.172h4.211v1.121h-4.211V53H34.5V42.924h6.303v1.244H36.168z"/>
h48.115v24.648h-48.115v53.884h-30.417V386.068h81.918V410.928z M97.2,366.758V21.605h250.204v110.516
c0,5.962,4.83,10.8,10.8,10.8h95.396l0.011,223.837H97.2z"/>
</g>
<g>
<path d="M261.025,299.769c-2.22-0.912-4.008-2.389-5.292-4.192c-1.189,0.021-2.355,0.079-3.565,0.079
c-39.295,0-66.677-13.753-66.677-26.093v-20.239c12.263,11.232,37.491,18.404,66.677,18.404c1.777,0,3.489-0.113,5.234-0.164
c1.01-0.917,2.128-1.716,3.446-2.262c1.582-0.62,2.758-1.767,3.33-3.143s0.551-3.035-0.048-4.406
c-0.374-0.815-0.551-1.695-0.714-2.576c-3.633,0.253-7.359,0.422-11.243,0.422c-39.295,0-66.678-13.756-66.678-26.093v-20.24
c12.264,11.232,37.492,18.402,66.678,18.402c29.228,0,54.456-7.169,66.711-18.412v13.46h0.681c2.769,0,5.278,1.018,7.325,2.653
v-17.381c0-3.059-0.887-6.162-2.669-9.218l-0.231-0.391c1.846-3.006,2.9-6.188,2.9-9.502v-21.516
c0-2.909-0.812-5.875-2.416-8.807l-0.189-0.34c0.475-1.305,0.812-2.645,0.812-4.071c0-17.384-37.568-26.768-72.924-26.768
c-35.322,0-72.876,9.384-72.876,26.768c0,1.427,0.33,2.767,0.809,4.071l-0.189,0.34c-1.614,2.932-2.413,5.898-2.413,8.807v21.516
c0,3.309,1.042,6.484,2.887,9.492l-0.243,0.412c-1.759,3.056-2.645,6.148-2.645,9.207V229.5c0,3.207,0.981,6.275,2.731,9.208
l-0.087,0.134c-1.759,3.045-2.645,6.149-2.645,9.197v21.513c0,19.111,32.798,34.093,74.669,34.093
c4.131,0,8.139-0.189,12.07-0.464c-0.039-0.116-0.021-0.253-0.071-0.358C263.601,301.451,262.451,300.322,261.025,299.769z
M185.496,170.968c11.981,10.159,39.77,15.42,66.678,15.42c26.947,0,54.72-5.266,66.711-15.42v17.909
c0,12.337-27.379,26.083-66.711,26.083c-39.295,0-66.678-13.745-66.678-26.083V170.968z"/>
<path d="M340.875,296.494c0.733-0.295,1.324-0.865,1.608-1.551c0.28-0.686,0.28-1.497-0.021-2.178
c-0.902-2.062-0.438-4.487,1.134-6.064l4.197-4.203c1.055-1.039,2.415-1.613,3.845-1.613h0.986l1.123,0.433
c0.875,0.385,1.619,0.348,2.283,0.073c0.707-0.295,1.276-0.875,1.54-1.571c0.802-1.993,2.615-3.265,4.714-3.417v-3.908
c0-0.406-0.264-0.789-0.648-0.952c-4.14-1.619-7.493-4.892-9.191-8.997c-1.703-4.113-1.661-8.812,0.132-12.877
c0.163-0.367,0.079-0.82-0.211-1.118l-8.864-8.862c-0.485-0.49-0.85-0.335-1.129-0.222c-4.039,1.788-8.754,1.849-12.867,0.138
c-4.103-1.69-7.383-5.055-9.007-9.197c-0.147-0.372-0.517-0.638-0.938-0.638h-12.53c-0.411,0-0.796,0.266-0.938,0.638
c-1.619,4.147-4.904,7.507-9.007,9.197c-4.087,1.706-8.807,1.661-12.878-0.138c-0.253-0.103-0.622-0.269-1.118,0.222
l-8.867,8.862c-0.285,0.298-0.372,0.751-0.203,1.123c1.78,4.071,1.83,8.759,0.135,12.873c-1.701,4.105-5.055,7.377-9.202,8.997
c-0.382,0.158-0.638,0.524-0.638,0.952v12.535c0,0.412,0.256,0.781,0.638,0.939c4.153,1.618,7.496,4.894,9.202,8.996
c1.695,4.113,1.646,8.807-0.143,12.883c-0.161,0.364-0.074,0.817,0.211,1.113l8.867,8.869c0.496,0.496,0.85,0.332,1.123,0.201
c2.083-0.907,4.298-1.382,6.587-1.382c2.173,0,4.282,0.422,6.286,1.255c4.103,1.698,7.388,5.052,9.007,9.197
c0.143,0.369,0.527,0.633,0.938,0.633h12.53c0.427,0,0.791-0.254,0.938-0.633c1.624-4.146,4.898-7.499,9.007-9.197
c4.003-1.656,8.543-1.635,12.524-0.006c0.058-0.532,0.189-1.055,0.411-1.561c0.322-0.712,0.322-1.534,0.037-2.226
c-0.279-0.68-0.87-1.249-1.566-1.523c-2.125-0.854-3.475-2.837-3.475-5.084v-5.938
C337.438,299.315,338.787,297.327,340.875,296.494z M313.295,303.123c-13.437,0-24.368-10.922-24.368-24.379
c0-13.421,10.921-24.372,24.368-24.372c13.442,0,24.385,10.945,24.385,24.372C337.669,292.201,326.737,303.123,313.295,303.123z"
/>
<path d="M389.148,301.108c-1.962-0.765-3.555-2.32-4.355-4.256c-0.802-1.951-0.781-4.177,0.062-6.102
c0.085-0.174,0.043-0.396-0.095-0.543l-4.197-4.192c-0.232-0.227-0.411-0.152-0.538-0.1c-1.909,0.844-4.155,0.875-6.091,0.062
c-1.951-0.801-3.507-2.394-4.271-4.355c-0.068-0.18-0.242-0.306-0.443-0.306h-5.933c-0.2,0-0.385,0.116-0.453,0.306
c-0.76,1.962-2.32,3.555-4.261,4.355c-1.936,0.812-4.172,0.791-6.097-0.062c-0.121-0.053-0.3-0.127-0.532,0.1l-4.203,4.192
c-0.132,0.147-0.179,0.358-0.1,0.543c0.859,1.925,0.87,4.15,0.068,6.102c-0.812,1.936-2.395,3.491-4.356,4.256
c-0.185,0.079-0.306,0.248-0.306,0.453v5.943c0,0.19,0.121,0.364,0.306,0.443c1.962,0.77,3.544,2.32,4.356,4.261
c0.802,1.94,0.785,4.171-0.068,6.106c-0.079,0.169-0.032,0.38,0.1,0.527l4.203,4.198c0.232,0.231,0.406,0.158,0.532,0.1
c0.986-0.433,2.036-0.659,3.122-0.659c1.023,0,2.025,0.2,2.964,0.596c1.951,0.808,3.512,2.39,4.271,4.356
c0.074,0.179,0.253,0.301,0.453,0.301h5.933c0.201,0,0.375-0.111,0.443-0.301c0.765-1.957,2.32-3.549,4.271-4.356
c1.946-0.807,4.171-0.774,6.096,0.063c0.122,0.059,0.301,0.121,0.533-0.1l4.192-4.198c0.132-0.137,0.179-0.348,0.1-0.527
c-0.854-1.93-0.864-4.166-0.068-6.106c0.807-1.94,2.389-3.491,4.361-4.261c0.18-0.079,0.301-0.253,0.301-0.443v-5.943
C389.454,301.367,389.328,301.188,389.148,301.108z M366.251,316.08c-6.37,0-11.538-5.179-11.538-11.549
c0-6.365,5.168-11.555,11.538-11.555c6.365,0,11.544,5.189,11.544,11.555C377.795,310.901,372.616,316.08,366.251,316.08z"/>
</g>
</g> </g>
<path style="fill:#C8BDB8;" d="M24.5,16v-4h-12v4v2v2v2v2v2v2v2v4h10h2h21v-4v-2v-2v-2v-2v-2v-4H24.5z M14.5,14h8v2h-8V14z
M14.5,18h8v2h-8V18z M14.5,22h8v2h-8V22z M14.5,26h8v2h-8V26z M22.5,32h-8v-2h8V32z M43.5,32h-19v-2h19V32z M43.5,28h-19v-2h19V28
z M43.5,24h-19v-2h19V24z M24.5,20v-2h19v2H24.5z"/>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -36,6 +36,7 @@
"webpack-cli": "^5.1.4" "webpack-cli": "^5.1.4"
}, },
"dependencies": { "dependencies": {
"@azure/identity": "^4.6.0",
"async-lock": "^1.2.6", "async-lock": "^1.2.6",
"dbgate-query-splitter": "^4.11.3", "dbgate-query-splitter": "^4.11.3",
"dbgate-tools": "^6.0.0-alpha.1", "dbgate-tools": "^6.0.0-alpha.1",

View File

@@ -72,6 +72,14 @@ const driver = {
} }
); );
} }
if (!platformInfo.isElectron) {
res.push({
title: 'Azure Managed Identity',
name: 'azureManagedIdentity',
disabledFields: ['user', 'password'],
});
}
if (res.length > 0) { if (res.length > 0) {
return _.uniqBy(res, 'name'); return _.uniqBy(res, 'name');
} }
@@ -80,7 +88,8 @@ const driver = {
async connect(conn) { async connect(conn) {
const { authType } = conn; const { authType } = conn;
const connectionType = platformInfo?.isWindows && (authType == 'sspi' || authType == 'sql') ? 'msnodesqlv8' : 'tedious'; const connectionType =
platformInfo?.isWindows && (authType == 'sspi' || authType == 'sql') ? 'msnodesqlv8' : 'tedious';
const client = connectionType == 'msnodesqlv8' ? await nativeConnect(conn) : await tediousConnect(conn); const client = connectionType == 'msnodesqlv8' ? await nativeConnect(conn) : await tediousConnect(conn);
return { return {

View File

@@ -1,6 +1,7 @@
const _ = require('lodash'); const _ = require('lodash');
const stream = require('stream'); const stream = require('stream');
const tedious = require('tedious'); const tedious = require('tedious');
const { ManagedIdentityCredential } = require('@azure/identity');
const makeUniqueColumnNames = require('./makeUniqueColumnNames'); const makeUniqueColumnNames = require('./makeUniqueColumnNames');
const { extractDbNameFromComposite } = global.DBGATE_PACKAGES['dbgate-tools']; const { extractDbNameFromComposite } = global.DBGATE_PACKAGES['dbgate-tools'];
@@ -23,12 +24,50 @@ function extractTediousColumns(columns, addDriverNativeColumn = false) {
return res; return res;
} }
async function getDefaultAzureSqlToken() {
const credential = new ManagedIdentityCredential();
const tokenResponse = await credential.getToken('https://database.windows.net/.default');
return tokenResponse.token;
}
async function getAuthentication({ authType, accessToken, user, password, windowsDomain }) {
switch (authType) {
case 'azureManagedIdentity':
const token = await getDefaultAzureSqlToken();
return {
type: 'azure-active-directory-access-token',
options: {
token,
},
};
case 'msentra':
return {
type: 'azure-active-directory-access-token',
options: {
token: accessToken,
},
};
default:
return {
type: windowsDomain ? 'ntlm' : 'default',
options: {
userName: user,
password: password,
...(windowsDomain ? { domain: windowsDomain } : {}),
},
};
}
}
async function tediousConnect(storedConnection) { async function tediousConnect(storedConnection) {
const { server, port, user, password, database, ssl, trustServerCertificate, windowsDomain, authType, accessToken } = const { server, port, database, ssl, trustServerCertificate, authType } = storedConnection;
storedConnection;
const authentication = await getAuthentication(storedConnection);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const connectionOptions = { const connectionOptions = {
encrypt: !!ssl || authType == 'msentra', encrypt: !!ssl || authType == 'msentra' || authType == 'azureManagedIdentity',
cryptoCredentialsDetails: ssl ? _.pick(ssl, ['ca', 'cert', 'key']) : undefined, cryptoCredentialsDetails: ssl ? _.pick(ssl, ['ca', 'cert', 'key']) : undefined,
trustServerCertificate: ssl ? (!ssl.ca && !ssl.cert && !ssl.key ? true : ssl.rejectUnauthorized) : undefined, trustServerCertificate: ssl ? (!ssl.ca && !ssl.cert && !ssl.key ? true : ssl.rejectUnauthorized) : undefined,
enableArithAbort: true, enableArithAbort: true,
@@ -43,23 +82,6 @@ async function tediousConnect(storedConnection) {
connectionOptions.database = extractDbNameFromComposite(database); connectionOptions.database = extractDbNameFromComposite(database);
} }
const authentication =
authType == 'msentra'
? {
type: 'azure-active-directory-access-token',
options: {
token: accessToken,
},
}
: {
type: windowsDomain ? 'ntlm' : 'default',
options: {
userName: user,
password: password,
...(windowsDomain ? { domain: windowsDomain } : {}),
},
};
const connection = new tedious.Connection({ const connection = new tedious.Connection({
server, server,
authentication, authentication,

View File

@@ -6,6 +6,7 @@ on:
- master - master
- develop - develop
- 'feature/**' - 'feature/**'
- hotfix/**
paths: paths:
- e2e-tests/containers/** - e2e-tests/containers/**

View File

@@ -6,6 +6,7 @@ on:
- master - master
- develop - develop
- 'feature/**' - 'feature/**'
- hotfix/**
jobs: jobs:
e2e-tests: e2e-tests:
@@ -84,7 +85,7 @@ jobs:
mysql-ssh-login: mysql-ssh-login:
image: ghcr.io/dbgate/mysql-ssh-login:latest image: ghcr.io/dbgate/mysql-ssh-login:latest
ports: ports:
- '16006:22' - '16012:22'
mysql-ssh-keyfile: mysql-ssh-keyfile:
image: ghcr.io/dbgate/mysql-ssh-keyfile:latest image: ghcr.io/dbgate/mysql-ssh-keyfile:latest

View File

@@ -7,6 +7,7 @@ checkout-and-merge-pro:
repository: dbgate/dbgate-pro repository: dbgate/dbgate-pro
token: ${{ secrets.GH_TOKEN }} token: ${{ secrets.GH_TOKEN }}
path: dbgate-pro path: dbgate-pro
ref: a770b7e7a4d0ced5f1ade7cba4ba516220765648
- name: Merge dbgate/dbgate-pro - name: Merge dbgate/dbgate-pro
run: | run: |
mkdir ../dbgate-pro mkdir ../dbgate-pro

View File

@@ -6,6 +6,7 @@ on:
- master - master
- develop - develop
- 'feature/**' - 'feature/**'
- hotfix/**
jobs: jobs:
all-tests: all-tests:

View File

@@ -542,7 +542,16 @@
"@azure/core-util" "^1.1.0" "@azure/core-util" "^1.1.0"
tslib "^2.6.2" tslib "^2.6.2"
"@azure/core-client@^1.3.0", "@azure/core-client@^1.4.0", "@azure/core-client@^1.5.0": "@azure/core-auth@^1.8.0", "@azure/core-auth@^1.9.0":
version "1.9.0"
resolved "https://registry.yarnpkg.com/@azure/core-auth/-/core-auth-1.9.0.tgz#ac725b03fabe3c892371065ee9e2041bee0fd1ac"
integrity sha512-FPwHpZywuyasDSLMqJ6fhbOK3TqUdviZNF8OqRGA4W5Ewib2lEEZ+pBsYcBa88B2NGO/SEnYPGhyBqNlE8ilSw==
dependencies:
"@azure/abort-controller" "^2.0.0"
"@azure/core-util" "^1.11.0"
tslib "^2.6.2"
"@azure/core-client@^1.3.0", "@azure/core-client@^1.4.0", "@azure/core-client@^1.5.0", "@azure/core-client@^1.9.2":
version "1.9.2" version "1.9.2"
resolved "https://registry.yarnpkg.com/@azure/core-client/-/core-client-1.9.2.tgz#6fc69cee2816883ab6c5cdd653ee4f2ff9774f74" resolved "https://registry.yarnpkg.com/@azure/core-client/-/core-client-1.9.2.tgz#6fc69cee2816883ab6c5cdd653ee4f2ff9774f74"
integrity sha512-kRdry/rav3fUKHl/aDLd/pDLcB+4pOFwPPTVEExuMyaI5r+JBbMWqRbCY1pn5BniDaU3lRxO9eaQ1AmSMehl/w== integrity sha512-kRdry/rav3fUKHl/aDLd/pDLcB+4pOFwPPTVEExuMyaI5r+JBbMWqRbCY1pn5BniDaU3lRxO9eaQ1AmSMehl/w==
@@ -595,6 +604,20 @@
https-proxy-agent "^7.0.0" https-proxy-agent "^7.0.0"
tslib "^2.6.2" tslib "^2.6.2"
"@azure/core-rest-pipeline@^1.17.0":
version "1.18.2"
resolved "https://registry.yarnpkg.com/@azure/core-rest-pipeline/-/core-rest-pipeline-1.18.2.tgz#fa3a83b412d4b3e33edca30a71b1d5838306c075"
integrity sha512-IkTf/DWKyCklEtN/WYW3lqEsIaUDshlzWRlZNNwSYtFcCBQz++OtOjxNpm8rr1VcbMS6RpjybQa3u6B6nG0zNw==
dependencies:
"@azure/abort-controller" "^2.0.0"
"@azure/core-auth" "^1.8.0"
"@azure/core-tracing" "^1.0.1"
"@azure/core-util" "^1.11.0"
"@azure/logger" "^1.0.0"
http-proxy-agent "^7.0.0"
https-proxy-agent "^7.0.0"
tslib "^2.6.2"
"@azure/core-tracing@^1.0.0", "@azure/core-tracing@^1.0.1": "@azure/core-tracing@^1.0.0", "@azure/core-tracing@^1.0.1":
version "1.1.2" version "1.1.2"
resolved "https://registry.yarnpkg.com/@azure/core-tracing/-/core-tracing-1.1.2.tgz#065dab4e093fb61899988a1cdbc827d9ad90b4ee" resolved "https://registry.yarnpkg.com/@azure/core-tracing/-/core-tracing-1.1.2.tgz#065dab4e093fb61899988a1cdbc827d9ad90b4ee"
@@ -610,6 +633,14 @@
"@azure/abort-controller" "^2.0.0" "@azure/abort-controller" "^2.0.0"
tslib "^2.6.2" tslib "^2.6.2"
"@azure/core-util@^1.11.0":
version "1.11.0"
resolved "https://registry.yarnpkg.com/@azure/core-util/-/core-util-1.11.0.tgz#f530fc67e738aea872fbdd1cc8416e70219fada7"
integrity sha512-DxOSLua+NdpWoSqULhjDyAZTXFdP/LKkqtYuxxz1SCN289zk3OG8UOpnCQAz/tygyACBtWp/BoO72ptK7msY8g==
dependencies:
"@azure/abort-controller" "^2.0.0"
tslib "^2.6.2"
"@azure/identity@^3.4.1": "@azure/identity@^3.4.1":
version "3.4.2" version "3.4.2"
resolved "https://registry.yarnpkg.com/@azure/identity/-/identity-3.4.2.tgz#6b01724c9caac7cadab6b63c76584345bda8e2de" resolved "https://registry.yarnpkg.com/@azure/identity/-/identity-3.4.2.tgz#6b01724c9caac7cadab6b63c76584345bda8e2de"
@@ -630,6 +661,26 @@
stoppable "^1.1.0" stoppable "^1.1.0"
tslib "^2.2.0" tslib "^2.2.0"
"@azure/identity@^4.6.0":
version "4.6.0"
resolved "https://registry.yarnpkg.com/@azure/identity/-/identity-4.6.0.tgz#276957b59fed96cf48d5e50fc728c3c226e4f105"
integrity sha512-ANpO1iAvcZmpD4QY7/kaE/P2n66pRXsDp3nMUC6Ow3c9KfXOZF7qMU9VgqPw8m7adP7TVIbVyrCEmD9cth3KQQ==
dependencies:
"@azure/abort-controller" "^2.0.0"
"@azure/core-auth" "^1.9.0"
"@azure/core-client" "^1.9.2"
"@azure/core-rest-pipeline" "^1.17.0"
"@azure/core-tracing" "^1.0.0"
"@azure/core-util" "^1.11.0"
"@azure/logger" "^1.0.0"
"@azure/msal-browser" "^4.0.1"
"@azure/msal-node" "^2.15.0"
events "^3.0.0"
jws "^4.0.0"
open "^8.0.0"
stoppable "^1.1.0"
tslib "^2.2.0"
"@azure/keyvault-keys@^4.4.0": "@azure/keyvault-keys@^4.4.0":
version "4.8.0" version "4.8.0"
resolved "https://registry.yarnpkg.com/@azure/keyvault-keys/-/keyvault-keys-4.8.0.tgz#1513b3a187bb3a9a372b5980c593962fb793b2ad" resolved "https://registry.yarnpkg.com/@azure/keyvault-keys/-/keyvault-keys-4.8.0.tgz#1513b3a187bb3a9a372b5980c593962fb793b2ad"
@@ -661,11 +712,37 @@
dependencies: dependencies:
"@azure/msal-common" "14.10.0" "@azure/msal-common" "14.10.0"
"@azure/msal-browser@^4.0.1":
version "4.2.0"
resolved "https://registry.yarnpkg.com/@azure/msal-browser/-/msal-browser-4.2.0.tgz#3d817357cfb0e6aef68bb708df7ccce9fe14ca65"
integrity sha512-MXQjgAgjg/2VRKV+UPWHESoZPcue2ZvWKfpBLCyTUyixP+mhCl0q5D1+xDiwBGV3lru2poKZVZDQAOE40wKmWg==
dependencies:
"@azure/msal-common" "15.1.1"
"@azure/msal-common@14.10.0": "@azure/msal-common@14.10.0":
version "14.10.0" version "14.10.0"
resolved "https://registry.yarnpkg.com/@azure/msal-common/-/msal-common-14.10.0.tgz#215449726717b53d549953db77562cad6cb8421c" resolved "https://registry.yarnpkg.com/@azure/msal-common/-/msal-common-14.10.0.tgz#215449726717b53d549953db77562cad6cb8421c"
integrity sha512-Zk6DPDz7e1wPgLoLgAp0349Yay9RvcjPM5We/ehuenDNsz/t9QEFI7tRoHpp/e47I4p20XE3FiDlhKwAo3utDA== integrity sha512-Zk6DPDz7e1wPgLoLgAp0349Yay9RvcjPM5We/ehuenDNsz/t9QEFI7tRoHpp/e47I4p20XE3FiDlhKwAo3utDA==
"@azure/msal-common@14.16.0":
version "14.16.0"
resolved "https://registry.yarnpkg.com/@azure/msal-common/-/msal-common-14.16.0.tgz#f3470fcaec788dbe50859952cd499340bda23d7a"
integrity sha512-1KOZj9IpcDSwpNiQNjt0jDYZpQvNZay7QAEi/5DLubay40iGYtLzya/jbjRPLyOTZhEKyL1MzPuw2HqBCjceYA==
"@azure/msal-common@15.1.1":
version "15.1.1"
resolved "https://registry.yarnpkg.com/@azure/msal-common/-/msal-common-15.1.1.tgz#2bd9bef17857217f25b5885e7b2824bfd9c8edab"
integrity sha512-bvLWYq9fleAcTJ6H+hfkG91On6vI/UhGyOB7Z6r0Bsa+KTL3zPtigmGCOJgdxrEklOYD88X9SehexLDH/5NRKQ==
"@azure/msal-node@^2.15.0":
version "2.16.2"
resolved "https://registry.yarnpkg.com/@azure/msal-node/-/msal-node-2.16.2.tgz#3eb768d36883ea6f9a939c0b5b467b518e78fffc"
integrity sha512-An7l1hEr0w1HMMh1LU+rtDtqL7/jw74ORlc9Wnh06v7TU/xpG39/Zdr1ZJu3QpjUfKJ+E0/OXMW8DRSWTlh7qQ==
dependencies:
"@azure/msal-common" "14.16.0"
jsonwebtoken "^9.0.0"
uuid "^8.3.0"
"@azure/msal-node@^2.5.1": "@azure/msal-node@^2.5.1":
version "2.8.0" version "2.8.0"
resolved "https://registry.yarnpkg.com/@azure/msal-node/-/msal-node-2.8.0.tgz#ef6e4a76bcd0851f7b1240d94b00fe1f9a52d559" resolved "https://registry.yarnpkg.com/@azure/msal-node/-/msal-node-2.8.0.tgz#ef6e4a76bcd0851f7b1240d94b00fe1f9a52d559"