Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to replace nodeId creation logic for specific or all types #2332

Open
3 of 6 tasks
hos opened this issue Jan 23, 2025 · 0 comments
Open
3 of 6 tasks

Ability to replace nodeId creation logic for specific or all types #2332

hos opened this issue Jan 23, 2025 · 0 comments

Comments

@hos
Copy link
Contributor

hos commented Jan 23, 2025

Feature description

It would be very helpful to be able to replace the logic how nodeId is generated for tables or any other autogenerated resources. This will allow us to encrypt or mask restricted content in the nodeId. Which will be especially useful for the projects that are migrating to postgraphile.

Motivating example

Example:

When a resource.primary_key is a restricted information, we want to return to the user the primary key, but encrypted, so only the server can decrypt the value, which will allow us to mask the data but the server will be able to understand what have been masked. In a system where there is already a large code designed around the idea that resource.primary_key is a restricted information, the only thing that is missing is to also hide it in the nodeId. It's possible to introduce a new resource with a primary key which is not related to the original resource and also add a relation between those 2 resources that only the server can access, but it can be easily avoided by allowing us to change the logic of generating and reading the nodeId.

Breaking changes

I'm not await what this will break, but I guess that internally, postgraphile is using the content of the nodeId, so if we are adding an option to replace the logic, maybe we will also need an API which will return the data postgraphile needs? Like

{
  write: (resource) => `any string that the "read" function below understands`,
  read: (nodeId) => ({original: [Type, id], otherExtractedData: 'data' }),
  // The "original" field is what postgraphile needs
}

Supporting development

I [tick all that apply]:

  • am interested in building this feature myself
  • am interested in collaborating on building this feature
  • am willing to help testing this feature before it's released
  • am willing to write a test-driven test suite for this feature (before it exists)
  • am a Graphile sponsor ❤️
  • have an active support or consultancy contract with Graphile
@github-project-automation github-project-automation bot moved this to 🌳 Triage in V5.0.0 Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🌳 Triage
Development

No branches or pull requests

1 participant