Repository navigation
Conversation
Since the Flowise 3.0.11 upgrade the server reads TRUST_PROXY, not NUMBER_OF_PROXIES. Unset means trust proxy=true, which takes the leftmost X-Forwarded-For entry and lets callers bypass per-chatflow rate limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Anyone can bypass the per-chatflow rate limit on
/api/v1/predictionby sending a differentX-Forwarded-Foron each request.The limiter counts by
req.ip. Since the Flowise 3.0.11 upgrade (merge 7a0d0a7), the server setstrust proxyfromTRUST_PROXY, and when that variable is unset it usestrue(packages/server/src/index.ts:181-193, from upstream FlowiseAI#4454). Withtrue, Express takes the leftmostX-Forwarded-Forentry as the client IP, and the client writes that entry. The AWS ALB appends the real IP at the right, it does not replace the header.Before the upgrade, AAI set
trust proxyfromNUMBER_OF_PROXIES. The copilot manifest still setsNUMBER_OF_PROXIES: '1', but the code no longer reads it, andTRUST_PROXYis not set. express-rate-limit logsERR_ERL_PERMISSIVE_TRUST_PROXYfor exactly this.Checked on 2026-11-11, one read-only request per host:
GET /api/v1/ipwithX-Forwarded-For: 6.6.6.6returns{"ip":"6.6.6.6"}onapi.staging.ias.theanswer.ai,api.ias.theanswer.aiandprod.studio.theanswer.ai.What changes
One variable in
copilot/flowise/manifest.yml:TRUST_PROXY: '1', so Express trusts exactly one proxy (the ALB) and takes the IP the ALB appended. No code change.TRUST_PROXYis the upstream setting (FlowiseAI#5226), so future upstream merges don't conflict.Verification (local, real server)
Real server build, Postgres 16 + Redis 7, a local stand-in for the ALB in "append" mode, and a chatflow with
apiConfig.rateLimit2/60s.500= the limiter let the request through (the test flow is empty),429= limited.TRUST_PROXYunset (today)TRUST_PROXY=1/api/v1/ipwithX-Forwarded-For: 6.6.6.66.6.6.6X-Forwarded-For, 4 callsMutation testing (Stryker 8.7.1, local only) on
index.ts:181-193, where each mutant booted the real server withTRUST_PROXY=1and ran the checks above: 28 mutants, 10 killed, 18 survived. Every surviving mutant only changes theundefined/ blank /'true'/'false'branches or widens the numeric check, which'1'never takes. Every mutant that changes what'1'resolves to was killed.Conditions this depends on
routing.http.xff_client_port.enabled). Withip:portin the header the limit is bypassed again (reproduced locally). Today/api/v1/ipon IAS staging and prod returns the IP with no port./api/v1/*. The live security groups still need a check with AWS access.Not covered
AnswerAI prod (
prod.studio.theanswer.ai) runs on Render behind Cloudflare, not on copilot, and has the same bypass. The hop count there is not documented and the Render staging service is suspended, so this PR does not touchrender.yaml. That needs its own decision.After merge
Deploy to
staging.ias, then call/api/v1/ipwithX-Forwarded-For: 6.6.6.6three times: it must return your real IP with no port. Then deploy IAS prod and repeat onapi.ias.theanswer.ai.🤖 Generated with Claude Code