@@ -7,6 +7,7 @@ import { getCorsResponseHeaders } from './cors';
77import { configureAppProxyTrust } from './trusted-xff-ip-setup' ;
88
99import './connectivity-check' ;
10+ import { reportError } from './errors' ;
1011
1112const app = express ( ) ;
1213
@@ -62,7 +63,8 @@ apiRouter.options('*', (req, res) => {
6263 '/get-billing-data' ,
6364 '/update-team' ,
6465 '/update-team-size' ,
65- '/cancel-subscription'
66+ '/cancel-subscription' ,
67+ '/log-abuse-report'
6668 ] . includes ( req . path ) ) {
6769 // Account APIs are limited to our own hosts:
6870 const headers = getCorsResponseHeaders ( event ) ;
@@ -94,6 +96,16 @@ apiRouter.get('/redirect-paypro-to-thank-you', lambdaWrapper('redirect-paypro-to
9496apiRouter . post ( '/update-team' , lambdaWrapper ( 'update-team' ) ) ;
9597apiRouter . post ( '/update-team-size' , lambdaWrapper ( 'update-team-size' ) ) ;
9698apiRouter . post ( '/cancel-subscription' , lambdaWrapper ( 'cancel-subscription' ) ) ;
99+ apiRouter . post ( '/log-abuse-report' , ( req ) => {
100+ reportError ( `Abuse report` , {
101+ extraMetadata : {
102+ from : req . ip ?. replace ( / \. / g, '-' ) ,
103+ body : req . body
104+ }
105+ } ) ;
106+
107+ return { statusCode : 204 } ;
108+ } ) ;
97109
98110export function startApiServer ( ) {
99111 const server = app . listen ( process . env . PORT ?? 3000 , ( ) => {
0 commit comments