Skip to content

Commit 3ce39e7

Browse files
authored
Merge pull request #38051 from github/repo-sync
Repo sync
2 parents 177e947 + 4cecc07 commit 3ce39e7

File tree

6 files changed

+19
-21
lines changed

6 files changed

+19
-21
lines changed

src/events/middleware.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ const sentValidationErrors = new QuickLRU({
3838
maxAge: 1000 * 60,
3939
})
4040

41+
// We use a LRU cache & a hash of the error message
42+
// to prevent sending multiple validation errors that can spam requests to Hydro
43+
const getValidationErrorHash = (validateErrors: ErrorObject[]) => {
44+
// limit to 10 second windows
45+
const window: Number = Math.floor(new Date().getTime() / 10000)
46+
return `${window}:${(validateErrors || [])
47+
.map((error: ErrorObject) => error.message + error.instancePath + JSON.stringify(error.params))
48+
.join(':')}`
49+
}
50+
4151
router.post(
4252
'/',
4353
catchMiddlewareError(async function postEvents(req: ExtendedRequest, res: Response) {
@@ -47,15 +57,6 @@ router.post(
4757
const validEvents: any[] = []
4858
const validationErrors: any[] = []
4959

50-
// We use a LRU cache & a hash of the request IP + error message
51-
// to prevent sending multiple validation errors per user that can spam requests to Hydro
52-
const getValidationErrorHash = (validateErrors: ErrorObject[]) =>
53-
`${req.ip}:${(validateErrors || [])
54-
.map(
55-
(error: ErrorObject) => error.message + error.instancePath + JSON.stringify(error.params),
56-
)
57-
.join(':')}`
58-
5960
for (const eventBody of eventsToProcess) {
6061
try {
6162
// Skip event if it doesn't have a type or if the type is not in the allowed types

src/frame/middleware/render-page.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export default async function renderPage(req: ExtendedRequest, res: Response) {
7575

7676
statsd.increment(STATSD_KEY_404, 1, [
7777
`url:${req.url}`,
78-
`ip:${req.ip}`,
7978
`path:${req.path}`,
8079
`referer:${req.headers.referer || ''}`,
8180
])

src/search/components/input/SearchOverlay.module.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
width: searchVariables.$smSearchOverlayWidth !important;
2424
max-width: 100%;
2525
height: auto;
26-
max-height: 90vh;
26+
max-height: 95vh;
2727
overflow-y: auto;
2828

2929
display: flex;
@@ -67,6 +67,12 @@
6767
padding: 5px 16px 13px 16px;
6868
width: 100%;
6969
background-color: var(--overlay-bgColor);
70+
overflow-y: auto;
71+
min-height: 15vh;
72+
73+
@include breakpoint(sm) {
74+
min-height: fit-content !important;
75+
}
7076
}
7177

7278
.betaToken {

src/shielding/middleware/handle-invalid-nextjs-paths.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function handleInvalidNextPaths(
2323
) {
2424
defaultCacheControl(res)
2525

26-
const tags = [`ip:${req.ip}`, `path:${req.path}`]
26+
const tags = [`path:${req.path}`]
2727
statsd.increment(STATSD_KEY, 1, tags)
2828

2929
return res.status(404).type('text').send('Not found')

src/shielding/middleware/handle-invalid-query-string-values.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,7 @@ export default function handleInvalidQuerystringValues(
6262
if (sp.toString()) newURL += `?${sp}`
6363
res.redirect(302, newURL)
6464

65-
const tags = [
66-
'response:302',
67-
`url:${req.url}`,
68-
`ip:${req.ip}`,
69-
`path:${req.path}`,
70-
`key:${key}`,
71-
]
65+
const tags = ['response:302', `url:${req.url}`, `path:${req.path}`, `key:${key}`]
7266
statsd.increment(STATSD_KEY, 1, tags)
7367

7468
return

src/shielding/middleware/handle-invalid-query-strings.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ export default function handleInvalidQuerystrings(
8080
const tags = [
8181
'response:400',
8282
`url:${req.url}`,
83-
`ip:${req.ip}`,
8483
`path:${req.path}`,
8584
`keys:${originalKeys.length}`,
8685
]
@@ -123,7 +122,6 @@ export default function handleInvalidQuerystrings(
123122
const tags = [
124123
'response:302',
125124
`url:${req.url}`,
126-
`ip:${req.ip}`,
127125
`path:${req.path}`,
128126
`keys:${originalKeys.length}`,
129127
]

0 commit comments

Comments
 (0)