Skip to content

Commit f1fc249

Browse files
authored
fix: webauth no need to validate hostname on cli request (#752)
1 parent c23a669 commit f1fc249

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

app/port/webauth/WebauthController.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ import { genRSAKeys, decryptRSA } from '../../common/CryptoUtil';
3535
import { getBrowserTypeForWebauthn } from '../../common/UserUtil';
3636

3737
const LoginRequestRule = Type.Object({
38-
// cli 所在机器的 hostname
39-
hostname: Type.String({ minLength: 1, maxLength: 100 }),
38+
// cli 所在机器的 hostname,最新版本 npm cli 已经不会上报 hostname
39+
hostname: Type.Optional(Type.String({ minLength: 1, maxLength: 100 })),
4040
});
4141
type LoginRequest = Static<typeof LoginRequestRule>;
4242

test/port/webauth/webauthController.test.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ describe('test/port/webauth/webauthController.test.ts', () => {
2626
assert.equal(loginSessionId.length, 36);
2727
});
2828

29-
it('should check hostname', async () => {
29+
it('should hostname is optional', async () => {
3030
const res = await app.httpRequest()
3131
.post('/-/v1/login');
3232

33-
assert.equal(res.status, 422);
34-
assert.equal(res.body.error, "[INVALID_PARAM] must have required property 'hostname'");
33+
assert.equal(res.status, 200);
3534
});
3635
});
3736

0 commit comments

Comments
 (0)