Giter VIP home page Giter VIP logo

Comments (9)

wtrocki avatar wtrocki commented on May 24, 2024 1

There are two things here:

General practice

Generally, passing userID from the client doesn't seem to be secure and good practice. Encryption itself is guaranteed on transport level - https. Mentioned hashing can be the way to validate if the requested userID, matches the session user ID (however this might be a redundant operation)

Solution for schema modification

If there is any unknown motive to go with the encryption I think this could be done using Graphback plugins: https://graphback.dev/docs/plugins/create

Basically, in the plugin, we can alter schema as we want (and underlying resolvers as well).
In plugins, we can also wrap resolvers etc.

Alternative will be to wrap resolvers and schema in your application after they are returned from Graphback - this will work if we want this behavior for certain things that will require numerous if operations in the plugin itself (that tends to be generic)

To do that simply print out resolvers object to see structure. As for schema you can use GraphQL-Compose (plugins include graphql compose so it will be in your project anyway)

from graphback.

wtrocki avatar wtrocki commented on May 24, 2024

Sounds like XY problem. What we are trying to achieve with this hashing?

Graphback returns object containing resolvers so wrapping is trivial

from graphback.

dijbi avatar dijbi commented on May 24, 2024

Thanks for the reply.

Haven't heard about the XY problem... i got some readings to do.

What i want to achieve with the hashing/encryption.

  • first endpoint GraphQL express : personnal data including a userID (i can query but i don't own)
  • second endpoint : Additional Data on User (where the userID has to be encrypted)
  • gateway where the stitching takes place.

Since i want to create as many endpoints with additional user data & encryption, my best bet is to :

  • create the CRUD schema with Graphback.
  • add the Cypher/Encryption plugin to the newly created schema with Resolvers/Query/Mutations.
  • add the newly endoint to the gateway without the gateway knowing about encryption/hashing.

Since the queries would most likely be ;

User {
 userdatafield
  additionnalData {
    field1
    field2
  }
}

I thought that having a hash of the userID inside the graphback endpoint would decrease the request time. But i still want to have a encrypted userID inside the graphback endpoint to compute (possible but it doesn't matter if it is time consuming) the userID.

Since graphql-compose wrapResolver used a ObjectTC to do the wrapping, i was wondering if we could access the ObjectTC in the graphback component (graphbackmedata??)

from graphback.

arnab15 avatar arnab15 commented on May 24, 2024

hello,
I have knowledge of javascript ,nodejs,reactjs,expressjs, Mongodb but I haven't contributed to any open-source project before so I'm a beginner. I would like to contribute to this project.
how should I start can anyone suggest to me the way should I start contributing.

from graphback.

craicoverflow avatar craicoverflow commented on May 24, 2024

Hi @arnab15 - please use the discussions page to ask this question as your question is unrelated to this issue.

from graphback.

arnab15 avatar arnab15 commented on May 24, 2024

@craicoverflow thanks.

from graphback.

dijbi avatar dijbi commented on May 24, 2024

@wtrocki Thanks a lot for the detailled answer.

To follow the wrapping issue, there is no Resolvers attached to an ObjectType (via ObjectTypeComposer (OTC) functions) per se in the graphback GraphbackCoreMetadata object.

Fetching for the ObjectType Resolvers with
schemaComposer.getOTC(modelName),getResolvers() .
yields no attached resolvers.

Using wrapping functions of graphql-compose is therefore not possible.

Is it by design ?

from graphback.

wtrocki avatar wtrocki commented on May 24, 2024

We encourage developers to use good GraphQL application patterns. Meaning that we do not provide an executable schema that one cannot edit (black box). We split resolvers and schema so developers have the freedom to wrap things and control how they build schema using Apollo, GraphQL-Tools, GraphQL-js you name it.

If you looking into building plugin for your case then our plugins API have a dedicated place for dealing with resolvers:
https://graphback.dev/docs/plugins/create#createresolvers

There is no need to use schemaComposer apart from actual schema changes.

from graphback.

dijbi avatar dijbi commented on May 24, 2024

Ok Thanks a lot. The graphback plugin system seems adequate for various use cases .

from graphback.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.