Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions services/api/src/abuse/gps-sanity.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import type { AbuseChecks } from "@civfix/shared/interfaces"
import type { LatLng } from "@civfix/shared"

export const CF_LAT_HEADER = "cf-iplatitude"
export const CF_LNG_HEADER = "cf-iplongitude"
const CF_LAT_HEADER = "cf-iplatitude"
const CF_LNG_HEADER = "cf-iplongitude"
export const CF_CITY_HEADER = "cf-ipcity"

const MAX_ABS_LATITUDE = 90
const MAX_ABS_LONGITUDE = 180

export type HeaderBag = Record<string, string | string[] | undefined>

export function headerValue(headers: HeaderBag, name: string): string | null {
Expand All @@ -22,7 +25,7 @@ export function parseCfGeo(headers: HeaderBag): LatLng | null {
const lat = Number.parseFloat(latRaw)
const lng = Number.parseFloat(lngRaw)
if (!Number.isFinite(lat) || !Number.isFinite(lng)) return null
if (lat < -90 || lat > 90 || lng < -180 || lng > 180) return null
if (Math.abs(lat) > MAX_ABS_LATITUDE || Math.abs(lng) > MAX_ABS_LONGITUDE) return null
return { lat, lng }
}

Expand Down
2 changes: 1 addition & 1 deletion services/api/src/abuse/h3-cap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const ABUSE_H3_RES = 10

export const H3_CELL_LIMIT_PER_HOUR = 30

export const H3_WINDOW_SECONDS = 60 * 60
const H3_WINDOW_SECONDS = 60 * 60

const H3_COUNTER_PREFIX = "abuse:h3:"

Expand Down
2 changes: 1 addition & 1 deletion services/api/src/adapters/jobs.pgboss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { OUTREACH_DIGEST_JOB } from "../services/admin/jurisdiction-contacts-typ
import { INBOUND_SWEEP_JOB } from "../services/admin/inbound-jobs.js"
import { REPORT_AUTOFORWARD_JOB } from "../services/report-service.types.js"
import { DATA_EXPORT_JOB } from "../services/data-export-jobs.js"
import { CLEANUP_CANCEL_FANOUT_JOB } from "../services/cleanup-service.js"
import { CLEANUP_CANCEL_FANOUT_JOB } from "../services/cleanup-notifications.js"
import {
CLEANUP_GUEST_UPDATE_FANOUT_JOB,
GUEST_RETENTION_SWEEP_JOB,
Expand Down
Loading
Loading