feat: update version to 1.0.40 and add rejectUnauthorized option for HTTPS agent
This commit is contained in:
parent
ca6cd330aa
commit
b78ae3a520
5 changed files with 6 additions and 15 deletions
10
README.md
10
README.md
|
|
@ -159,11 +159,6 @@ const client = new LhispOauthClient({
|
||||||
await client.get({ path: "/status" });
|
await client.get({ path: "/status" });
|
||||||
```
|
```
|
||||||
|
|
||||||
### Observações de segurança
|
|
||||||
|
|
||||||
- O `https.Agent` é criado com `rejectUnauthorized: false` (com ou sem certificado). Isso **desabilita validação do certificado** do servidor TLS.
|
|
||||||
- Em produção, isso pode reduzir segurança. Se você precisar de validação TLS, será necessário ajustar a implementação.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## English
|
## English
|
||||||
|
|
@ -319,8 +314,3 @@ const client = new LhispOauthClient({
|
||||||
|
|
||||||
await client.get({ path: "/status" });
|
await client.get({ path: "/status" });
|
||||||
```
|
```
|
||||||
|
|
||||||
### Security notes
|
|
||||||
|
|
||||||
- The internal `https.Agent` is created with `rejectUnauthorized: false` (with or without PFX). This **disables TLS server certificate validation**.
|
|
||||||
- In production, this may reduce security. If you need strict TLS validation, the implementation must be adjusted.
|
|
||||||
|
|
|
||||||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "lhisp-oauth-client",
|
"name": "lhisp-oauth-client",
|
||||||
"version": "1.0.38",
|
"version": "1.0.40",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "lhisp-oauth-client",
|
"name": "lhisp-oauth-client",
|
||||||
"version": "1.0.38",
|
"version": "1.0.40",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.10.0"
|
"axios": "^1.10.0"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "lhisp-oauth-client",
|
"name": "lhisp-oauth-client",
|
||||||
"version": "1.0.39",
|
"version": "1.0.40",
|
||||||
"main": "src/index",
|
"main": "src/index",
|
||||||
"types": "src/index.d.ts",
|
"types": "src/index.d.ts",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ export interface LhispOauthClientConstructorParams {
|
||||||
debug?: boolean;
|
debug?: boolean;
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
logger?: Logger;
|
logger?: Logger;
|
||||||
|
rejectUnauthorized?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ExecutarRequestParams extends AxiosRequestConfig {
|
export interface ExecutarRequestParams extends AxiosRequestConfig {
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,11 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
||||||
this.agent = new https.Agent({
|
this.agent = new https.Agent({
|
||||||
pfx: Buffer.isBuffer(params.certificado) ? params.certificado : Buffer.from(params.certificado, "base64"),
|
pfx: Buffer.isBuffer(params.certificado) ? params.certificado : Buffer.from(params.certificado, "base64"),
|
||||||
passphrase: params.senhaCertificado ? params.senhaCertificado : undefined,
|
passphrase: params.senhaCertificado ? params.senhaCertificado : undefined,
|
||||||
rejectUnauthorized: false,
|
rejectUnauthorized: params.rejectUnauthorized ?? false,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.agent = new https.Agent({
|
this.agent = new https.Agent({
|
||||||
rejectUnauthorized: false,
|
rejectUnauthorized: params.rejectUnauthorized ?? false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue