rds_ssm_connect 1.8.2 → 1.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/connect.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  } from './configLoader.js'
15
15
 
16
16
  // Package info for version checking
17
- const packageJson = { name: 'rds_ssm_connect', version: '1.8.1' }
17
+ const packageJson = { name: 'rds_ssm_connect', version: '1.8.3' }
18
18
 
19
19
  const execAsync = promisify(exec)
20
20
 
@@ -28,8 +28,9 @@ const RETRY_CONFIG = {
28
28
  PORT_FORWARDING_MAX_RETRIES: 2,
29
29
  SSM_AGENT_READY_WAIT_MS: 10000,
30
30
  KEEPALIVE_INTERVAL_MS: 4 * 60 * 1000,
31
- AUTO_RECONNECT_MAX_RETRIES: 50,
31
+ AUTO_RECONNECT_MAX_RETRIES: 3,
32
32
  AUTO_RECONNECT_DELAY_MS: 3000,
33
+ CREDENTIAL_CHECK_TIMEOUT_MS: 60000,
33
34
  }
34
35
 
35
36
  // Version check configuration
@@ -170,6 +171,21 @@ async function sleep(ms) {
170
171
  return new Promise((resolve) => setTimeout(resolve, ms))
171
172
  }
172
173
 
174
+ // Pre-flight credential check. Uses a short timeout so that if aws-vault
175
+ // needs to open a browser for SSO re-auth (which blocks indefinitely), the
176
+ // command is killed before any browser tab appears.
177
+ async function checkCredentialsValid(profile, region) {
178
+ try {
179
+ await execAsync(
180
+ `aws-vault exec ${profile} -- aws sts get-caller-identity --region ${region}`,
181
+ { timeout: RETRY_CONFIG.CREDENTIAL_CHECK_TIMEOUT_MS },
182
+ )
183
+ return { valid: true }
184
+ } catch (_error) {
185
+ return { valid: false }
186
+ }
187
+ }
188
+
173
189
  // Keepalive: periodic TCP ping through the tunnel to prevent SSM idle timeout.
174
190
  // Each connection attempt generates traffic on the SSM WebSocket channel,
175
191
  // resetting the server-side idle timer (default 20 min).
