@open-mercato/onboarding 0.6.6-develop.6429.1.2fba7258d1 → 0.6.6-develop.6450.1.b493fb430c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/onboarding/lib/consentClientIp.ts"],
|
|
4
|
-
"sourcesContent": ["import { getCachedRateLimiterService } from '@open-mercato/core/bootstrap'\nimport { getClientIp } from '@open-mercato/shared/lib/ratelimit/helpers'\n\n/**\n * Resolve the client IP to persist on a legal-consent record, honoring the\n * deployment-wide reverse-proxy trust depth (`RATE_LIMIT_TRUST_PROXY_DEPTH`)\n * exposed by the rate limiter service instead of a hardcoded depth. When the\n * trust depth is unknown, return null so
|
|
4
|
+
"sourcesContent": ["import { getCachedRateLimiterService } from '@open-mercato/core/bootstrap'\nimport { getClientIp } from '@open-mercato/shared/lib/ratelimit/helpers'\n\n/**\n * Resolve the client IP to persist on a legal-consent record, honoring the\n * deployment-wide reverse-proxy trust depth (`RATE_LIMIT_TRUST_PROXY_DEPTH`)\n * exposed by the rate limiter service instead of a hardcoded depth. When the\n * trust depth is unknown, return null so spoofable proxy headers are never\n * signed into the consent integrity hash.\n */\nexport function resolveConsentClientIp(req: Request): string | null {\n const rateLimiterService = getCachedRateLimiterService()\n if (!rateLimiterService) return null\n return getClientIp(req, rateLimiterService.trustProxyDepth) ?? null\n}\n"],
|
|
5
5
|
"mappings": "AAAA,SAAS,mCAAmC;AAC5C,SAAS,mBAAmB;AASrB,SAAS,uBAAuB,KAA6B;AAClE,QAAM,qBAAqB,4BAA4B;AACvD,MAAI,CAAC,mBAAoB,QAAO;AAChC,SAAO,YAAY,KAAK,mBAAmB,eAAe,KAAK;AACjE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/onboarding",
|
|
3
|
-
"version": "0.6.6-develop.
|
|
3
|
+
"version": "0.6.6-develop.6450.1.b493fb430c",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -70,10 +70,10 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@open-mercato/shared": "0.6.6-develop.
|
|
73
|
+
"@open-mercato/shared": "0.6.6-develop.6450.1.b493fb430c"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@open-mercato/shared": "0.6.6-develop.
|
|
76
|
+
"@open-mercato/shared": "0.6.6-develop.6450.1.b493fb430c",
|
|
77
77
|
"@types/jest": "^30.0.0",
|
|
78
78
|
"jest": "^30.4.2",
|
|
79
79
|
"ts-jest": "^29.4.11",
|
|
@@ -33,10 +33,10 @@ describe('resolveConsentClientIp', () => {
|
|
|
33
33
|
expect(resolveConsentClientIp(req)).toBe('edge')
|
|
34
34
|
})
|
|
35
35
|
|
|
36
|
-
it('
|
|
36
|
+
it('ignores X-Real-IP when no proxy is trusted', () => {
|
|
37
37
|
getCachedRateLimiterService.mockReturnValue({ trustProxyDepth: 0 })
|
|
38
38
|
const req = makeRequest({ 'x-forwarded-for': '6.6.6.6', 'x-real-ip': '10.0.0.5' })
|
|
39
|
-
expect(resolveConsentClientIp(req)).
|
|
39
|
+
expect(resolveConsentClientIp(req)).toBeNull()
|
|
40
40
|
})
|
|
41
41
|
|
|
42
42
|
it('returns null when the rate limiter service is unavailable', () => {
|
|
@@ -5,8 +5,8 @@ import { getClientIp } from '@open-mercato/shared/lib/ratelimit/helpers'
|
|
|
5
5
|
* Resolve the client IP to persist on a legal-consent record, honoring the
|
|
6
6
|
* deployment-wide reverse-proxy trust depth (`RATE_LIMIT_TRUST_PROXY_DEPTH`)
|
|
7
7
|
* exposed by the rate limiter service instead of a hardcoded depth. When the
|
|
8
|
-
* trust depth is unknown, return null so
|
|
9
|
-
*
|
|
8
|
+
* trust depth is unknown, return null so spoofable proxy headers are never
|
|
9
|
+
* signed into the consent integrity hash.
|
|
10
10
|
*/
|
|
11
11
|
export function resolveConsentClientIp(req: Request): string | null {
|
|
12
12
|
const rateLimiterService = getCachedRateLimiterService()
|