mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 16:28:31 +00:00
* fix: make integration credentials write-only in the API The SMTP password and Slack bot token were returned in plain text by the integration API and broadcast to every collaborator over the websocket. * fix: record integration config changes in the undo log The exclude list used sensitive_fields, which for SMTP covers every field, so undoing an SMTP integration update restored nothing. * fix: require the SMTP password when the connection target changes Keeping the stored password while changing host, port or use_tls let a user redirect it to a server of their choosing, or downgrade the connection so it crossed the wire in the clear. * fix: refresh integration state from the update response The has_password and has_token flags are derived server side and nothing else refreshes them for the user who made the change. * feat: keep the saved SMTP password when it is not retyped The API no longer returns the password, so the form must distinguish an untouched field from a deliberate clear. * feat: keep the saved Slack bot token when it is not retyped Also mask the input, which rendered a bearer credential in plain text. * feat: explain why an integration credential must be re-entered * chore: add changelog entry for write-only integration secrets * test: cover write-only integration secrets end to end Unit tests on either side cannot see the seam between the form omitting an untouched credential and the backend reading an omitted one as keep. * fix: correct Slack integration copy and defaults for write-only tokens The summary read the token itself, so a configured bot showed as not configured, and the create warning told users the token could be read back through the API. * fix: keep every sensitive field out of the integration action log Narrowing the exclude list put the SMTP host into a replayable log while the credential stayed out, so a recorded target change could be replayed onto a password supplied later by someone else. It also wrote the AI integration's provider API keys into the action and audit logs. * fix: keep integration secrets required when there is nothing to keep Making every secret optional so an update need not retype it also made the Slack token optional on create, where no stored value can be kept. * fix: never use the instance SMTP account for an integration Django's SMTP backend replaces a None username or password with the instance's own. * fix: read has_token when checking a Slack bot in button field actions * fix: list writable credentials in the integration request schemas Also keep the blank error code for an empty token on create. * docs: correct integration secret comments and changelog * style: format button field action list spec * fix: validate integration updates as partial Keeps secrets required on create so the schema matches the server, and drops the None stripping and view-level secret check it made redundant. * docs: cross-reference the two secret_field_dependencies * docs: describe the write-only contract of integration secrets The copy stops a base serializer's extra_kwargs leaking into the type's shared dict, which made name optional on the create serializer. * docs: move integration secret reasoning into docstrings * fix: name the credential generically in the retype message * test: select the SMTP password input by type * test: expect the credential wording in the retype e2e * fix: document integration updates as partial The update validates with partial=True, but its per-type schema components still listed token and host as required. * fix: let undo restore non-credential SMTP settings Only secrets and the targets they protect stay out of the action log, so an SMTP username change can be undone. Types without secrets still exclude every sensitive field. * docs: point sensitive_fields readers to secret_fields sensitive_fields does not hide a field from API responses, so new integration credentials need secret_fields too.
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import { getClient } from "../../client";
|
|
import { Builder } from "./builder";
|
|
|
|
export class Integration {
|
|
constructor(
|
|
public id: number,
|
|
public type: string,
|
|
public builder: Builder
|
|
) {}
|
|
}
|
|
|
|
export async function createLocalBaserowIntegration(
|
|
builder: Builder,
|
|
name = "Local Baserow"
|
|
): Promise<Integration> {
|
|
const response: any = await getClient(builder.workspace.user).post(
|
|
`application/${builder.id}/integrations/`,
|
|
{ type: "local_baserow", name }
|
|
);
|
|
return new Integration(response.data.id, response.data.type, builder);
|
|
}
|
|
|
|
/**
|
|
* An SMTP integration on the builder. The password is write-only: the API
|
|
* never returns it, so a test that needs to know it has to remember what it
|
|
* sent here.
|
|
*/
|
|
export async function createSMTPIntegration(
|
|
builder: Builder,
|
|
options: { name?: string; host?: string; password: string }
|
|
): Promise<Integration> {
|
|
const response: any = await getClient(builder.workspace.user).post(
|
|
`application/${builder.id}/integrations/`,
|
|
{
|
|
type: "smtp",
|
|
name: options.name ?? "Mailer",
|
|
host: options.host ?? "smtp.example.com",
|
|
port: 587,
|
|
use_tls: true,
|
|
username: "mailer",
|
|
password: options.password,
|
|
}
|
|
);
|
|
return new Integration(response.data.id, response.data.type, builder);
|
|
}
|
|
|
|
export async function listIntegrations(builder: Builder): Promise<any[]> {
|
|
const response: any = await getClient(builder.workspace.user).get(
|
|
`application/${builder.id}/integrations/`
|
|
);
|
|
return response.data;
|
|
}
|