Skip to content
Merged
Show file tree
Hide file tree
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
19 changes: 0 additions & 19 deletions frontend/src/app/services/connections.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ import { ConnectionType, DBtype } from '../models/connection';
import { AccessLevel } from '../models/user';
import { CedarPermissionService } from './cedar-permission.service';
import { ConnectionsService } from './connections.service';
import { HostedDatabaseService } from './hosted-database.service';
import { MasterPasswordService } from './master-password.service';
import { NotificationsService } from './notifications.service';
import { UserService } from './user.service';
import { UsersService } from './users.service';

describe('ConnectionsService', () => {
Expand All @@ -26,8 +24,6 @@ describe('ConnectionsService', () => {
let mockCanI: ReturnType<typeof vi.fn>;
let mockCanIAny: ReturnType<typeof vi.fn>;
let mockPermissions: Partial<CedarPermissionService>;
let fakeHostedDatabaseService;
let fakeUserService;

const connectionCredsApp = {
title: 'Test connection via SSH tunnel to mySQL',
Expand Down Expand Up @@ -119,13 +115,6 @@ describe('ConnectionsService', () => {
canIAny: mockCanIAny,
ready: signal(false).asReadonly(),
};
fakeHostedDatabaseService = {
listHostedDatabases: vi.fn().mockResolvedValue([]),
};
fakeUserService = {
cast: of({ company: { id: 'test-company-id' } }),
};

TestBed.configureTestingModule({
imports: [MatSnackBarModule, MatDialogModule],
providers: [
Expand All @@ -149,14 +138,6 @@ describe('ConnectionsService', () => {
provide: CedarPermissionService,
useValue: mockPermissions,
},
{
provide: HostedDatabaseService,
useValue: fakeHostedDatabaseService,
},
{
provide: UserService,
useValue: fakeUserService,
},
],
});

Expand Down
45 changes: 7 additions & 38 deletions frontend/src/app/services/connections.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { NavigationEnd, Router } from '@angular/router';
import { IColorConfig, NgxThemeService } from '@brumeilde/ngx-theme';
import { BehaviorSubject, EMPTY, firstValueFrom, throwError } from 'rxjs';
import { BehaviorSubject, EMPTY, throwError } from 'rxjs';
import { catchError, filter, map } from 'rxjs/operators';
import { environment } from 'src/environments/environment';
import { AlertActionType, AlertType } from '../models/alert';
import { Connection, ConnectionSettings, ConnectionType, DBtype } from '../models/connection';
import { AccessLevel } from '../models/user';
import { CedarPermissionService } from './cedar-permission.service';
import { HostedDatabaseService } from './hosted-database.service';
import { MasterPasswordService } from './master-password.service';
import { NotificationsService } from './notifications.service';
import { UserService } from './user.service';
import { UsersService } from './users.service';

interface LogParams {
Expand Down Expand Up @@ -73,8 +72,6 @@ export class ConnectionsService {
public defaultDisplayTable: string;
public ownConnections: Connection[] = null;
public testConnections: Connection[] = null;
public isHostedConnection: boolean = false;
private hostedDatabaseHostnames: Set<string> = new Set();

private connectionNameSubject: BehaviorSubject<string> = new BehaviorSubject<string>('Rocketadmin');
private connectionSigningKeySubject: BehaviorSubject<string> = new BehaviorSubject<string>(null);
Expand All @@ -94,8 +91,6 @@ export class ConnectionsService {
private _usersService: UsersService,
private _permissions: CedarPermissionService,
public _themeService: NgxThemeService<IColorConfig<Palettes, Colors>>,
private _hostedDatabaseService: HostedDatabaseService,
private _userService: UserService,
) {
this.connection = { ...this.connectionInitialState };
this.router = router;
Expand Down Expand Up @@ -145,6 +140,11 @@ export class ConnectionsService {
return this.currentPage;
}

get isHostedConnection(): boolean {
const host = this.connection?.host;
return !!environment.saas && !!host && host.endsWith('.db.rocketadmin.com');
}

canEditConnection() {
return this._permissions.canI('connection:edit', 'Connection', this.connectionID)();
}
Expand Down Expand Up @@ -181,7 +181,6 @@ export class ConnectionsService {

setConnectionInfo(id: string) {
this.defaultDisplayTable = null;
this.isHostedConnection = false;
if (id) {
this.fetchConnection(id).subscribe((res) => {
this.connection = res.connection;
Expand Down Expand Up @@ -219,7 +218,6 @@ export class ConnectionsService {
},
});
}
this.checkIfHostedConnection(res.connection.host);
});
} else {
this.connection = { ...this.connectionInitialState };
Expand All @@ -237,9 +235,6 @@ export class ConnectionsService {
},
});
}

console.log('this.defaultDisplayTable');
console.log(this.defaultDisplayTable);
}

isPermitted(accessLevel: AccessLevel) {
Expand Down Expand Up @@ -610,30 +605,4 @@ export class ConnectionsService {
}),
);
}

private async checkIfHostedConnection(connectionHost: string) {
if (!connectionHost) {
this.isHostedConnection = false;
return;
}
if (this.hostedDatabaseHostnames.size === 0) {
await this.loadHostedDatabaseHostnames();
}
this.isHostedConnection = this.hostedDatabaseHostnames.has(connectionHost);
}

private async loadHostedDatabaseHostnames() {
try {
const user = await firstValueFrom(this._userService.cast.pipe(filter((u) => !!u?.company?.id)));
const databases = await this._hostedDatabaseService.listHostedDatabases(user.company.id);
this.hostedDatabaseHostnames.clear();
if (databases) {
for (const db of databases) {
this.hostedDatabaseHostnames.add(db.hostname);
}
}
} catch {
// Silently fail - non-hosted path will be used
}
}
}
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
"pnpm": {
"overrides": {
"cipher-base": "1.0.7",
"tar-fs": "1.16.6"
"tar-fs": "1.16.6",
"ajv@>=7.0.0-alpha.0 <8.18.0": ">=8.18.0",
"picomatch@>=4.0.0 <4.0.4": ">=4.0.4",
"path-to-regexp@>=8.0.0 <8.4.0": ">=8.4.0",
"lodash@>=4.0.0 <=4.17.23": ">=4.18.0",
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

The lodash override is duplicated: lodash@<=4.17.23 already covers the lodash@>=4.0.0 <=4.17.23 selector, so one of these entries is redundant and makes the override list harder to maintain. Remove the duplicate selector to keep overrides minimal and unambiguous.

Suggested change
"lodash@>=4.0.0 <=4.17.23": ">=4.18.0",

Copilot uses AI. Check for mistakes.
"lodash@<=4.17.23": ">=4.18.0",
Comment on lines +29 to +30
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Redundant lodash override — second range subsumes the first.

lodash@<=4.17.23 already covers every version matched by lodash@>=4.0.0 <=4.17.23, so one of the two entries is dead. Keep just the broader rule:

Proposed cleanup
-			"lodash@>=4.0.0 <=4.17.23": ">=4.18.0",
 			"lodash@<=4.17.23": ">=4.18.0",

Also worth double-checking that forcing lodash >=4.18.0 is safe for every transitive consumer — 4.18.0 tightened prototype-pollution guards in _.unset/_.omit so calls that previously returned true now return false, which can break code relying on the old behavior.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"lodash@>=4.0.0 <=4.17.23": ">=4.18.0",
"lodash@<=4.17.23": ">=4.18.0",
"lodash@<=4.17.23": ">=4.18.0",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` around lines 29 - 30, Remove the redundant override entry for
"lodash@>=4.0.0 <=4.17.23" and keep the broader "lodash@<=4.17.23": ">=4.18.0"
rule in package.json so only one override remains; after making that change, run
dependency resolution (e.g., npm/yarn install or audit) and verify that forcing
lodash >=4.18.0 is safe for all transitive consumers (inspect callers of
_.unset/_.omit and run tests) to avoid behavioral regressions.

"@nestjs/core@<=11.1.17": ">=11.1.18"
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

Several new audit overrides use open-ended ranges (e.g. ">=8.18.0", ">=4.18.0", ">=11.1.18"). Unlike the existing pinned overrides (cipher-base, tar-fs), these ranges can unexpectedly float to newer major versions on the next lockfile refresh (or in consumers that don’t use the lockfile), potentially introducing breaking changes. Prefer pinning to a specific patched version or at least constraining to the intended major line (e.g. ^8.18.0, ^11.1.18).

Suggested change
"@nestjs/core@<=11.1.17": ">=11.1.18"
"@nestjs/core@<=11.1.17": "11.1.18"

Copilot uses AI. Check for mistakes.
},
"packageExtensions": {
"ibm_db": {
Expand Down
Loading
Loading