관계를 통해 데이터가 통과하는 것을 방지하기 위해 관계 전체에서 모든 사람이 인증을 수행하고 있습니까?이미 context.user resolver가 설정되어 있어도 GraphQL 관계가 데이터를 누설합니다. 관계를 통한 데이터 노출을 방지하는 방법은 무엇입니까?
예를 들어 사용자가있는 샵이 있습니다.
// Returns error as i've set custom resolver to allow only context.user.is_shop_owner
{
shops {
name
users {
email
...
}
}
}
이 쿼리
은 일반적으로context.user.is_shop_owner
같은 사용자 지정 해결과 차단, 그래서 당신은 루트 쿼리에서이 작업을 실행할 수 없습니다.
그러나 악의적 인 사용자가 관계를 탐색하여 사용자 개체에 도달하면 중요한 사용자 데이터를 얻을 수 있습니다.
// Data exposed un-intendedly due to relation traversal. How to prevent this?
{
products {
name
price
shop {
users { ... } // boom, exposed
}
}
}
graphql의 결함입니까? 당신은 어떻게이 주위에 일하고 있습니까?
이것은 python-graphene 스택 btw에 있습니다.
편집 : Btw, exclude_fields
을 할 수는 있지만 ShopNode에서 사용자에게 액세스 할 수는 없으므로 ShopNode를 쿼리하는 중요한 정보이므로 필드를 제한하는 것이 좋습니다. .
장고를 사용하고 계신가요? 사용자에게 돌아올 때보기를 보여줄 수 있습니까? –
@MauricioCortazar 장고보기를 사용하지 않습니다. 죄송합니다! –
스키마 * 의미 * –