dgraph-io / dgraph-io/dgraph

OIDC/Oauth2 improved implementation

Open
#9,304 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Stale
Dominant language
Go
Stars
21.8k
Forks
1.6k
Avg merge
2d 5h
Merged PRs (30d)
9

Description

Hello thanks for building and supporting this awesome piece of software 🤗

I've being poking with this DB to build a POC and deploy it to prod. Any prod deploy MUST ensure a protected API protection, where OIDC/Oauth2 is a de-facto standard today.

However, as of DGraph v24.0.5 I built a protected schema, but was able to drop my database with an unprotected call 🤦

Here's my protected schema as per your docs:

type Person {
  id: ID!
  xid: String! @id
  name: String!
  age: Int @search
  friends: [Person] @hasInverse(field: "friends")
  ownsPets: [Animal] @hasInverse(field: "owner")
}

type Animal {
  id: ID!
  xid: String! @id
  name: String!
  owner: Person @hasInverse(field: "ownsPets")
}
# Dgraph.Authorization {"header":"X-Dgraph-AuthToken","namespace":"https://dgraph.io/jwt/claims","jwkurl":"https://my-corp.com/.well-known/jwks.json","audience":["mycorp","dgraph"],"closedbydefault":true}

And I've been able to drop all with the following call:

describe('DGraph drop data', async () => {
  it('drop data', async () => {
    await client.alter({ dropAll: true })
  })
})

Would you accept a PR which

  1. Protects API on the request level ?
  2. Deploys a thin 3-d party wrapper around the golang-jwt/v5 lib ?

Thanks in advance and thanks for DGraph again 😄

Environment:
OS: Ubuntu 24.04
Dgraph: v24.0.5
Kubernetes: 1.32.0
dgraph-js-http: 23.0.0-rc1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the unprotected client.alter({ dropAll: true }) request against the protected schema described in the issue and review the linked Dgraph authorization documentation. Investigate the request-level API protection boundary and the proposed golang-jwt/v5 wrapper. Done means destructive requests are protected without weakening the documented OIDC/OAuth2 behavior, with validation covering the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
authentication, backend-api-design, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.