@getstrata/core 0.5.77 → 0.5.78
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
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @getstrata/core changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.78
|
|
4
|
+
|
|
5
|
+
- OpenAPI treats `POST /auth/two-factor-challenge` as a public operation (no bearer), including when routes are registered under `API_PREFIX`.
|
|
6
|
+
|
|
3
7
|
## 0.5.77
|
|
4
8
|
|
|
5
9
|
- `@getstrata/core/security/recoveryCodes` (`generateRecoveryCodes`, `hashRecoveryCode`, `recoveryCodeMatches`). Fortify-style one-time MFA backup codes (`abcd-efgh`).
|
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ import type { Migration } from "@getstrata/core/database/migrations/types";
|
|
|
82
82
|
Package name: **`@getstrata/core`** (npm org [`@getstrata`](https://www.npmjs.com/org/getstrata)).
|
|
83
83
|
|
|
84
84
|
1. Add `NPM_TOKEN` to GitHub repository secrets.
|
|
85
|
-
2. Tag a release: `git tag v0.5.
|
|
85
|
+
2. Tag a release: `git tag v0.5.80 && git push origin v0.5.80`
|
|
86
86
|
3. [Release workflow](../../.github/workflows/release.yml) builds and runs `npm publish --access public`.
|
|
87
87
|
|
|
88
88
|
Previously published as `@eyk-workhub/framework@0.1.0`, deprecated in favor of this package.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// ../../src/modules/webhook/dispatchWebhookJob.ts
|
|
3
3
|
import { createHmac } from "crypto";
|
|
4
4
|
import { repositoryConnection as db } from "@getstrata/core/database/repositoryConnection";
|
|
5
|
+
import { BadRequestError } from "@getstrata/core/errors/http";
|
|
5
6
|
import { Job } from "@getstrata/core/queue";
|
|
6
7
|
import { webhookSignatureHeader } from "@getstrata/core/runtime/appKeyPrefix";
|
|
7
8
|
import { safeFetch } from "@getstrata/core/security/safeFetch";
|
|
@@ -39,10 +40,10 @@ class DispatchWebhookJob extends Job {
|
|
|
39
40
|
const signature = createHmac("sha256", webhook.secret).update(body).digest("hex");
|
|
40
41
|
const allowHttp = (process.env.APP_ENV ?? "local") !== "production";
|
|
41
42
|
const signatureHeader = webhookSignatureHeader();
|
|
42
|
-
assertSafeOutboundUrl(webhook.url, { allowHttp });
|
|
43
43
|
let responseStatus = null;
|
|
44
44
|
let errorMessage = null;
|
|
45
45
|
try {
|
|
46
|
+
assertSafeOutboundUrl(webhook.url, { allowHttp });
|
|
46
47
|
const response = await safeFetch(webhook.url, {
|
|
47
48
|
method: "POST",
|
|
48
49
|
headers: {
|
|
@@ -67,6 +68,9 @@ class DispatchWebhookJob extends Job {
|
|
|
67
68
|
${errorMessage}
|
|
68
69
|
)
|
|
69
70
|
`;
|
|
71
|
+
if (error instanceof BadRequestError) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
70
74
|
return error instanceof Error ? error : new Error(errorMessage);
|
|
71
75
|
}
|
|
72
76
|
await db`
|
|
@@ -51,6 +51,7 @@ function sdkClientClassName() {
|
|
|
51
51
|
var PUBLIC_ROUTE_DESCRIPTIONS = {
|
|
52
52
|
"GET /auth/me": "Current authenticated user",
|
|
53
53
|
"POST /auth/login": "Login with email and password",
|
|
54
|
+
"POST /auth/two-factor-challenge": "Complete two-factor login challenge",
|
|
54
55
|
"POST /auth/register": "Register with name, email, and password",
|
|
55
56
|
"POST /auth/forgot-password": "Request a password reset email",
|
|
56
57
|
"POST /auth/reset-password": "Reset password with email and token",
|
|
@@ -99,7 +100,7 @@ function toRelativeApiPath(path) {
|
|
|
99
100
|
}
|
|
100
101
|
function requiresBearerAuth(path, method) {
|
|
101
102
|
const relative = toRelativeApiPath(path);
|
|
102
|
-
if (relative.startsWith("/auth/login") || relative.startsWith("/auth/register") || relative.startsWith("/auth/forgot-password") || relative.startsWith("/auth/reset-password") || relative.startsWith("/auth/email/verification-notification") || relative.startsWith("/auth/oauth")) {
|
|
103
|
+
if (relative.startsWith("/auth/login") || relative.startsWith("/auth/two-factor-challenge") || relative.startsWith("/auth/register") || relative.startsWith("/auth/forgot-password") || relative.startsWith("/auth/reset-password") || relative.startsWith("/auth/email/verification-notification") || relative.startsWith("/auth/oauth")) {
|
|
103
104
|
return false;
|
|
104
105
|
}
|
|
105
106
|
if (relative.startsWith("/scim/") || relative.startsWith("/billing/webhooks/") || path.startsWith("/scim/") || path.startsWith("/billing/webhooks/")) {
|