parse-community / parse-community/parse-server
No IP address in request when `directAccess: true`
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server.
Issue Description
When setting the Parse Server option directAccess: true, the request object in triggers have no IP address set.
This could be considered a characteristic of the direct access feature, but there are a few test cases that expect the IP address to be set, so it should probably be considered a bug.
All these tests pass, only because the test suite does not actually use the ParseServerRESTController because the test helper always sets the normal REST controller:
See https://github.com/parse-community/parse-server/issues/8808 for context about this override.
Steps to reproduce
- Set Parse Server option
directAccess: true. - Save a Parse.User.
- The
requestobject inParse.Cloud.beforeSave('_User', async request => { ... });has the propertyrequest.ipset toundefined.
Actual Outcome
request.ip set to undefined
Expected Outcome
request.ip set to localhost, e.g. 127.0.0.1 in IPv4 environments or ::1 in IPv6 environments.
Possibly just set the IP with a simple:
function getLoopbackAddress() {
const isIPv6Supported = os.networkInterfaces().lo0?.some(iface => iface.family === 'IPv6');
return isIPv6Supported ? '::1' : '127.0.0.1';
}
Environment
Server
- Parse Server version:
6.3.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/ParseServerRESTController.js and the controller override in spec/helper.js, then inspect the referenced cases in spec/CloudCode.spec.js. Run the direct-access trigger tests and verify that request.ip is populated with the expected loopback address rather than undefined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100