Skip to content

Commit 2acc69e

Browse files
committed
use http-helmet to organize CSP headers
1 parent e189370 commit 2acc69e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+563
-489
lines changed

packages/app-builder/.env.example

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,12 @@ MARBLE_API_URL_CLIENT=http://localhost:8080
2626
MARBLE_API_URL_SERVER=http://localhost:8080
2727
MARBLE_APP_URL=http://localhost:3000
2828

29-
# Configure your Firebase project to allow username and password authentication.
30-
FIREBASE_PROJECT_ID=dummy
31-
FIREBASE_API_KEY=dummy
32-
FIREBASE_AUTH_DOMAIN=dummy
33-
3429
#
3530
# OPTIONAL SETTINGS
3631
#
3732

38-
# If you need to support federated authentication through Firebase, you will need to configure the following settings:
39-
# To retrieve those value, go into the settings of your Firebase project, and register a new app from the 'General' tab.
40-
# The two information below will be provided to you after that.
41-
# FIREBASE_APP_ID=
42-
43-
# Uncomment this line if you are using the Firebase emulator for testing.
44-
# FIREBASE_AUTH_EMULATOR_HOST="localhost:9099"
45-
4633
# Configure various external integrations.
4734
SEGMENT_WRITE_KEY=
4835
DISABLE_SEGMENT=false
49-
SENTRY_DSN=
50-
SENTRY_ENVIRONMENT=
36+
SENTRY_DSN=
37+
SENTRY_ENVIRONMENT=

packages/app-builder/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"@hookform/resolvers": "^4.1.3",
4848
"@lottiefiles/react-lottie-player": "^3.6.0",
4949
"@marble/shared": "workspace:*",
50+
"@mcansh/http-helmet": "^0.13.0",
5051
"@oazapfts/runtime": "^1.0.4",
5152
"@preact/signals-react": "^3.0.1",
5253
"@radix-ui/react-avatar": "^1.1.3",

packages/app-builder/src/components/Auth/ResetPassword.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
TooManyRequest,
44
useSendPasswordResetEmail,
55
} from '@app-builder/services/auth/auth.client';
6-
import { clientServices } from '@app-builder/services/init.client';
6+
import { useClientServices } from '@app-builder/services/init.client';
77
import { getFieldErrors } from '@app-builder/utils/form';
88
import * as Sentry from '@sentry/remix';
99
import { useForm } from '@tanstack/react-form';
@@ -24,6 +24,7 @@ type ResetPasswordForm = z.infer<typeof resetPasswordFormSchema>;
2424

2525
export function ResetPassword() {
2626
const { t } = useTranslation(['auth', 'common']);
27+
const clientServices = useClientServices();
2728

2829
const sendPasswordResetEmail = useSendPasswordResetEmail(
2930
clientServices.authenticationClientService,

packages/app-builder/src/components/Auth/SendEmailVerification.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
TooManyRequest,
44
useResendEmailVerification,
55
} from '@app-builder/services/auth/auth.client';
6-
import { clientServices } from '@app-builder/services/init.client';
6+
import { useClientServices } from '@app-builder/services/init.client';
77
import { getRoute } from '@app-builder/utils/routes';
88
import { useNavigate } from '@remix-run/react';
99
import * as Sentry from '@sentry/remix';
@@ -36,6 +36,7 @@ function SendEmailVerificationButton({
3636

3737
function ClientSendEmailVerificationButton() {
3838
const { t } = useTranslation(['common', 'auth']);
39+
const clientServices = useClientServices();
3940

4041
const { isFirebaseEmulator } =
4142
clientServices.authenticationClientService.authenticationClientRepository;
@@ -90,6 +91,7 @@ export function SendEmailVerification() {
9091

9192
function ClientSendEmailVerificationDescription() {
9293
const { t } = useTranslation(['auth']);
94+
const clientServices = useClientServices();
9395

9496
const { isFirebaseEmulator } =
9597
clientServices.authenticationClientService.authenticationClientRepository;

packages/app-builder/src/components/Auth/SignInWithEmailAndPassword.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
WrongPasswordError,
77
} from '@app-builder/services/auth/auth.client';
88
import { type AuthPayload } from '@app-builder/services/auth/auth.server';
9-
import { clientServices } from '@app-builder/services/init.client';
9+
import { useClientServices } from '@app-builder/services/init.client';
1010
import { getFieldErrors } from '@app-builder/utils/form';
1111
import { getRoute } from '@app-builder/utils/routes';
1212
import { sleep } from '@app-builder/utils/sleep';
@@ -41,6 +41,7 @@ export function SignInWithEmailAndPassword({
4141
loading?: boolean;
4242
}) {
4343
const { t } = useTranslation(['auth', 'common']);
44+
const clientServices = useClientServices();
4445
const navigate = useNavigate();
4546
const hydrated = useHydrated();
4647

packages/app-builder/src/components/Auth/SignInWithGoogle.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
useGoogleSignIn,
77
} from '@app-builder/services/auth/auth.client';
88
import { type AuthPayload } from '@app-builder/services/auth/auth.server';
9-
import { clientServices } from '@app-builder/services/init.client';
9+
import { useClientServices } from '@app-builder/services/init.client';
1010
import useAsync from '@app-builder/utils/hooks/use-async';
1111
import * as Sentry from '@sentry/remix';
1212
import toast from 'react-hot-toast';
@@ -47,6 +47,8 @@ function ClientSignInWithGoogle({
4747
loading?: boolean;
4848
}) {
4949
const { t } = useTranslation(['common', 'auth']);
50+
const clientServices = useClientServices();
51+
5052
const googleSignIn = useGoogleSignIn(clientServices.authenticationClientService);
5153

5254
const [handleGoogleSignIn, _state] = useAsync(async () => {

packages/app-builder/src/components/Auth/SignInWithMicrosoft.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
useMicrosoftSignIn,
77
} from '@app-builder/services/auth/auth.client';
88
import { type AuthPayload } from '@app-builder/services/auth/auth.server';
9-
import { clientServices } from '@app-builder/services/init.client';
9+
import { useClientServices } from '@app-builder/services/init.client';
1010
import useAsync from '@app-builder/utils/hooks/use-async';
1111
import * as Sentry from '@sentry/remix';
1212
import toast from 'react-hot-toast';
@@ -55,6 +55,8 @@ function ClientSignInWithMicrosoft({
5555
loading?: boolean;
5656
}) {
5757
const { t } = useTranslation(['common', 'auth']);
58+
const clientServices = useClientServices();
59+
5860
const microsoftSignIn = useMicrosoftSignIn(clientServices.authenticationClientService);
5961

6062
const [handleMicrosoftSignIn, _state] = useAsync(async () => {

packages/app-builder/src/components/Auth/SignUpWithEmailAndPassword.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
useEmailAndPasswordSignUp,
66
WeakPasswordError,
77
} from '@app-builder/services/auth/auth.client';
8-
import { clientServices } from '@app-builder/services/init.client';
8+
import { useClientServices } from '@app-builder/services/init.client';
99
import { getFieldErrors, handleSubmit } from '@app-builder/utils/form';
1010
import * as Sentry from '@sentry/remix';
1111
import { useForm } from '@tanstack/react-form';
@@ -29,6 +29,7 @@ type EmailAndPasswordForm = z.infer<typeof emailAndPasswordFormSchema>;
2929

3030
export function SignUpWithEmailAndPassword({ signUp }: { signUp: () => void }) {
3131
const { t } = useTranslation(['auth', 'common']);
32+
const clientServices = useClientServices();
3233

3334
const emailAndPasswordSignUp = useEmailAndPasswordSignUp(
3435
clientServices.authenticationClientService,
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { type AppConfig } from '@app-builder/models/app-config';
2+
import { createSimpleContext } from '@marble/shared';
3+
4+
export const AppConfigContext = createSimpleContext<AppConfig>('AppConfig');

packages/app-builder/src/entry.client.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { StrictMode, startTransition, useEffect } from 'react';
44
import { hydrateRoot } from 'react-dom/client';
55
import { I18nextProvider } from 'react-i18next';
66

7-
import { clientServices } from './services/init.client';
7+
import { i18nextClientService } from './services/init.client';
88
import { getClientEnv } from './utils/environment';
99

1010
Sentry.init({
@@ -58,7 +58,6 @@ function isBrowserExtensionError(exception: unknown): boolean {
5858
}
5959

6060
async function hydrate() {
61-
const { i18nextClientService } = clientServices;
6261
const i18next = await i18nextClientService.getI18nextClientInstance();
6362

6463
startTransition(() => {

0 commit comments

Comments
 (0)