@ahhaohho/auth-middleware 2.3.4 → 2.3.5
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/.github/workflows/publish.yml +32 -0
- package/package.json +1 -1
- package/src/utils/secretManager.js +20 -23
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup Node.js
|
|
18
|
+
uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version: '22'
|
|
21
|
+
registry-url: 'https://registry.npmjs.org'
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: npm ci
|
|
25
|
+
|
|
26
|
+
- name: Build
|
|
27
|
+
run: npm run build
|
|
28
|
+
|
|
29
|
+
- name: Publish
|
|
30
|
+
run: npm publish
|
|
31
|
+
env:
|
|
32
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/package.json
CHANGED
|
@@ -77,31 +77,28 @@ class SecretManager {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
const secret = JSON.parse(response.SecretString);
|
|
80
|
-
const currentKey =
|
|
81
|
-
|
|
82
|
-
//
|
|
83
|
-
let previousKey =
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
previousKey = prevCandidate;
|
|
98
|
-
console.log('[@ahhaohho/auth-middleware] Using AWSPREVIOUS version as fallback key');
|
|
99
|
-
}
|
|
80
|
+
const currentKey = resolveKeyByEnv(secret);
|
|
81
|
+
|
|
82
|
+
// 이전 키: AWSPREVIOUS에서 환경별 키 가져오기
|
|
83
|
+
let previousKey = null;
|
|
84
|
+
try {
|
|
85
|
+
const prevCommand = new GetSecretValueCommand({
|
|
86
|
+
SecretId: this.secretName,
|
|
87
|
+
VersionStage: 'AWSPREVIOUS'
|
|
88
|
+
});
|
|
89
|
+
const prevResponse = await this.client.send(prevCommand);
|
|
90
|
+
if (prevResponse.SecretString) {
|
|
91
|
+
const prevSecret = JSON.parse(prevResponse.SecretString);
|
|
92
|
+
const prevCandidate = resolveKeyByEnv(prevSecret);
|
|
93
|
+
// 이전 키가 현재 키와 다를 때만 사용
|
|
94
|
+
if (prevCandidate && prevCandidate !== currentKey) {
|
|
95
|
+
previousKey = prevCandidate;
|
|
96
|
+
console.log('[@ahhaohho/auth-middleware] Using AWSPREVIOUS version as fallback key');
|
|
100
97
|
}
|
|
101
|
-
} catch (prevError) {
|
|
102
|
-
// AWSPREVIOUS가 없을 수 있음 (첫 시크릿이거나 로테이션 미사용)
|
|
103
|
-
console.log('[@ahhaohho/auth-middleware] No AWSPREVIOUS version available');
|
|
104
98
|
}
|
|
99
|
+
} catch (prevError) {
|
|
100
|
+
// AWSPREVIOUS가 없을 수 있음 (첫 시크릿이거나 로테이션 미사용)
|
|
101
|
+
console.log('[@ahhaohho/auth-middleware] No AWSPREVIOUS version available');
|
|
105
102
|
}
|
|
106
103
|
|
|
107
104
|
const keys = {
|