az2aws 1.2.0 → 1.4.0
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/CHANGELOG.md +33 -0
- package/CONTRIBUTING.md +19 -18
- package/README.md +22 -2
- package/lib/awsConfig.js +5 -0
- package/lib/configureProfileAsync.js +2 -3
- package/lib/index.js +1 -1
- package/lib/login.js +64 -339
- package/lib/loginStates.js +333 -0
- package/package.json +12 -7
- package/.release-please-manifest.json +0 -3
- package/issue/issues.md +0 -729
- package/release-please-config.json +0 -8
- package/vitest.config.ts +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.4.0](https://github.com/kuma0128/az2aws/compare/v1.3.0...v1.4.0) (2026-02-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add GovCloud region warning ([#104](https://github.com/kuma0128/az2aws/issues/104)) ([1e169cc](https://github.com/kuma0128/az2aws/commit/1e169cc77c35a5453728f71952aa4201842c8430))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* honor http_proxy for browser and STS ([#92](https://github.com/kuma0128/az2aws/issues/92)) ([0e002ae](https://github.com/kuma0128/az2aws/commit/0e002ae362466cd9434bb364150bf54227738225))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Performance Improvements
|
|
17
|
+
|
|
18
|
+
* optimize keyboard input clearing with select + backspace ([#116](https://github.com/kuma0128/az2aws/issues/116)) ([84b4cfb](https://github.com/kuma0128/az2aws/commit/84b4cfbef32917a6f6d2f9ef56d5a13b09a91f3a))
|
|
19
|
+
* replace lodash with native array methods ([#115](https://github.com/kuma0128/az2aws/issues/115)) ([f61786f](https://github.com/kuma0128/az2aws/commit/f61786f0ab1f215d351fe3ddba15d22cfb048198))
|
|
20
|
+
|
|
21
|
+
## [1.3.0](https://github.com/kuma0128/az2aws/compare/v1.2.0...v1.3.0) (2026-01-27)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* Add Comprehensive Loginstate Tests and Implementation ([#110](https://github.com/kuma0128/az2aws/issues/110)) ([09fce50](https://github.com/kuma0128/az2aws/commit/09fce501050731e2b0e5063ef8d2d5e4076827a1))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* Apply Prettier formatting and add region logging to login functions ([#109](https://github.com/kuma0128/az2aws/issues/109)) ([26a5ef6](https://github.com/kuma0128/az2aws/commit/26a5ef636014f56ad77813f42e866a25b08be2f3))
|
|
32
|
+
* clarify session duration validation message ([#91](https://github.com/kuma0128/az2aws/issues/91)) ([22d87ec](https://github.com/kuma0128/az2aws/commit/22d87ec57318c6dc69d09e098d7e123d07df882e))
|
|
33
|
+
* correct typo 'occured' to 'occurred' in error message ([#86](https://github.com/kuma0128/az2aws/issues/86)) ([b0a75d2](https://github.com/kuma0128/az2aws/commit/b0a75d2c7cecaef7888d17a9880bcd63000713b8))
|
|
34
|
+
* enforce defaults for no-prompt role selection ([#90](https://github.com/kuma0128/az2aws/issues/90)) ([bea40f6](https://github.com/kuma0128/az2aws/commit/bea40f64a9dc6851b34a396fdd315752669c1d9d))
|
|
35
|
+
|
|
3
36
|
## [1.2.0](https://github.com/kuma0128/az2aws/compare/v1.1.3...v1.2.0) (2026-01-22)
|
|
4
37
|
|
|
5
38
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -49,10 +49,10 @@ mise use --global node@24
|
|
|
49
49
|
node -v
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
5.
|
|
52
|
+
5. Enable pnpm via corepack:
|
|
53
53
|
|
|
54
54
|
```sh
|
|
55
|
-
|
|
55
|
+
corepack enable
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
### Setup
|
|
@@ -67,32 +67,33 @@ cd az2aws
|
|
|
67
67
|
2. Install dependencies:
|
|
68
68
|
|
|
69
69
|
```sh
|
|
70
|
-
|
|
70
|
+
pnpm install
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
3. Start development mode:
|
|
74
74
|
|
|
75
75
|
```sh
|
|
76
|
-
|
|
76
|
+
pnpm start
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
Or build and run production mode:
|
|
80
80
|
|
|
81
81
|
```sh
|
|
82
|
-
|
|
82
|
+
pnpm build && node ./lib/index.js
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
### Available Scripts
|
|
86
86
|
|
|
87
87
|
| Script | Description |
|
|
88
88
|
|--------|-------------|
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
89
|
+
| `pnpm start` | Start development mode with hot reload |
|
|
90
|
+
| `pnpm build` | Build for production |
|
|
91
|
+
| `pnpm test` | Run unit tests |
|
|
92
|
+
| `pnpm test:coverage` | Run unit tests with coverage |
|
|
93
|
+
| `pnpm lint` | Run ESLint and formatting checks |
|
|
94
|
+
| `pnpm eslint` | Run ESLint |
|
|
95
|
+
| `pnpm prettier:check` | Check code formatting |
|
|
96
|
+
| `pnpm prettier:write` | Auto-fix code formatting |
|
|
96
97
|
|
|
97
98
|
## Development Workflow
|
|
98
99
|
|
|
@@ -107,7 +108,7 @@ git checkout -b fix/your-bug-fix
|
|
|
107
108
|
2. Make your changes and ensure tests pass:
|
|
108
109
|
|
|
109
110
|
```sh
|
|
110
|
-
|
|
111
|
+
pnpm test
|
|
111
112
|
```
|
|
112
113
|
|
|
113
114
|
3. Commit your changes following our [commit message guidelines](#commit-message-guidelines).
|
|
@@ -118,8 +119,8 @@ yarn test
|
|
|
118
119
|
|
|
119
120
|
### Before Submitting
|
|
120
121
|
|
|
121
|
-
- [ ] Run `
|
|
122
|
-
- [ ] Run `
|
|
122
|
+
- [ ] Run `pnpm test` and ensure all checks pass
|
|
123
|
+
- [ ] Run `pnpm build` to verify the build succeeds
|
|
123
124
|
- [ ] Update documentation if you changed any user-facing behavior
|
|
124
125
|
- [ ] Add tests for new functionality
|
|
125
126
|
|
|
@@ -164,13 +165,13 @@ This project uses ESLint and Prettier. Your code will be automatically checked.
|
|
|
164
165
|
|
|
165
166
|
```sh
|
|
166
167
|
# Check formatting
|
|
167
|
-
|
|
168
|
+
pnpm prettier:check
|
|
168
169
|
|
|
169
170
|
# Auto-fix formatting
|
|
170
|
-
|
|
171
|
+
pnpm prettier:write
|
|
171
172
|
|
|
172
173
|
# Run linter
|
|
173
|
-
|
|
174
|
+
pnpm eslint
|
|
174
175
|
```
|
|
175
176
|
|
|
176
177
|
### File Organization
|
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[](https://www.npmjs.org/package/az2aws)
|
|
2
|
-
[](https://www.npmjs.org/package/az2aws)
|
|
2
|
+
[](https://www.npmjs.org/package/az2aws)
|
|
3
3
|
[](https://github.com/kuma0128/az2aws/actions/workflows/main.yml)
|
|
4
4
|
[](https://codecov.io/gh/kuma0128/az2aws)
|
|
5
5
|
|
|
@@ -121,6 +121,10 @@ Set the `region` in your ~/.aws/config to use non-standard AWS partitions:
|
|
|
121
121
|
- **GovCloud**: us-gov-west-1, us-gov-east-1
|
|
122
122
|
- **China**: cn-north-1, cn-northwest-1
|
|
123
123
|
|
|
124
|
+
For GovCloud, make sure your AWS CLI default region is set to a GovCloud
|
|
125
|
+
region if you do not set a profile region; otherwise STS calls may target the
|
|
126
|
+
standard partition.
|
|
127
|
+
|
|
124
128
|
#### Stay Logged In
|
|
125
129
|
|
|
126
130
|
Enable "Stay logged in" during configuration to use `--no-prompt` without storing passwords:
|
|
@@ -136,6 +140,10 @@ You can set defaults via environment variables (use with `--no-prompt`):
|
|
|
136
140
|
- `AZURE_DEFAULT_USERNAME` / `AZURE_DEFAULT_PASSWORD` - Credentials
|
|
137
141
|
- `AZURE_DEFAULT_ROLE_ARN` / `AZURE_DEFAULT_DURATION_HOURS` - AWS role settings
|
|
138
142
|
|
|
143
|
+
When using `--no-prompt` with multiple available roles, you must set
|
|
144
|
+
`AZURE_DEFAULT_ROLE_ARN` (or configure `azure_default_role_arn`) so the CLI can
|
|
145
|
+
select a role without prompting.
|
|
146
|
+
|
|
139
147
|
To avoid storing passwords in bash history, use a leading space:
|
|
140
148
|
|
|
141
149
|
HISTCONTROL=ignoreboth
|
|
@@ -174,7 +182,19 @@ You'll be prompted for username, password, and MFA if required. After login, use
|
|
|
174
182
|
**Tips:**
|
|
175
183
|
- Set `AWS_PROFILE` env var instead of using `--profile`
|
|
176
184
|
- Use `--mode gui --disable-gpu` on VMs or if rendering fails
|
|
177
|
-
- Set `https_proxy` env var for corporate proxy
|
|
185
|
+
- Set `https_proxy` or `http_proxy` env var for corporate proxy
|
|
186
|
+
|
|
187
|
+
#### Troubleshooting
|
|
188
|
+
|
|
189
|
+
If you see device compliance errors (e.g., "Device UnSecured Or Non-Compliant"),
|
|
190
|
+
Try:
|
|
191
|
+
`--mode gui` and use your system Chrome via `BROWSER_CHROME_BIN`.
|
|
192
|
+
|
|
193
|
+
If you see "Unable to recognize page state!", Azure's login pages may have
|
|
194
|
+
changed. Try:
|
|
195
|
+
|
|
196
|
+
- `--mode gui` or `--mode debug`
|
|
197
|
+
- Filing an issue with the screenshot (`az2aws-unrecognized-state.png`) to help maintainers update selectors
|
|
178
198
|
|
|
179
199
|
## Automation
|
|
180
200
|
|
package/lib/awsConfig.js
CHANGED
|
@@ -47,6 +47,11 @@ exports.awsConfig = {
|
|
|
47
47
|
expirationDate = new Date(config[profileName].aws_expiration);
|
|
48
48
|
}
|
|
49
49
|
const timeDifference = expirationDate.getTime() - new Date().getTime();
|
|
50
|
+
// If expiration date is invalid (NaN), treat as expired for safety
|
|
51
|
+
if (isNaN(timeDifference)) {
|
|
52
|
+
debug("Invalid expiration date, treating as expired");
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
50
55
|
debug(`Remaining time till credential expiration: ${timeDifference / 1000}s, refresh due if time lower than: ${refreshLimitInMs / 1000}s`);
|
|
51
56
|
return timeDifference < refreshLimitInMs;
|
|
52
57
|
},
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.configureProfileAsync =
|
|
6
|
+
exports.configureProfileAsync = configureProfileAsync;
|
|
7
7
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
8
8
|
const awsConfig_1 = require("./awsConfig");
|
|
9
9
|
async function configureProfileAsync(profileName) {
|
|
@@ -53,7 +53,7 @@ async function configureProfileAsync(profileName) {
|
|
|
53
53
|
input = Number(input);
|
|
54
54
|
if (input > 0 && input <= 12)
|
|
55
55
|
return true;
|
|
56
|
-
return "Duration hours must be between
|
|
56
|
+
return "Duration hours must be between 1 and 12";
|
|
57
57
|
},
|
|
58
58
|
},
|
|
59
59
|
{
|
|
@@ -74,4 +74,3 @@ async function configureProfileAsync(profileName) {
|
|
|
74
74
|
});
|
|
75
75
|
console.log("Profile saved.");
|
|
76
76
|
}
|
|
77
|
-
exports.configureProfileAsync = configureProfileAsync;
|
package/lib/index.js
CHANGED
|
@@ -17,7 +17,7 @@ program
|
|
|
17
17
|
.option("-c, --configure", "Configure the profile")
|
|
18
18
|
.option("-m, --mode <mode>", "'cli' to hide the login page and perform the login through the CLI (default behavior), 'gui' to perform the login through the Azure GUI (more reliable but only works on GUI operating system), 'debug' to show the login page but perform the login through the CLI (useful to debug issues with the CLI login)")
|
|
19
19
|
.option("--no-sandbox", "Disable the Puppeteer sandbox (usually necessary on Linux)")
|
|
20
|
-
.option("--no-prompt", "Do not prompt for input and accept the default choice"
|
|
20
|
+
.option("--no-prompt", "Do not prompt for input and accept the default choice")
|
|
21
21
|
.option("--enable-chrome-network-service", "Enable Chromium's Network Service (needed when login provider redirects with 3XX)")
|
|
22
22
|
.option("--no-verify-ssl", "Disable SSL Peer Verification for connections to AWS")
|
|
23
23
|
.option("--enable-chrome-seamless-sso", "Enable Chromium's pass-through authentication with Azure Active Directory Seamless Single Sign-On")
|