From 9825933d1ea893ac6732662df9aeb0d4b742c1db Mon Sep 17 00:00:00 2001 From: Connor Doman Date: Thu, 2 Nov 2023 20:22:13 -0700 Subject: [PATCH 01/42] feat(auth): middleware extracts basic auth header --- app/front-end/generate_dev_env.sh | 1 + app/front-end/src/app/api/auth/basic/route.ts | 15 ++++++++ app/front-end/src/app/api/auth/login/route.ts | 24 +++++++++++++ app/front-end/src/app/user/page.tsx | 14 ++++++++ app/front-end/src/lib/auth.ts | 17 ++++++++- app/front-end/src/middleware.ts | 35 +++++++++++++++++++ 6 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 app/front-end/src/app/api/auth/basic/route.ts create mode 100644 app/front-end/src/app/api/auth/login/route.ts create mode 100644 app/front-end/src/app/user/page.tsx create mode 100644 app/front-end/src/middleware.ts diff --git a/app/front-end/generate_dev_env.sh b/app/front-end/generate_dev_env.sh index 41f8cf80..622e5039 100644 --- a/app/front-end/generate_dev_env.sh +++ b/app/front-end/generate_dev_env.sh @@ -7,4 +7,5 @@ echo PRIVACYPAL_INPUT_VIDEO_DIR="../back-end/video-processing/input-videos" echo PRIVACYPAL_OUTPUT_VIDEO_DIR="../back-end/video-processing/output-videos" echo PRIVACYPAL_CONFIG_DIR="./conf" + echo PRIVACYPAL_AUTH_MANAGER="${AUTH_MANAGER:-basic}" } > .env.local diff --git a/app/front-end/src/app/api/auth/basic/route.ts b/app/front-end/src/app/api/auth/basic/route.ts new file mode 100644 index 00000000..09c27686 --- /dev/null +++ b/app/front-end/src/app/api/auth/basic/route.ts @@ -0,0 +1,15 @@ +/* + * Created on Thu Nov 02 2023 + * Author: Connor Doman + */ + +import { headers } from "next/headers"; + +export async function GET(req: Request) { + const headersList = headers(); + const authorizationHeader = headersList.get("authorization"); + + console.log({ authorizationHeader }); + + return Response.json({ headers: JSON.stringify(authorizationHeader) }); +} diff --git a/app/front-end/src/app/api/auth/login/route.ts b/app/front-end/src/app/api/auth/login/route.ts new file mode 100644 index 00000000..16d12632 --- /dev/null +++ b/app/front-end/src/app/api/auth/login/route.ts @@ -0,0 +1,24 @@ +/* + * Created on Thu Nov 02 2023 + * Author: Connor Doman + */ + +import { headers } from "next/headers"; + +export async function GET(req: Request) { + const headersList = headers(); + const authorizationHeader = headersList.get("authorization"); + + console.log({ authorizationHeader }); + + return Response.json({ headers: JSON.stringify(authorizationHeader) }); +} + +export async function POST(req: Request) { + const headersList = headers(); + const authorizationHeader = headersList.get("authorization"); + + console.log({ authorizationHeader }); + + return Response.json({ headers: JSON.stringify(authorizationHeader) }); +} diff --git a/app/front-end/src/app/user/page.tsx b/app/front-end/src/app/user/page.tsx new file mode 100644 index 00000000..764aa998 --- /dev/null +++ b/app/front-end/src/app/user/page.tsx @@ -0,0 +1,14 @@ +/* + * Created on Thu Nov 02 2023 + * Author: Connor Doman + */ + +import React from "react"; + +export default function UserPage() { + return ( +
+

user page

+
+ ); +} diff --git a/app/front-end/src/lib/auth.ts b/app/front-end/src/lib/auth.ts index 33bb9e44..13c5faa5 100644 --- a/app/front-end/src/lib/auth.ts +++ b/app/front-end/src/lib/auth.ts @@ -6,7 +6,9 @@ import type { NextAuthOptions, RequestInternal, User } from "next-auth"; import CredentialsProvider, { CredentialsConfig } from "next-auth/providers/credentials"; import { DummyAuthenticator } from "./dummy-authenticator"; +import { base64ToUtf8 } from "./base64"; +export type PrivacyPalAuthManager = "aws_cognito" | "basic" | undefined; export type PrivacyPalCredentialsRecord = Record<"password" | "email", string> | undefined; export type AuthRequest = Pick; @@ -17,7 +19,7 @@ export interface PrivacyPalAuthenticator { } const buildAuthenticationProviders = () => { - const manager = (process.env.PRIVACYPAL_AUTH_MANAGER ?? "basic") as "basic" | "aws_cognito"; + const manager = (process.env.PRIVACYPAL_AUTH_MANAGER ?? "basic") as PrivacyPalAuthManager; switch (manager) { case "aws_cognito": @@ -41,3 +43,16 @@ export const privacyPalAuthOptions: NextAuthOptions = { providers: [buildAuthenticationProviders()], secret: process.env.NEXTAUTH_SECRET ?? "", }; + +export const privacyPalAuthManager: PrivacyPalAuthManager = process.env + .PRIVACYPAL_AUTH_MANAGER as PrivacyPalAuthManager; + +export const extractBasicCredentials = (authorizationHeader: string): PrivacyPalCredentialsRecord => { + const isBasicAuthHeader = authorizationHeader.startsWith("Basic "); + if (isBasicAuthHeader) { + const base64Credentials = authorizationHeader.split(" ")[1]; + const credentials = base64ToUtf8(base64Credentials); + const [email, password] = credentials.split(":"); + return { email, password }; + } +}; diff --git a/app/front-end/src/middleware.ts b/app/front-end/src/middleware.ts new file mode 100644 index 00000000..fb2c555c --- /dev/null +++ b/app/front-end/src/middleware.ts @@ -0,0 +1,35 @@ +/* + * Created on Thu Nov 02 2023 + * Author: Connor Doman + */ + +import { headers } from "next/headers"; +import { NextRequest, NextResponse } from "next/server"; +import { extractBasicCredentials, privacyPalAuthManager } from "@lib/auth"; +import { base64ToUtf8 } from "@lib/base64"; + +export function middleware(req: NextRequest) { + const headersList = headers(); + const authorizationHeader = headersList.get("authorization"); + + const pathname = req.nextUrl.pathname; + + console.log(pathname); + + if (authorizationHeader) { + const isBasicAuthHeader = authorizationHeader.startsWith("Basic "); + if (isBasicAuthHeader && privacyPalAuthManager === "basic") { + console.log("Basic auth header detected"); + + const credentials = extractBasicCredentials(authorizationHeader); + + console.log({ credentials }); + } + } + + return NextResponse.next(); +} + +export const config = { + matcher: "/:path*", +}; From f3158ffac9e84948262eb52a6dede5ce00ecf129 Mon Sep 17 00:00:00 2001 From: Connor Doman Date: Thu, 2 Nov 2023 22:10:00 -0700 Subject: [PATCH 02/42] feat(auth): invalid Basic request sends www-authenticate --- app/front-end/src/middleware.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/app/front-end/src/middleware.ts b/app/front-end/src/middleware.ts index fb2c555c..64646cb5 100644 --- a/app/front-end/src/middleware.ts +++ b/app/front-end/src/middleware.ts @@ -6,11 +6,11 @@ import { headers } from "next/headers"; import { NextRequest, NextResponse } from "next/server"; import { extractBasicCredentials, privacyPalAuthManager } from "@lib/auth"; -import { base64ToUtf8 } from "@lib/base64"; +import { JSONResponse } from "@lib/json"; export function middleware(req: NextRequest) { - const headersList = headers(); - const authorizationHeader = headersList.get("authorization"); + const requestHeaders = new Headers(req.headers); + const authorizationHeader = requestHeaders.get("authorization"); const pathname = req.nextUrl.pathname; @@ -24,7 +24,23 @@ export function middleware(req: NextRequest) { const credentials = extractBasicCredentials(authorizationHeader); console.log({ credentials }); + + if (credentials?.email == "test" && credentials?.password == "test") { + return NextResponse.next(); + } } + + console.log("Authorization header, not authorized"); + requestHeaders.set("WWW-Authenticate", 'Basic realm="Access to the staging site", charset="UTF-8"'); + const res: JSONResponse = { + errors: [ + { + status: "401", + title: "Unauthorized", + }, + ], + }; + return NextResponse.next({ status: 401, headers: requestHeaders }); } return NextResponse.next(); From c4a4d3cbd084d2301b6248586a8b7323c341d1b6 Mon Sep 17 00:00:00 2001 From: Connor Doman Date: Thu, 2 Nov 2023 22:12:40 -0700 Subject: [PATCH 03/42] feat(site): added simple not-found.tsx --- app/front-end/src/app/not-found.tsx | 12 ++++++++++++ app/front-end/src/middleware.ts | 8 -------- 2 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 app/front-end/src/app/not-found.tsx diff --git a/app/front-end/src/app/not-found.tsx b/app/front-end/src/app/not-found.tsx new file mode 100644 index 00000000..ae3ab239 --- /dev/null +++ b/app/front-end/src/app/not-found.tsx @@ -0,0 +1,12 @@ +/* + * Created on Thu Nov 02 2023 + * Author: Connor Doman + */ + +export default function NotFound() { + return ( +
+

Not Found

+
+ ); +} diff --git a/app/front-end/src/middleware.ts b/app/front-end/src/middleware.ts index 64646cb5..06fa7ad2 100644 --- a/app/front-end/src/middleware.ts +++ b/app/front-end/src/middleware.ts @@ -32,14 +32,6 @@ export function middleware(req: NextRequest) { console.log("Authorization header, not authorized"); requestHeaders.set("WWW-Authenticate", 'Basic realm="Access to the staging site", charset="UTF-8"'); - const res: JSONResponse = { - errors: [ - { - status: "401", - title: "Unauthorized", - }, - ], - }; return NextResponse.next({ status: 401, headers: requestHeaders }); } From 854979fe30448605ace530b1aed3d9b6e33dd96c Mon Sep 17 00:00:00 2001 From: Connor Doman Date: Thu, 2 Nov 2023 22:26:58 -0700 Subject: [PATCH 04/42] tweak(auth): disabled nextauth --- .../src/app/api/auth/[...nextauth]/route.ts | 11 ----------- .../src/app/api/auth/formerly_nextauth/route.ts | 15 +++++++++++++++ app/front-end/src/lib/json.ts | 9 +++++++++ app/front-end/src/middleware.ts | 4 +--- 4 files changed, 25 insertions(+), 14 deletions(-) delete mode 100644 app/front-end/src/app/api/auth/[...nextauth]/route.ts create mode 100644 app/front-end/src/app/api/auth/formerly_nextauth/route.ts diff --git a/app/front-end/src/app/api/auth/[...nextauth]/route.ts b/app/front-end/src/app/api/auth/[...nextauth]/route.ts deleted file mode 100644 index a30e5fcd..00000000 --- a/app/front-end/src/app/api/auth/[...nextauth]/route.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Created on Sun Oct 22 2023 - * Author: Connor Doman - */ - -import { privacyPalAuthOptions } from "@lib/auth"; -import NextAuth from "next-auth"; - -const authHandler = NextAuth(privacyPalAuthOptions); - -export { authHandler as GET, authHandler as POST }; diff --git a/app/front-end/src/app/api/auth/formerly_nextauth/route.ts b/app/front-end/src/app/api/auth/formerly_nextauth/route.ts new file mode 100644 index 00000000..6c625fae --- /dev/null +++ b/app/front-end/src/app/api/auth/formerly_nextauth/route.ts @@ -0,0 +1,15 @@ +/* + * Created on Sun Oct 22 2023 + * Author: Connor Doman + */ + +import { privacyPalAuthOptions } from "@lib/auth"; +import { RESPONSE_NOT_IMPLEMENTED } from "@lib/json"; +import NextAuth from "next-auth"; + +const authHandler = NextAuth(privacyPalAuthOptions); + +// export { authHandler as GET, authHandler as POST }; +export async function GET(req: Request) { + return Response.json(RESPONSE_NOT_IMPLEMENTED, { status: 501 }); +} diff --git a/app/front-end/src/lib/json.ts b/app/front-end/src/lib/json.ts index d6754113..ba64ae0a 100644 --- a/app/front-end/src/lib/json.ts +++ b/app/front-end/src/lib/json.ts @@ -25,3 +25,12 @@ export interface JSONResponse { errors?: JSONError[]; meta?: any; } + +export const RESPONSE_NOT_IMPLEMENTED: JSONResponse = { + errors: [ + { + status: "501", + title: "Not Implemented", + }, + ], +}; diff --git a/app/front-end/src/middleware.ts b/app/front-end/src/middleware.ts index 06fa7ad2..3dac38ab 100644 --- a/app/front-end/src/middleware.ts +++ b/app/front-end/src/middleware.ts @@ -3,10 +3,8 @@ * Author: Connor Doman */ -import { headers } from "next/headers"; import { NextRequest, NextResponse } from "next/server"; import { extractBasicCredentials, privacyPalAuthManager } from "@lib/auth"; -import { JSONResponse } from "@lib/json"; export function middleware(req: NextRequest) { const requestHeaders = new Headers(req.headers); @@ -25,7 +23,7 @@ export function middleware(req: NextRequest) { console.log({ credentials }); - if (credentials?.email == "test" && credentials?.password == "test") { + if (credentials?.email == "username" && credentials?.password == "password") { return NextResponse.next(); } } From f9c9af39e81a7fd9f88bf6b8f96f4fcf6ed9ef7e Mon Sep 17 00:00:00 2001 From: Connor Doman Date: Thu, 2 Nov 2023 22:46:39 -0700 Subject: [PATCH 05/42] feat(auth): create staff area, modify dummy auth --- app/front-end/src/app/page.tsx | 2 ++ app/front-end/src/app/staff/page.tsx | 12 ++++++++++++ app/front-end/src/lib/auth.ts | 6 ++++++ app/front-end/src/lib/dummy-authenticator.ts | 2 +- 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 app/front-end/src/app/staff/page.tsx diff --git a/app/front-end/src/app/page.tsx b/app/front-end/src/app/page.tsx index 89924f21..ba28cdbd 100644 --- a/app/front-end/src/app/page.tsx +++ b/app/front-end/src/app/page.tsx @@ -6,6 +6,8 @@ export default function Home() {

Welcome to PrivacyPal

Log in + Staff Area + User Area
); } diff --git a/app/front-end/src/app/staff/page.tsx b/app/front-end/src/app/staff/page.tsx new file mode 100644 index 00000000..b27f1a2f --- /dev/null +++ b/app/front-end/src/app/staff/page.tsx @@ -0,0 +1,12 @@ +/* + * Created on Thu Nov 02 2023 + * Author: Connor Doman + */ + +export default function StaffPage() { + return ( +
+

Staff page

+
+ ); +} diff --git a/app/front-end/src/lib/auth.ts b/app/front-end/src/lib/auth.ts index 13c5faa5..ee5da7ad 100644 --- a/app/front-end/src/lib/auth.ts +++ b/app/front-end/src/lib/auth.ts @@ -56,3 +56,9 @@ export const extractBasicCredentials = (authorizationHeader: string): PrivacyPal return { email, password }; } }; + +export const basicDummyAuthentication = async (credentialsBase64: string) => { + const dummyProvider = new DummyAuthenticator(); + const authorizedUser = await dummyProvider.authorize(extractBasicCredentials(credentialsBase64)); + return authorizedUser; +}; diff --git a/app/front-end/src/lib/dummy-authenticator.ts b/app/front-end/src/lib/dummy-authenticator.ts index 2d33a0b1..728bdbe9 100644 --- a/app/front-end/src/lib/dummy-authenticator.ts +++ b/app/front-end/src/lib/dummy-authenticator.ts @@ -29,7 +29,7 @@ export class DummyAuthenticator implements PrivacyPalAuthenticator { }; } - async authorize(credentials: PrivacyPalCredentialsRecord, req: AuthRequest): Promise { + async authorize(credentials: PrivacyPalCredentialsRecord, req?: AuthRequest): Promise { // extract the user config from the JSON file const userConfig = extractUserConfig() as { users: PrivacyPalDummyUser[] }; const users: PrivacyPalDummyUser[] = userConfig.users; From dc106bb44ac596db4c1ad2d110815312e5e5a3ea Mon Sep 17 00:00:00 2001 From: Connor Doman Date: Fri, 3 Nov 2023 00:03:49 -0700 Subject: [PATCH 06/42] feat(auth): basic auth api route --- app/front-end/conf/user.properties.json | 5 + app/front-end/package-lock.json | 405 ++---------------- app/front-end/package.json | 1 - app/front-end/src/app/api/auth/basic/route.ts | 32 +- app/front-end/src/app/api/auth/hash/route.ts | 20 + app/front-end/src/lib/auth.ts | 10 +- app/front-end/src/lib/dummy-authenticator.ts | 4 +- app/front-end/src/lib/json.ts | 16 + app/front-end/src/middleware.ts | 19 +- 9 files changed, 122 insertions(+), 390 deletions(-) create mode 100644 app/front-end/src/app/api/auth/hash/route.ts diff --git a/app/front-end/conf/user.properties.json b/app/front-end/conf/user.properties.json index 67134840..b940adc0 100644 --- a/app/front-end/conf/user.properties.json +++ b/app/front-end/conf/user.properties.json @@ -9,6 +9,11 @@ "id": "2", "email": "badatpasswords@example.com", "hashedPassword": "" + }, + { + "id": "3", + "email": "username", + "hashedPassword": "$2a$10$bMG7qmKpKQJ4DfbW0gA9HOqXo7ZzYT0c0bBe7FVZQUgvj9oIZrMwa" } ] } diff --git a/app/front-end/package-lock.json b/app/front-end/package-lock.json index aee25979..ef68ac73 100644 --- a/app/front-end/package-lock.json +++ b/app/front-end/package-lock.json @@ -12,7 +12,6 @@ "@patternfly/react-icons": "^5.1.1", "@patternfly/react-styles": "^5.1.1", "@patternfly/react-table": "^5.1.1", - "bcrypt": "^5.1.1", "bcryptjs": "^2.4.3", "next": "13.5.4", "next-auth": "^4.24.3", @@ -1266,39 +1265,6 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@mapbox/node-pre-gyp": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", - "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==", - "dependencies": { - "detect-libc": "^2.0.0", - "https-proxy-agent": "^5.0.0", - "make-dir": "^3.1.0", - "node-fetch": "^2.6.7", - "nopt": "^5.0.0", - "npmlog": "^5.0.1", - "rimraf": "^3.0.2", - "semver": "^7.3.5", - "tar": "^6.1.11" - }, - "bin": { - "node-pre-gyp": "bin/node-pre-gyp" - } - }, - "node_modules/@mapbox/node-pre-gyp/node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/@next/env": { "version": "13.5.4", "resolved": "https://registry.npmjs.org/@next/env/-/env-13.5.4.tgz", @@ -1876,11 +1842,6 @@ "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", "dev": true }, - "node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" - }, "node_modules/acorn": { "version": "8.11.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", @@ -1916,6 +1877,7 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, "dependencies": { "debug": "4" }, @@ -1942,6 +1904,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, "engines": { "node": ">=8" } @@ -1974,23 +1937,6 @@ "node": ">= 8" } }, - "node_modules/aproba": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", - "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==" - }, - "node_modules/are-we-there-yet": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", - "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^3.6.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -2220,20 +2166,8 @@ "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/bcrypt": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-5.1.1.tgz", - "integrity": "sha512-AGBHOG5hPYZ5Xl9KXzU5iKq9516yEmvCKDg3ecP5kX2aB6UqTeXZxk2ELnDgDm6BQSMlLt9rDB4LoSMx0rYwww==", - "hasInstallScript": true, - "dependencies": { - "@mapbox/node-pre-gyp": "^1.0.11", - "node-addon-api": "^5.0.0" - }, - "engines": { - "node": ">= 10.0.0" - } + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true }, "node_modules/bcryptjs": { "version": "2.4.3", @@ -2244,6 +2178,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2404,14 +2339,6 @@ "node": ">=10" } }, - "node_modules/chownr": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", - "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", - "engines": { - "node": ">=10" - } - }, "node_modules/ci-info": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", @@ -2486,14 +2413,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "bin": { - "color-support": "bin.js" - } - }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -2509,12 +2428,8 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" - }, - "node_modules/console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==" + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true }, "node_modules/convert-source-map": { "version": "2.0.0", @@ -2635,6 +2550,7 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "dependencies": { "ms": "2.1.2" }, @@ -2745,11 +2661,6 @@ "node": ">=0.4.0" } }, - "node_modules/delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==" - }, "node_modules/dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", @@ -2759,14 +2670,6 @@ "node": ">=6" } }, - "node_modules/detect-libc": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", - "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", - "engines": { - "node": ">=8" - } - }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -2830,7 +2733,8 @@ "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true }, "node_modules/entities": { "version": "4.5.0", @@ -3114,37 +3018,11 @@ "url": "https://github.com/sponsors/rawify" } }, - "node_modules/fs-minipass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/fs-minipass/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/fs-minipass/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true }, "node_modules/fsevents": { "version": "2.3.3", @@ -3178,25 +3056,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/gauge": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", - "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", - "dependencies": { - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.2", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.1", - "object-assign": "^4.1.1", - "signal-exit": "^3.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.2" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -3255,6 +3114,7 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -3370,11 +3230,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==" - }, "node_modules/hasown": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", @@ -3423,6 +3278,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, "dependencies": { "agent-base": "6", "debug": "4" @@ -3493,6 +3349,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -3501,7 +3358,8 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "node_modules/internal-slot": { "version": "1.0.6", @@ -3624,6 +3482,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, "engines": { "node": ">=8" } @@ -5174,28 +5033,6 @@ "lz-string": "bin/bin.js" } }, - "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/make-dir/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", @@ -5273,6 +5110,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -5284,53 +5122,16 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, "engines": { "node": ">=8" } }, - "node_modules/minizlib": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", - "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", - "dependencies": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/minizlib/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/minizlib/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, - "node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "bin": { - "mkdirp": "bin/cmd.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true }, "node_modules/nanoid": { "version": "3.3.6", @@ -5427,49 +5228,6 @@ } } }, - "node_modules/node-addon-api": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", - "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==" - }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/node-fetch/node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, - "node_modules/node-fetch/node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "node_modules/node-fetch/node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -5482,20 +5240,6 @@ "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", "dev": true }, - "node_modules/nopt": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", - "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -5526,17 +5270,6 @@ "node": ">=8" } }, - "node_modules/npmlog": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", - "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", - "dependencies": { - "are-we-there-yet": "^2.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^3.0.0", - "set-blocking": "^2.0.0" - } - }, "node_modules/nwsapi": { "version": "2.2.7", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.7.tgz", @@ -5628,6 +5361,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "dependencies": { "wrappy": "1" } @@ -5771,6 +5505,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -6047,19 +5782,6 @@ "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true }, - "node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/redent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", @@ -6221,25 +5943,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -6270,6 +5973,7 @@ "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -6284,6 +5988,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, "dependencies": { "yallist": "^4.0.0" }, @@ -6294,12 +5999,8 @@ "node_modules/semver/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true }, "node_modules/set-function-length": { "version": "1.1.1", @@ -6368,7 +6069,8 @@ "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true }, "node_modules/sisteransi": { "version": "1.0.5", @@ -6450,14 +6152,6 @@ "node": ">=10.0.0" } }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -6475,6 +6169,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -6503,6 +6198,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -6622,27 +6318,6 @@ "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz", "integrity": "sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==" }, - "node_modules/tar": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", - "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", - "dependencies": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^5.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/tar/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -6848,11 +6523,6 @@ "requires-port": "^1.0.0" } }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" - }, "node_modules/uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", @@ -7016,14 +6686,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/wide-align": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", - "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", - "dependencies": { - "string-width": "^1.0.2 || 2 || 3 || 4" - } - }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -7062,7 +6724,8 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true }, "node_modules/write-file-atomic": { "version": "4.0.2", diff --git a/app/front-end/package.json b/app/front-end/package.json index 671c4f2d..7d75cbae 100644 --- a/app/front-end/package.json +++ b/app/front-end/package.json @@ -17,7 +17,6 @@ "@patternfly/react-icons": "^5.1.1", "@patternfly/react-styles": "^5.1.1", "@patternfly/react-table": "^5.1.1", - "bcrypt": "^5.1.1", "bcryptjs": "^2.4.3", "next": "13.5.4", "next-auth": "^4.24.3", diff --git a/app/front-end/src/app/api/auth/basic/route.ts b/app/front-end/src/app/api/auth/basic/route.ts index 09c27686..c17eb6b8 100644 --- a/app/front-end/src/app/api/auth/basic/route.ts +++ b/app/front-end/src/app/api/auth/basic/route.ts @@ -3,13 +3,33 @@ * Author: Connor Doman */ -import { headers } from "next/headers"; +import { basicDummyAuthentication, privacyPalAuthManager } from "@lib/auth"; +import { RESPONSE_NOT_AUTHORIZED, RESPONSE_OK } from "@lib/json"; -export async function GET(req: Request) { - const headersList = headers(); - const authorizationHeader = headersList.get("authorization"); +export async function POST(req: Request) { + const requestHeaders = new Headers(req.headers); + const authorizationHeader = requestHeaders.get("authorization"); - console.log({ authorizationHeader }); + if (authorizationHeader) { + const isBasicAuthHeader = authorizationHeader.startsWith("Basic "); + if (isBasicAuthHeader && privacyPalAuthManager === "basic") { + console.log("Basic auth header detected"); - return Response.json({ headers: JSON.stringify(authorizationHeader) }); + const authRequest = await basicDummyAuthentication(authorizationHeader); + + console.log({ authRequest }); + + if (authRequest) { + console.log("Authorization header, authorized"); + + return Response.json(RESPONSE_OK, { status: 200 }); + } + } + + console.log("Authorization header, not authorized"); + requestHeaders.set("WWW-Authenticate", 'Basic realm="Access to the staging site", charset="UTF-8"'); + return Response.json(RESPONSE_NOT_AUTHORIZED, { status: 401, headers: requestHeaders }); + } + + return Response.json(RESPONSE_NOT_AUTHORIZED, { status: 401 }); } diff --git a/app/front-end/src/app/api/auth/hash/route.ts b/app/front-end/src/app/api/auth/hash/route.ts new file mode 100644 index 00000000..0b2cb40c --- /dev/null +++ b/app/front-end/src/app/api/auth/hash/route.ts @@ -0,0 +1,20 @@ +/* + * Created on Thu Nov 02 2023 + * Author: Connor Doman + */ + +import { JSONResponse } from "@lib/json"; +import bcrypt from "bcryptjs"; + +export async function POST(req: Request) { + const formData = await req.formData(); + const text = formData.get("text") as string; + const salt = await bcrypt.genSalt(10); + const hash = await bcrypt.hash(text, salt); + const res: JSONResponse = { + data: { + hash, + }, + }; + return Response.json(res); +} diff --git a/app/front-end/src/lib/auth.ts b/app/front-end/src/lib/auth.ts index ee5da7ad..0c6338a4 100644 --- a/app/front-end/src/lib/auth.ts +++ b/app/front-end/src/lib/auth.ts @@ -57,8 +57,12 @@ export const extractBasicCredentials = (authorizationHeader: string): PrivacyPal } }; -export const basicDummyAuthentication = async (credentialsBase64: string) => { +export const basicDummyAuthentication = async (authorizationHeader: string): Promise => { const dummyProvider = new DummyAuthenticator(); - const authorizedUser = await dummyProvider.authorize(extractBasicCredentials(credentialsBase64)); - return authorizedUser; + const authorizedUser = await dummyProvider.authorize(extractBasicCredentials(authorizationHeader)); + console.log({ authorizedUser }); + if (authorizedUser) { + return authorizedUser; + } + return false; }; diff --git a/app/front-end/src/lib/dummy-authenticator.ts b/app/front-end/src/lib/dummy-authenticator.ts index 728bdbe9..2dc49319 100644 --- a/app/front-end/src/lib/dummy-authenticator.ts +++ b/app/front-end/src/lib/dummy-authenticator.ts @@ -47,7 +47,7 @@ export class DummyAuthenticator implements PrivacyPalAuthenticator { } // translate the stored password from base64 to ASCII - const hashedPassword = user.hashedPassword ? base64ToUtf8(user.hashedPassword) : ""; + const hashedPassword = user.hashedPassword || ""; if (!hashedPassword) { console.error("User has no password"); @@ -62,6 +62,8 @@ export class DummyAuthenticator implements PrivacyPalAuthenticator { return { id: user.id, email: user.email } as User; } console.error("Invalid password"); + } else { + console.error("User not found"); } // if credentials invalid in any way, return null return null; diff --git a/app/front-end/src/lib/json.ts b/app/front-end/src/lib/json.ts index ba64ae0a..ebaa3079 100644 --- a/app/front-end/src/lib/json.ts +++ b/app/front-end/src/lib/json.ts @@ -34,3 +34,19 @@ export const RESPONSE_NOT_IMPLEMENTED: JSONResponse = { }, ], }; + +export const RESPONSE_NOT_AUTHORIZED: JSONResponse = { + errors: [ + { + status: "401", + title: "Unauthorized", + }, + ], +}; + +export const RESPONSE_OK: JSONResponse = { + data: { + status: "200", + title: "OK", + }, +}; diff --git a/app/front-end/src/middleware.ts b/app/front-end/src/middleware.ts index 3dac38ab..147155fc 100644 --- a/app/front-end/src/middleware.ts +++ b/app/front-end/src/middleware.ts @@ -4,28 +4,31 @@ */ import { NextRequest, NextResponse } from "next/server"; -import { extractBasicCredentials, privacyPalAuthManager } from "@lib/auth"; +import { basicDummyAuthentication, extractBasicCredentials, privacyPalAuthManager } from "@lib/auth"; -export function middleware(req: NextRequest) { +export async function middleware(req: NextRequest) { const requestHeaders = new Headers(req.headers); const authorizationHeader = requestHeaders.get("authorization"); const pathname = req.nextUrl.pathname; - console.log(pathname); + // console.log(pathname); if (authorizationHeader) { const isBasicAuthHeader = authorizationHeader.startsWith("Basic "); if (isBasicAuthHeader && privacyPalAuthManager === "basic") { console.log("Basic auth header detected"); - const credentials = extractBasicCredentials(authorizationHeader); + // const authRequest = await basicDummyAuthentication(authorizationHeader); - console.log({ credentials }); + // console.log({ authRequest }); - if (credentials?.email == "username" && credentials?.password == "password") { - return NextResponse.next(); - } + // if (authRequest) { + // console.log("Authorization header, authorized"); + + // requestHeaders.set("x-privacypal-hello", "Hello from authorization land!"); + // return NextResponse.next(); + // } } console.log("Authorization header, not authorized"); From 6880ba8896651b86e4d0b0cc722a23a254c70a35 Mon Sep 17 00:00:00 2001 From: Connor Doman Date: Fri, 3 Nov 2023 00:17:21 -0700 Subject: [PATCH 07/42] feat(auth): login form uses basic auth --- app/front-end/conf/user.properties.json | 2 +- app/front-end/src/app/layout.tsx | 10 ++--- app/front-end/src/app/user/page.tsx | 4 +- .../src/components/auth/LoginFlow.tsx | 38 +++++++++---------- .../src/components/auth/LoginForm.tsx | 32 ++++++++++------ 5 files changed, 48 insertions(+), 38 deletions(-) diff --git a/app/front-end/conf/user.properties.json b/app/front-end/conf/user.properties.json index b940adc0..9c9f845a 100644 --- a/app/front-end/conf/user.properties.json +++ b/app/front-end/conf/user.properties.json @@ -3,7 +3,7 @@ { "id": "1", "email": "johnny@example.com", - "hashedPassword": "JDJhJDEwJFV2ZnpHekFrbEtvZlljenNYZHZHR2VjaGRVY29BdHM1SjhBWU51a1RUQzdTQXZOT0VDVHVT" + "hashedPassword": "$2a$10$bMG7qmKpKQJ4DfbW0gA9HOqXo7ZzYT0c0bBe7FVZQUgvj9oIZrMwa" }, { "id": "2", diff --git a/app/front-end/src/app/layout.tsx b/app/front-end/src/app/layout.tsx index a2676cc2..d2d07843 100644 --- a/app/front-end/src/app/layout.tsx +++ b/app/front-end/src/app/layout.tsx @@ -18,11 +18,11 @@ export default function RootLayout({ children }: { children: React.ReactNode }) return ( - -
- {children} -