Skip to content

Commit

Permalink
Merge branch 'devel' into CB-5234-added-aws-auth-in-jwt
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisSinelnikov authored Oct 11, 2024
2 parents 616305d + c6626f4 commit a28e939
Show file tree
Hide file tree
Showing 71 changed files with 2,984 additions and 3,000 deletions.
7 changes: 4 additions & 3 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ currently being supported with security updates.
| ------- | --------- |
| 22.x | yes |
| 23.x | yes |
| 24.x | yes |

## Reporting a Vulnerability

Please report (suspected) security vulnerabilities to [email protected].
You will receive a response from us within 48 hours.
If the issue is confirmed, we will release a patch as soon as possible depending on complexity but historically within a few days.
Please report (suspected) security vulnerabilities to [email protected].
You will receive a response from us within 48 hours.
If the issue is confirmed, we will release a patch as soon as possible, depending on complexity, but historically, within a few days.
24 changes: 2 additions & 22 deletions config/GlobalConfiguration/.dbeaver/data-sources.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,4 @@
{
"folders": {},
"connections": {
"postgresql-template-1": {
"provider": "postgresql",
"driver": "postgres-jdbc",
"name": "PostgreSQL (Template)",
"save-password": false,
"show-system-objects": false,
"read-only": true,
"template": true,
"configuration": {
"host": "localhost",
"port": "5432",
"database": "postgres",
"url": "jdbc:postgresql://localhost:5432/postgres",
"type": "dev",
"provider-properties": {
"@dbeaver-show-non-default-db@": "false"
}
}
}
}
"folders": {},
"connections": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public Gson getGson() {
return getGsonBuilder().create();
}

@NotNull
protected abstract GsonBuilder getGsonBuilder();

public abstract T getServerConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.InstanceCreator;
import com.google.gson.Strictness;
import io.cloudbeaver.model.WebConnectionConfig;
import io.cloudbeaver.model.WebNetworkHandlerConfigInput;
import io.cloudbeaver.model.WebPropertyInfo;
Expand Down Expand Up @@ -294,7 +295,7 @@ public static void saveAuthProperties(
// Make new Gson parser with type adapters to deserialize into existing credentials
InstanceCreator<DBAAuthCredentials> credTypeAdapter = type -> credentials;
Gson credGson = new GsonBuilder()
.setLenient()
.setStrictness(Strictness.LENIENT)
.registerTypeAdapter(credentials.getClass(), credTypeAdapter)
.create();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
*/
package io.cloudbeaver.server;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.InstanceCreator;
import com.google.gson.*;
import io.cloudbeaver.model.app.BaseServerConfigurationController;
import io.cloudbeaver.model.app.BaseWebApplication;
import io.cloudbeaver.model.config.CBAppConfig;
Expand Down Expand Up @@ -326,6 +324,7 @@ public Map<String, Object> readConfigurationFile(Path path) throws DBException {
}
}

@NotNull
protected GsonBuilder getGsonBuilder() {
// Stupid way to populate existing objects but ok google (https://github.com/google/gson/issues/431)
InstanceCreator<CBAppConfig> appConfigCreator = type -> appConfiguration;
Expand All @@ -336,7 +335,8 @@ protected GsonBuilder getGsonBuilder() {
InstanceCreator<PasswordPolicyConfiguration> smPasswordPoliceConfigCreator =
type -> securityManagerConfiguration.getPasswordPolicyConfiguration();
return new GsonBuilder()
.setLenient()
.setStrictness(Strictness.LENIENT)
.setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE)
.registerTypeAdapter(getServerConfiguration().getClass(), serverConfigCreator)
.registerTypeAdapter(CBAppConfig.class, appConfigCreator)
.registerTypeAdapter(DataSourceNavigatorSettings.class, navSettingsCreator)
Expand Down Expand Up @@ -372,7 +372,7 @@ private synchronized void writeRuntimeConfig(Path runtimeConfigPath, Map<String,

try (Writer out = new OutputStreamWriter(Files.newOutputStream(runtimeConfigPath), StandardCharsets.UTF_8)) {
Gson gson = new GsonBuilder()
.setLenient()
.setStrictness(Strictness.LENIENT)
.setPrettyPrinting()
.create();
gson.toJson(configurationProperties, out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ private void savePasswordPolicyConfig(Map<String, Object> originServerConfig, Ma
}
}

@NotNull
@Override
protected GsonBuilder getGsonBuilder() {
GsonBuilder gsonBuilder = super.getGsonBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.Strictness;
import io.cloudbeaver.auth.provider.local.LocalAuthProviderConstants;
import io.cloudbeaver.model.app.WebApplication;
import io.cloudbeaver.model.config.WebDatabaseConfig;
Expand Down Expand Up @@ -301,7 +302,9 @@ CBDatabaseInitialData getInitialData() throws DBException {
initialDataPath = WebAppUtils.getRelativePath(
databaseConfiguration.getInitialDataConfiguration(), application.getHomeDirectory());
try (Reader reader = new InputStreamReader(new FileInputStream(initialDataPath), StandardCharsets.UTF_8)) {
Gson gson = new GsonBuilder().setLenient().create();
Gson gson = new GsonBuilder()
.setStrictness(Strictness.LENIENT)
.create();
return gson.fromJson(reader, CBDatabaseInitialData.class);
} catch (Exception e) {
throw new DBException("Error loading initial data configuration", e);
Expand Down
2 changes: 1 addition & 1 deletion server/drivers/db2-jt400/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<dependency>
<groupId>net.sf.jt400</groupId>
<artifactId>jt400</artifactId>
<version>10.5</version>
<version>20.0.7</version>
</dependency>
</dependencies>

Expand Down
4 changes: 4 additions & 0 deletions server/drivers/mysql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
<artifactId>mysql-connector-j</artifactId>
<version>8.2.0</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</dependency>
</dependencies>

</project>
7 changes: 6 additions & 1 deletion server/drivers/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.cloudbeaver</groupId>
<parent>
<groupId>io.cloudbeaver</groupId>
<artifactId>cloudbeaver</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<artifactId>drivers</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
<id>full-build</id>
<activation><property><name>!plain-api-server</name></property></activation>
<modules>
<module>test</module>
<module>drivers</module>
<!-- Products -->
<module>product</module>
<module>test</module>
</modules>
</profile>
</profiles>
Expand Down
2 changes: 1 addition & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@testing-library/user-event": "^14",
"@types/react": "^18",
"@types/react-dom": "^18",
"concurrently": "^8",
"concurrently": "^9",
"husky": "^9",
"lerna": "^5",
"mobx": "^6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
}

.dialogBodyContent {
composes: theme-typography--body1 from global;
flex: 1;
letter-spacing: normal;
position: relative;
display: flex;
flex-direction: column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
}

.headerTitle {
composes: theme-typography--headline6 from global;
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ import { ErrorModel, type IErrorInfo } from './ErrorModel.js';

function DisplayErrorInfo({ error }: { error: IErrorInfo }) {
const styles = useS(style);
const translate = useTranslate();

return (
<>
<div className={s(styles, { property: true })}>
{error.isHtml ? <Iframe srcDoc={error.message} /> : <div className={s(styles, { message: true })}>{error.message}</div>}
{error.isHtml ? <Iframe srcDoc={error.message} /> : <div className={s(styles, { message: true })}>{translate(error.message)}</div>}
</div>
{error.stackTrace && (
<div className={s(styles, { property: true })}>
Expand Down
2 changes: 1 addition & 1 deletion webapp/packages/core-blocks/src/FormControls/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const Filter = observer<ControlledProps | ObjectsProps<any, any>>(functio
autoComplete="off"
className={s(styles, { inputField: true })}
placeholder={placeholder}
disabled={disabled}
readOnly={disabled}
name={name}
value={value}
onChange={handleChange}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@
align-items: center;
justify-content: center;
}

.input[disabled] + .iconContainer {
cursor: auto;
opacity: 0.8;
}
.input:not(:only-child) {
padding-right: 32px !important;
Expand Down
7 changes: 7 additions & 0 deletions webapp/packages/core-blocks/src/InfoItem.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@
align-items: center;
flex: 0 0 auto;
}

.iconOrImage {
width: 24px;
height: 24px;
margin-right: 16px;

&.compact {
width: 18px;
height: 18px;
margin-right: 8px;
}
}
5 changes: 3 additions & 2 deletions webapp/packages/core-blocks/src/InfoItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ import { useS } from './useS.js';
export interface IInfoItem {
info: TLocalizationToken;
icon?: string;
compact?: boolean;
}

interface Props extends IInfoItem {
className?: string;
}

export const InfoItem = observer<Props>(function InfoItem({ info, icon = '/icons/info_icon.svg', className }) {
export const InfoItem = observer<Props>(function InfoItem({ info, compact, icon = '/icons/info_icon.svg', className }) {
const styles = useS(style);

const translate = useTranslate();
return (
<div className={s(styles, { infoItem: true }, className)}>
<IconOrImage className={s(styles, { iconOrImage: true })} icon={icon} />
<IconOrImage className={s(styles, { iconOrImage: true, compact })} icon={icon} />
{translate(info)}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ export const RenderField = observer<RenderFieldProps>(function RenderField({
placeholder={passwordSavedMessage}
name={property.id!}
value={value}
disabled={disabled}
readOnly={readOnly}
readOnly={readOnly || disabled}
className={className}
>
{property.displayName ?? ''}
Expand All @@ -243,8 +242,7 @@ export const RenderField = observer<RenderFieldProps>(function RenderField({
autoHide={autoHide}
description={property.hint}
placeholder={passwordSavedMessage}
disabled={disabled}
readOnly={readOnly}
readOnly={readOnly || disabled}
autoComplete={RESERVED_KEYWORDS.includes(autofillToken) ? autofillToken : `${autofillToken} ${property.id}`}
className={className}
canShowPassword={canShowPassword}
Expand All @@ -266,8 +264,7 @@ export const RenderField = observer<RenderFieldProps>(function RenderField({
defaultValue={defaultValue}
description={property.hint}
placeholder={passwordSavedMessage}
disabled={disabled}
readOnly={readOnly}
readOnly={readOnly || disabled}
autoComplete={RESERVED_KEYWORDS.includes(autofillToken) ? autofillToken : `${autofillToken} ${property.id}`}
className={className}
canShowPassword={canShowPassword}
Expand Down
5 changes: 4 additions & 1 deletion webapp/packages/core-blocks/src/StatusMessage.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
.statusMessage {
overflow: hidden;
composes: theme-typography--caption from global;
height: 24px;
display: flex;
align-items: center;
gap: 8px;
}

.statusMessageExtended {
height: 24px;
}
.iconOrImage {
height: 24px;
width: 24px;
Expand Down
16 changes: 12 additions & 4 deletions webapp/packages/core-blocks/src/StatusMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,18 @@ interface Props {
type?: ENotificationType | null;
exception?: Error | null;
className?: string;
multipleRows?: boolean;
onShowDetails?: () => void;
}

export const StatusMessage = observer<Props>(function StatusMessage({ type, message, exception = null, className, onShowDetails }) {
export const StatusMessage = observer<Props>(function StatusMessage({
type,
multipleRows = false,
message,
exception = null,
className,
onShowDetails,
}) {
const styles = useS(style);
const translate = useTranslate();
const errorDetails = useErrorDetails(exception);
Expand All @@ -51,13 +59,13 @@ export const StatusMessage = observer<Props>(function StatusMessage({ type, mess
}

return (
<div className={s(styles, { statusMessage: true }, className)}>
<div className={s(styles, { statusMessage: true, statusMessageExtended: !multipleRows }, className)}>
{message && (
<>
<IconOrImage className={s(styles, { iconOrImage: true })} icon={icon} />
<div className={s(styles, { message: true })} title={message}>
<div className={s(styles, { message: !multipleRows })} title={message}>
{onShowDetails ? (
<Link className={s(styles, { link: true })} onClick={onShowDetails}>
<Link className={s(styles, { link: !multipleRows })} onClick={onShowDetails}>
{message}
</Link>
) : (
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-blocks/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export * from './CommonDialog/CommonDialog/CommonDialogFooter.js';
export * from './CommonDialog/CommonDialog/CommonDialogHeader.js';
export * from './CommonDialog/CommonDialog/CommonDialogWrapper.js';
export * from './CommonDialog/ConfirmationDialog.js';
export { default as ConfirmationDialogStyles } from './CommonDialog/ConfirmationDialog.module.css';
export * from './CommonDialog/ConfirmationDialogDelete.js';
export * from './CommonDialog/RenameDialog.js';
export * from './CommonDialog/DialogsPortal.js';
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-connections/src/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ export default [

['core_connections_settings_disable', 'Disable'],
['core_connections_settings_disable_description', 'Disable the ability to create new connections'],
['connections_templates_deprecated_message', 'Template connections are deprecated and will be removed in future releases'],
];
1 change: 1 addition & 0 deletions webapp/packages/core-connections/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,5 @@ export default [

['core_connections_settings_disable', 'Disable'],
['core_connections_settings_disable_description', 'Disable the ability to create new connections'],
['connections_templates_deprecated_message', 'Template connections are deprecated and will be removed in future releases'],
];
1 change: 1 addition & 0 deletions webapp/packages/core-connections/src/locales/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,5 @@ export default [

['core_connections_settings_disable', 'Disable'],
['core_connections_settings_disable_description', 'Disable the ability to create new connections'],
['connections_templates_deprecated_message', 'Template connections are deprecated and will be removed in future releases'],
];
1 change: 1 addition & 0 deletions webapp/packages/core-connections/src/locales/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,5 @@ export default [

['core_connections_settings_disable', 'Disable'],
['core_connections_settings_disable_description', 'Disable the ability to create new connections'],
['connections_templates_deprecated_message', 'Template connections are deprecated and will be removed in future releases'],
];
1 change: 1 addition & 0 deletions webapp/packages/core-connections/src/locales/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,5 @@ export default [

['core_connections_settings_disable', 'Отключить'],
['core_connections_settings_disable_description', 'Отключить возможность создания новых подключений'],
['connections_templates_deprecated_message', 'Шаблоны подключений больше не поддерживаются и будут удалены в будущих релизах'],
];
Loading

0 comments on commit a28e939

Please sign in to comment.