@@ -712,6 +728,18 @@ async function connect(projectKey, profile, options = {}) {
712
728
 
713
729
  if (manualDisconnect) break
714
730
 
731
+ // Verify credentials are still valid before retrying.
732
+ // Avoids opening browser SSO tabs when the user is away.
733
+ emit('status', { message: 'Checking credentials...' })
734
+ const credCheck = await checkCredentialsValid(profile, region)
735
+ if (!credCheck.valid) {
736
+ emit('status', {
737
+ message:
738
+ 'AWS credentials expired. Please re-authenticate and reconnect.',
739
+ })
740
+ break
741
+ }
742
+
715
743
  // Re-discover infrastructure (bastion may have been replaced by ASG)
716
744
  emit('status', { message: 'Finding bastion instance...' })
717
745
  currentInstanceId = await findBastionInstance(profile, region)
@@ -744,6 +772,16 @@ async function connect(projectKey, profile, options = {}) {
744
772
 
745
773
  if (manualDisconnect) break
746
774
 
775
+ // Verify credentials before retrying (same check as happy path)
776
+ const credCheckOnError = await checkCredentialsValid(profile, region)
777
+ if (!credCheckOnError.valid) {
778
+ emit('status', {
779
+ message:
780
+ 'AWS credentials expired. Please re-authenticate and reconnect.',
781
+ })
782
+ break
783
+ }
784
+
747
785
  try {
748
786
  currentInstanceId = await findBastionInstance(profile, region)
749
787
  currentRdsEndpoint = await getRdsEndpoint(profile, projectConfig)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rds_ssm_connect",
3
- "version": "1.8.2",
3
+ "version": "1.8.4",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,28 +10,28 @@
10
10
  "@aws-sdk/client-ec2": "^3.985.0",
11
11
  "@aws-sdk/client-rds": "^3.985.0",
12
12
  "@aws-sdk/client-ssm": "^3.985.0",
13
- "fast-xml-parser": "^5.3.4",
13
+ "fast-xml-parser": "^5.3.6",
14
14
  "glob": "^13.0.0",
15
15
  "inquirer": "^13.2.2",
16
16
  "rimraf": "^6.1.2"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@biomejs/biome": "^2.3.14",
20
- "@eslint/js": "^9.39.2",
20
+ "@eslint/js": "^10.0.0",
21
21
  "@sveltejs/vite-plugin-svelte": "^5.1.1",
22
22
  "@tauri-apps/api": "^2.10.1",
23
23
  "@tauri-apps/cli": "^2.10.0",
24
24
  "@yao-pkg/pkg": "^6.12.0",
25
25
  "canvas": "^3.2.1",
26
26
  "esbuild": "^0.27.3",
27
- "eslint": "^9.39.2",
28
- "eslint-plugin-svelte": "^3.14.0",
27
+ "eslint": "^10.0.2",
28
+ "eslint-plugin-svelte": "^3.15.0",
29
29
  "globals": "^17.3.0",
30
30
  "svelte": "^5.50.0",
31
31
  "vite": "^6.4.1"
32
32
  },
33
33
  "overrides": {
34
- "fast-xml-parser": "^5.3.4"
34
+ "fast-xml-parser": "^5.3.6"
35
35
  },
36
36
  "bin": {
37
37
  "rds_ssm_connect": "./connect.js"
@@ -3050,7 +3050,7 @@ checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
3050
3050
 
3051
3051
  [[package]]
3052
3052
  name = "rds-ssm-connect"
3053
- version = "1.8.2"
3053
+ version = "1.8.3"
3054
3054
  dependencies = [
3055
3055
  "reqwest 0.12.28",
3056
3056
  "semver",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "rds-ssm-connect"
3
- version = "1.8.2"
3
+ version = "1.8.3"
4
4
  description = "Secure RDS connections through AWS SSM"
5
5
  authors = ["Iaroslav Pyrogov"]
6
6
  edition = "2024"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://schema.tauri.app/config/2",
3
3
  "productName": "RDS SSM Connect",
4
- "version": "1.8.2",
4
+ "version": "1.8.3",
5
5
  "identifier": "com.rds-ssm-connect.desktop",
6
6
  "build": {
7
7
  "beforeDevCommand": "npm run dev:vite",
@@ -180,6 +180,8 @@ describe('Retry Configuration', () => {
180
180
  BASTION_WAIT_RETRY_DELAY_MS: 15000,
181
181
  PORT_FORWARDING_MAX_RETRIES: 2,
182
182
  SSM_AGENT_READY_WAIT_MS: 10000,
183
+ AUTO_RECONNECT_MAX_RETRIES: 3,
184
+ CREDENTIAL_CHECK_TIMEOUT_MS: 60000,
183
185
  }
184
186
 
185
187
  assert.ok(
@@ -198,5 +200,14 @@ describe('Retry Configuration', () => {
198
200
  RETRY_CONFIG.SSM_AGENT_READY_WAIT_MS > 0,
199
201
  'SSM wait should be positive',
200
202
  )
203
+ assert.ok(
204
+ RETRY_CONFIG.AUTO_RECONNECT_MAX_RETRIES > 0 &&
205
+ RETRY_CONFIG.AUTO_RECONNECT_MAX_RETRIES <= 10,
206
+ 'Auto-reconnect retries should be between 1 and 10',
207
+ )
208
+ assert.ok(
209
+ RETRY_CONFIG.CREDENTIAL_CHECK_TIMEOUT_MS >= 5000,
210
+ 'Credential check timeout should be at least 5 seconds',
211
+ )
201
212
  })
202
213
  })