这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@carlpaten-ivadolabs
Copy link
Contributor

@carlpaten-ivadolabs carlpaten-ivadolabs commented Oct 6, 2020

Description

Enables the use of Hasura server with custom URI schemes, necessary for e.g. Capacitor.

Changelog

  • CHANGELOG.md is updated with user-facing content relevant to this PR. If no changelog is required, then add the no-changelog-required label.

Affected components

  • Server

Related Issues

#5818

Solution and Design

Accept any non-empty string not containing a colon as a scheme name.

Steps to test and verify

Configure CORS config with an entry starting in e.g. capacitor://.

Limitations, known bugs & workarounds

This probably gives an atrocious error message if the user forgets the colon in the scheme separator.

Server checklist

Catalog upgrade

Does this PR change Hasura Catalog version?

  • No
  • Yes
    • Updated docs with SQL for downgrading the catalog

Metadata

Does this PR add a new Metadata feature?

  • No
  • Yes
    • Does run_sql auto manages the new metadata through schema diffing?
      • Yes
      • Not required
    • Does run_sql auto manages the definitions of metadata on renaming?
      • Yes
      • Not required
    • Does export_metadata/replace_metadata supports the new metadata added?
      • Yes
      • Not required

GraphQL

  • No new GraphQL schema is generated
  • New GraphQL schema is being generated:
    • New types and typenames are correlated

Breaking changes

  • No Breaking changes

  • There are breaking changes:

    1. Metadata API

      Existing query types:

      • Modify args payload which is not backward compatible
      • Behavioural change of the API
      • Change in response JSON schema
      • Change in error code
    2. GraphQL API

      Schema Generation:

      • Change in any NamedType
      • Change in table field names

      Schema Resolve:-

      • Change in treatment of null value for any input fields
    3. Logging

      • Log JSON schema has changed
      • Log type names have changed

@hasura-bot
Copy link
Contributor

Beep boop! 🤖

Hey @LilRed, thanks for your PR!

One of my human friends will review this PR and get back to you as soon as possible.

Stay awesome! 😎

@CLAassistant
Copy link

CLAassistant commented Oct 6, 2020

CLA assistant check
All committers have signed the CLA.

@carlpaten-ivadolabs carlpaten-ivadolabs requested a review from a team as a code owner October 6, 2020 16:00
@shraddhaag shraddhaag added c/server Related to server hacktoberfest labels Oct 7, 2020
@shraddhaag shraddhaag changed the title Support custom URI schemes in CORS config (fix #5818) server: support custom URI schemes in CORS config (fix #5818) Oct 7, 2020
@abooij abooij requested a review from GavinRay97 October 7, 2020 07:55
@abooij abooij added the hacktoberfest-accepted Valid hacktoberfest PR label Oct 12, 2020
@GavinRay97
Copy link
Member

Note from conversation with Auke:

Do we want to modify this to restrict it to only spec-compliant URL schemes?
From a security standpoint, if it's a non-issue, maybe not. But for reference, here's the standards for schemes:

https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Definition

The URI comprises:

A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-). Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. Examples of popular schemes include http, https, ftp, mailto, file, data, and irc. URI schemes should be registered with the Internet Assigned Numbers Authority (IANA), although non-registered schemes are used in practice.[b]

Tl;dr URL scheme = any combination of alphanumeric or +/./- characters

@carlpaten-ivadolabs
Copy link
Contributor Author

I'd be happy to make this change if required, however I would need to set up Hasura server development on my machine. I saw CONTRIBUTING.md, which is helpful. Do you recommend any text editor/plugin combination?

@abooij
Copy link
Contributor

abooij commented Oct 28, 2020

@LilRed Yes, that guide is certainly valuable. In particular, I'd advise you to follow the suggestion to use ghcup to install the correct GHC+cabal versions. And do follow the instructions precisely. In particular it's important to compile the console correctly if you want to test your work. (The Haskell side can be built independently, however a full development environment would also include a working console.)

Editors are, of course, a rather personal choice. Many Haskell developers use emacs. But I'd only recommend that for this project if you are already familiar with that - it's a big beast to learn to use. Visual Studio Code also has a number of packages that make it into an excellent Haskell editor, and offers a perhaps more welcoming experience.

@mehtavishwa30
Copy link
Contributor

Hello @LilRed!

Thanks so much for your contribution to Hasura OSS during the Hacktoberfest 2020! We'd love to send you some Hasura swag as a token of appreciation and you will be getting an email with the swag form shortly. ✨

@sdahlbac
Copy link

what is needed to get this one forward?

@carlpaten-ivadolabs
Copy link
Contributor Author

I haven't yet found the time to do this, things have gotten crazy at work. It's still on my personal backlog but consider it up for grabs.

@netlify
Copy link

netlify bot commented Apr 30, 2021

Deploy preview for hasura-docs ready!

Built with commit d1ee51f

https://deploy-preview-5940--hasura-docs.netlify.app

@carlpaten-ivadolabs
Copy link
Contributor Author

The CI is behaving weirdly, which may be because this is an old PR. I'll close and reopen it.

@hasura-bot
Copy link
Contributor

Beep boop! 🤖

GIF

Awesome work @LilRed!

Your changes were merged successfully. All of us at Hasura ❤️ what you did.

Thanks again 🤗

hasura-bot added a commit that referenced this pull request May 6, 2021
GITHUB_PR_NUMBER: 5940
GITHUB_PR_URL: #5940

Co-authored-by: Carl Patenaude-Poulin <1834919+lilred@users.noreply.github.com>
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
GitOrigin-RevId: 8060a18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c/server Related to server hacktoberfest hacktoberfest-accepted Valid hacktoberfest PR merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants