Skip to content

Commit

Permalink
Merge branch 'master' into douglasduteil/chore-tsc-add-noPropertyAcce…
Browse files Browse the repository at this point in the history
…ssFromIndexSignature-option
  • Loading branch information
douglasduteil authored Sep 17, 2024
2 parents 4538853 + 3e640dd commit 31b61a2
Show file tree
Hide file tree
Showing 59 changed files with 65 additions and 151 deletions.
3 changes: 0 additions & 3 deletions src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export const {
MAGIC_LINK_TOKEN_EXPIRATION_DURATION_IN_MINUTES,
MAX_DURATION_BETWEEN_TWO_EMAIL_ADDRESS_VERIFICATION_IN_MINUTES,
MAX_SUGGESTED_ORGANIZATIONS,
MODERATION_TAG,
MONCOMPTEPRO_HOST,
MONCOMPTEPRO_LABEL,
NODE_ENV,
Expand All @@ -75,8 +74,6 @@ export const {
TEST_CONTACT_EMAIL,
TRUSTED_BROWSER_COOKIE_MAX_AGE_IN_SECONDS,
VERIFY_EMAIL_TOKEN_EXPIRATION_DURATION_IN_MINUTES,
ZAMMAD_TOKEN,
ZAMMAD_URL,
} = parsedEnv.data;

export const MONCOMPTEPRO_IDENTIFIER = new URL(MONCOMPTEPRO_HOST).hostname;
3 changes: 0 additions & 3 deletions src/config/env.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { defaultJWKS } from "./default-jwks";
export const emailEnvSchema = z.object({
BREVO_API_KEY: z.string().optional(),
DO_NOT_SEND_MAIL: zodTrueFalseBoolean().default("True"),
ZAMMAD_TOKEN: z.string().optional(),
ZAMMAD_URL: z.string().url().default("https://support.etalab.gouv.fr"),
});

export const connectorEnvSchema = z.object({
Expand Down Expand Up @@ -83,7 +81,6 @@ export const paramsEnvSchema = z.object({
.nonnegative()
.default(3 * 30 * 24 * 60), // 3 months in minutes
MAX_SUGGESTED_ORGANIZATIONS: z.coerce.number().int().nonnegative().default(3),
MODERATION_TAG: z.string().default("github-action-e2e-test"),
MONCOMPTEPRO_HOST: z.string().url().default("http://localhost:3000"),
MONCOMPTEPRO_LABEL: z.string().default("MonComptePro"),
NODE_ENV: z
Expand Down
4 changes: 2 additions & 2 deletions src/config/oidc-provider-configuration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Request } from "express";
import { Configuration } from "oidc-provider";
import type { Request } from "express";
import type { Configuration } from "oidc-provider";
import { destroyAuthenticatedSession } from "../managers/session/authenticated";
import epochTime from "../services/epoch-time";
import { findAccount } from "../services/oidc-account-adapter";
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/api-annuaire-education-nationale.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios, { AxiosError, AxiosResponse } from "axios";
import axios, { AxiosError, type AxiosResponse } from "axios";
import { isEmpty, isString } from "lodash-es";
import {
DO_NOT_USE_ANNUAIRE_EMAILS,
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/api-annuaire-service-public.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios, { AxiosError, AxiosResponse } from "axios";
import axios, { AxiosError, type AxiosResponse } from "axios";
import { isEmpty, isString } from "lodash-es";
import {
DO_NOT_USE_ANNUAIRE_EMAILS,
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/api-sirene/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios, { AxiosError, AxiosResponse } from "axios";
import axios, { AxiosError, type AxiosResponse } from "axios";
import { cloneDeep, set } from "lodash-es";
import {
HTTP_CLIENT_TIMEOUT,
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/brevo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios, { AxiosError, AxiosResponse } from "axios";
import axios, { AxiosError, type AxiosResponse } from "axios";
import { chain, isEmpty } from "lodash-es";
import path from "path";
import { BREVO_API_KEY, DO_NOT_SEND_MAIL } from "../config/env";
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/crisp.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//

import { fetch_crisp, type Config } from "@numerique-gouv/crisp";
import {
import type {
CreateConversationRoute,
SendMessageInAConversationRoute,
UpdateConversationMetaRoute,
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/debounce.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios, { AxiosResponse } from "axios";
import axios, { type AxiosResponse } from "axios";
import {
DEBOUNCE_API_KEY,
DO_NOT_CHECK_EMAIL_DELIVERABILITY,
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/github-passkey-authenticator-aaguids.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Sentry from "@sentry/node";
import axios, { AxiosResponse } from "axios";
import axios, { type AxiosResponse } from "axios";
import { mapValues, memoize } from "lodash-es";
import { HTTP_CLIENT_TIMEOUT } from "../config/env";
import { logger } from "../services/log";
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/redis.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
default as Redis,
default as RedisClient,
RedisOptions,
type RedisOptions,
} from "ioredis";
import { REDIS_URL } from "../config/env";
import { logger } from "../services/log";
Expand Down
81 changes: 0 additions & 81 deletions src/connectors/send-zammad-mail.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/controllers/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import HttpErrors from "http-errors";
import { z, ZodError } from "zod";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/interaction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import Provider, { errors } from "oidc-provider";
import { ENABLE_FIXED_ACR } from "../config/env";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import HttpErrors from "http-errors";
import { isEmpty } from "lodash-es";
import moment from "moment/moment";
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/organization.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import HttpErrors from "http-errors";
import { isEmpty } from "lodash-es";
import { z, ZodError } from "zod";
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/totp.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import { z } from "zod";
import { InvalidTotpTokenError, NotFoundError } from "../config/errors";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/user/2fa-sign-in.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import {
getUserFromAuthenticatedSession,
isPasskeyAuthenticatedSession,
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/user/delete.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import {
destroyAuthenticatedSession,
getUserFromAuthenticatedSession,
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/user/issue-session-or-redirect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import { getTrustedReferrerPath } from "../../services/security";

export const issueSessionOrRedirectController = async (
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/user/magic-link.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import { z, ZodError } from "zod";
import { MONCOMPTEPRO_HOST } from "../../config/env";
import { InvalidEmailError, InvalidMagicLinkError } from "../../config/errors";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { to } from "await-to-js";
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import { z } from "zod";
import {
ApiAnnuaireError,
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/user/select-organization.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import { z } from "zod";
import {
getOrganizationsByUserId,
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/user/signin-signup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Sentry from "@sentry/node";
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import { z, ZodError } from "zod";
import { DISPLAY_TEST_ENV_WARNING } from "../../config/env";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/user/update-password.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Sentry from "@sentry/node";
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import { z, ZodError } from "zod";
import { MONCOMPTEPRO_HOST } from "../../config/env";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/user/update-personal-informations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import { z, ZodError } from "zod";
import {
getUserFromAuthenticatedSession,
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/user/verify-email.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import { z, ZodError } from "zod";
import {
InvalidTokenError,
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/user/welcome.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import {
getUserFromAuthenticatedSession,
updateUserInAuthenticatedSession,
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/webauthn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type {
AuthenticationResponseJSON,
RegistrationResponseJSON,
} from "@simplewebauthn/types";
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import HttpErrors from "http-errors";
import { z, ZodError } from "zod";
import {
Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import * as Sentry from "@sentry/node";
import RedisStore from "connect-redis";
import express, { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import express from "express";
import session from "express-session";
import fs from "fs";
import helmet from "helmet";
import { Server } from "http";
import HttpErrors from "http-errors";
import { isNull, omitBy } from "lodash-es";
import morgan from "morgan";
import Provider, { ClientMetadata, errors } from "oidc-provider";
import Provider, { type ClientMetadata, errors } from "oidc-provider";
import path from "path";
import { ZodError } from "zod";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/managers/browser-authentication.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cookieParser from "cookie-parser";
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import {
DO_NOT_AUTHENTICATE_BROWSER,
SECURE_COOKIES,
Expand Down
2 changes: 1 addition & 1 deletion src/managers/oidc-client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Sentry from "@sentry/node";
import { isEmpty, isString } from "lodash-es";
import { KoaContextWithOIDC } from "oidc-provider";
import type { KoaContextWithOIDC } from "oidc-provider";
import { NotFoundError } from "../config/errors";
import {
addConnection,
Expand Down
6 changes: 3 additions & 3 deletions src/managers/session/authenticated.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Sentry from "@sentry/node";
import { Request, Response } from "express";
import { Session, SessionData } from "express-session";
import type { Request, Response } from "express";
import { Session, type SessionData } from "express-session";
import { isEmpty } from "lodash-es";
import { RECENT_LOGIN_INTERVAL_IN_SECONDS } from "../../config/env";
import { UserNotLoggedInError } from "../../config/errors";
Expand All @@ -12,7 +12,7 @@ import {
isOneFactorAuthenticated,
isTwoFactorAuthenticated,
} from "../../services/security";
import {
import type {
AmrValue,
AuthenticatedSessionData,
} from "../../types/express-session";
Expand Down
2 changes: 1 addition & 1 deletion src/managers/session/dirty-ds-redirect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Request } from "express";
import type { Request } from "express";
import { UserNotLoggedInError } from "../../config/errors";
import { isWithinAuthenticatedSession } from "./authenticated";

Expand Down
2 changes: 1 addition & 1 deletion src/managers/session/temporary-totp-key.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Request } from "express";
import type { Request } from "express";
import { SYMMETRIC_ENCRYPTION_KEY } from "../../config/env";
import { UserNotLoggedInError } from "../../config/errors";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/managers/session/unauthenticated.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Request } from "express";
import type { Request } from "express";
import { isEmpty } from "lodash-es";
import { NoEmailFoundInLoggedOutSessionError } from "../../config/errors";
import { findByEmail, update } from "../../repositories/user";
Expand Down
4 changes: 2 additions & 2 deletions src/managers/webauthn.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
generateAuthenticationOptions,
generateRegistrationOptions,
VerifiedAuthenticationResponse,
VerifiedRegistrationResponse,
type VerifiedAuthenticationResponse,
type VerifiedRegistrationResponse,
verifyAuthenticationResponse,
verifyRegistrationResponse,
} from "@simplewebauthn/server";
Expand Down
4 changes: 2 additions & 2 deletions src/middlewares/connection-count.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Sentry from "@sentry/node";
import { NextFunction } from "express";
import { KoaContextWithOIDC } from "oidc-provider";
import type { NextFunction } from "express";
import type { KoaContextWithOIDC } from "oidc-provider";
import { recordNewConnection } from "../managers/oidc-client";
import { logger } from "../services/log";

Expand Down
2 changes: 1 addition & 1 deletion src/middlewares/csrf-protection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { csrfSync } from "csrf-sync";
import { Request } from "express";
import type { Request } from "express";

const { generateToken, csrfSynchronisedProtection } = csrfSync({
getTokenFromRequest: (req: Request) => {
Expand Down
2 changes: 1 addition & 1 deletion src/middlewares/rate-limiter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Sentry from "@sentry/node";
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import HttpErrors from "http-errors";
import { RateLimiterRedis } from "rate-limiter-flexible";
import { DO_NOT_RATE_LIMIT } from "../config/env";
Expand Down
2 changes: 1 addition & 1 deletion src/middlewares/user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextFunction, Request, Response } from "express";
import type { NextFunction, Request, Response } from "express";
import HttpErrors from "http-errors";
import { isEmpty } from "lodash-es";
import { UserNotFoundError } from "../config/errors";
Expand Down
Loading

0 comments on commit 31b61a2

Please sign in to comment.