Skip to content

Move /models /routes to explorer middleware #1134

Closed

Description

@ritch

This issue raises the concern for these routes always being available. They should not be available from a vanilla use of loopback.rest(). Instead whatever is using them (I'm assuming explorer) should add them or turn them on.

Activity

  1. bajtos commented on Feb 25, 2015

    @bajtos
    Member

    Note: loopback-explorer does not use this routes, it has it's own routes for ages. If there was not a backwards-compatibility concern, I would say the routes can be immediately deleted.

    I am proposing to add a flag that will control whether these routes are added or not. This new flag should be:

    • Enabled by default to preserve backwards compatibility.
    • Deprecated from the beginning, so that users are warned about this problem. Use depd for deprecation, that's what express uses too.
    • Disabled in the configuration scaffolded by slc loopback via loopback-workspace. That way new applications come without these routes.
  2. greaterweb commented on Feb 25, 2015

    @greaterweb
    Contributor

    Thanks guys for looking into this.

    I can take a stab at the first two items @bajtos has suggested. Depending on time, I might be able to look into the loopback-workspace one as well.

    I'll be sure to include a few tests as good measure.

  3. greaterweb commented on Feb 25, 2015

    @greaterweb
    Contributor

    Enabled by default to preserve backwards compatibility.

    Trying to think through a config option that is meaningful and concise for this one, two options

    • disableLegacyExplorer - (boolean, false by default) seems appropriate but is a bit lengthy - true disables the routes, false or omitting the option keeps them enabled
    • legacyExplorer - (boolean, true by default) this shorter option seems better - false disables the routes, true or omitting the option keeps them enabled

    Thoughts?

  4. greaterweb commented on Feb 25, 2015

    @greaterweb
    Contributor

    Work completed to resolve this in PR. Though I wonder if we should improve the middleware to limit only GET requests.

  5. bajtos commented on Feb 26, 2015

    @bajtos
    Member

    +1 for legacyExplorer, disableLegacyExplorer=false is a double negative which is better to avoid.

    Depending on time, I might be able to look into the loopback-workspace one as well.

    This part is easy, just add a new entry to templates/components/api-server/component.js and a new unit-test to test/end-to-end.js.

  6. greaterweb commented on Feb 26, 2015

    @greaterweb
    Contributor

    @bajtos, no problem. I can make the update to the loopback-workspace project

  7. crandmck commented on Mar 5, 2015

    @crandmck
    Contributor

    Does this require any doc updates or additions?

    Currently, to disable API Explorer, docs just say to delete explorer.js boot script: http://docs.strongloop.com/display/LB/Security+considerations#Securityconsiderations-DisablingAPIExplorer Will that change with this?

    How is the legacyExplorer option exposed?

  8. greaterweb commented on Mar 5, 2015

    @greaterweb
    Contributor

    The instructions for disabling the API Explorer remain valid. This issue was to address two routes remaining exposed which have not been used by the API Explorer for some time.

    The legacyExplorer option is an addition to the the config.json file. When making the upgrade to v2.14.0, it's is a good idea to add "legacyExplorer": false to your config. I'm sure we'll see an update soon to the config.json documentation.

  9. crandmck commented on Mar 5, 2015

    @crandmck
    Contributor

    I'm sure we'll see an update soon to the config.json documentation.

    Heh, that would be my job ;-)
    Please review to see if I explained it correctly:
    http://docs.strongloop.com/display/LB/config.json#config.json-Top-levelproperties
    Thanks!

  10. greaterweb commented on Mar 6, 2015

    @greaterweb
    Contributor

    Ha! Sorry, I did not know :-)

    Thanks for all of the great work documenting, I imagine it's a decent challenge keeping up with all StrongLoop has going on!

    Your addition to the docs looks good, two small changes though:

    Set to false to disable old routes /models and /routes routes that are exposed, but no longer used by API Explorer; use true or omit the option to keep them enabled.

    Thanks!

  11. crandmck commented on Mar 6, 2015

    @crandmck
    Contributor

    Thanks for all of the great work documenting, I imagine it's a decent challenge keeping up with all StrongLoop has going on!

    You're welcome... and, yes, it does keep me quite busy :-)

    Thanks for catching the typo! Fixed...

  12. added a commit that references this issue on Mar 27, 2015
  13. added a commit that references this issue on Apr 25, 2015
  14. bajtos commented on Apr 30, 2015

    @bajtos
    Member

    I am closing this issue as fixed by #1135.

    @ritch feell free to reopen if you have any objections.

  15. gausie commented on Jul 29, 2015

    @gausie
    Contributor

    It would be good to be able to hit a model endpoint with the OPTIONS verb and get the equivalent of its entry in /models.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions