Skip to content

Default masterKeyIps does not work on localhost #8316

Closed

Description

@dblythy

New Issue Checklist

Issue Description

Introduced in #8281, the new default does not allow local IPs.

This is due to the fact that getClientIp returns an ipv6 IP (::1), whereas the masterKeyIps default is 127.0.0.1

Steps to reproduce

Run a local instance of Parse Server alpha with Dashboard

Actual Outcome

Dashboard should load

Expected Outcome

"MasterKey is required"

Environment

Server

  • Parse Server version: alpha
  • Operating system: macos
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): localhost

Database

  • System (MongoDB or Postgres): mongo
  • Database version: 5.0
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): atlas

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): js
  • SDK version: 3.4.4

Logs

Activity

  1. parse-github-assistant commented on Nov 15, 2022

    @parse-github-assistant

    Thanks for opening this issue!

    • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.
  2. dblythy commented on Nov 15, 2022

    @dblythy
    MemberAuthor

    Solution is to change the default to ::1, or resolve getClientIp to an ipv4 address

  3. mtrezza commented on Nov 15, 2022

    @mtrezza
    Member

    Solution is to change the default to ::1

    How would that work on a machine where IPv6 is not enabled? Can't we just add both values as default? ['::1','127.0.0.1']

  4. added
    type:bugImpaired feature or lacking behavior that is likely assumed
    block:majorNeeds to be resolved before next major release; remove label afterwards
    on Nov 15, 2022
  5. dblythy commented on Nov 15, 2022

    @dblythy
    MemberAuthor

    Yes, that would fix it also. Should masterKeyIps always allow localhost? Otherwise developer will have to configure masterKeyIps: ["::1", "127.0.0.1", "ip", "ip"],

    I'm thinking internally it should be allowedIps = ["::1", "127.0.0.1", ...config.masterKeyIps],, masterKeyIps can default to [] (localhost only)

  6. mtrezza commented on Nov 15, 2022

    @mtrezza
    Member

    Should masterKeyIps always allow localhost?

    Why?

  7. dblythy commented on Nov 15, 2022

    @dblythy
    MemberAuthor

    I think it would be expected that masterKeyIps is external ips, and that cloud code, code run on the same instance as Parse Server, should always be allowed.

  8. mtrezza commented on Nov 15, 2022

    @mtrezza
    Member

    How can the use of masterKey be completely disabled?

  9. dblythy commented on Nov 15, 2022

    @dblythy
    MemberAuthor

    Maybe by not setting a masterKey?

  10. mtrezza commented on Nov 15, 2022

    @mtrezza
    Member

    Does Parse Server start without masterkey?

  11. dblythy commented on Nov 16, 2022

    @dblythy
    MemberAuthor

    Not at the moment

  12. mtrezza commented on Nov 16, 2022

    @mtrezza
    Member

    Then setting masterKeyIps to an empty array is the only way at the moment. So I'd say we should not set localhost as a non-removable allow-entry.

  13. parseplatformorg commented on Nov 25, 2022

    @parseplatformorg
    Contributor

    🎉 This change has been released in version 6.0.0-alpha.11

  14. stewones commented on Nov 27, 2022

    @stewones
    Contributor

    Then setting masterKeyIps to an empty array is the only way at the moment. So I'd say we should not set localhost as a non-removable allow-entry.

    it's not working currently @mtrezza

    sent a PR to fix #8339

  15. dblythy commented on Nov 28, 2022

    @dblythy
    MemberAuthor

    So I'd say we should not set localhost as a non-removable allow-entry.

    I think we missed that still though, as the default options are always concatenated to any additional set masterKeyIps

    https://github.com/parse-community/parse-server/blob/alpha/src/ParseServer.js#L471-L473

  16. mtrezza commented on Nov 28, 2022

    @mtrezza
    Member

    Oh, did #8339 aim to fix that and remove the concatenation? I reopened.

  17. dblythy commented on Nov 28, 2022

    @dblythy
    MemberAuthor

    I don't think so, I think #8339 was designed to make masterKeyIps: [] === access from anywhere, which is incorrect. We can open a new PR fixing the concatenation

  18. stewones commented on Nov 28, 2022

    @stewones
    Contributor

    I don't think so, I think #8339 was designed to make masterKeyIps: [] === access from anywhere, which is incorrect. We can open a new PR fixing the concatenation

    sort of, I misunderstood the idea initially but I think it's ok now. please take a 2nd look at the PR

  19. parseplatformorg commented on Jan 31, 2023

    @parseplatformorg
    Contributor

    🎉 This change has been released in version 6.0.0-beta.1

  20. parseplatformorg commented on Jan 31, 2023

    @parseplatformorg
    Contributor

    🎉 This change has been released in version 6.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    block:majorNeeds to be resolved before next major release; remove label afterwardsstate:releasedReleased as stable versionstate:released-alphaReleased as alpha versionstate:released-betaReleased as beta versiontype:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions