참고 자료 · 37

GraphQL API 보안: 권한 부여, 쿼리 비용 및 증거

객체 및 필드 권한 적용, 서버 작업 제한 및 거부 경로 테스트

업데이트됨 · 15 min

유리 큐브와 연결 노드, 추상 그래프, 버건디 케이스 및 어두운 테이블의 네트워크 장비가 있는 가상의 무인 사이버 설계실 AI로 생성한 편집용 일러스트

이 가이드가 달성하는 목표

  • 노출된 스키마 매핑
  • 권한 실행
  • 쿼리 비용 제한
  • 거부 확인

빠른 확인

  • 한 계정이 다른 계정의 객체를 읽을 수 있습니까?
  • 민감한 필드가 상위 계정의 접근 결정에 따라 처리됩니까?
  • 깊이, 별칭 및 페이지네이션을 함께 사용할 때 비용은 어떻게 됩니까?
  • 오류를 통해 어떤 세부 정보가 유출됩니까?
  • 거부 및 악용 사례를 누가 관찰합니까?

단계별 방법

  1. 1

    작업 목록 작성

    유형, 필드, 변경, 역할, 객체 소유자 및 민감한 데이터 목록을 작성합니다. 현재 클라이언트 쿼리와 거의 사용되지 않는 경로를 포함합니다.

    결과물: 작업, 역할, 객체 및 필드 매트릭스

  2. 2

    각 접근 결정 테스트

    중첩 객체를 포함하여 서로 다른 테스트 계정을 생성하고 객체 ID를 교환합니다. 리졸버는 데이터를 반환하기 전에 권한 부여를 적용해야 합니다.

    결과물: 재현 가능한 허용 및 거부 사례

  3. 3

    바운드 서버 작업

    필드 및 컬렉션의 실제 비용을 측정합니다. 깊이, 범위, 별칭, 페이지네이션, 배치 처리 및 시간을 함께 테스트한 후 적절한 제한을 설정합니다.

    결과물: 비용 정책 및 공격자 쿼리 세트

  4. 4

    불필요한 노출 감소

    컨텍스트에 대한 인트로스펙션 여부를 결정하고, 내부 오류 세부 정보를 숨기고, 클라이언트에게 필요한 정보 이상을 노출하는 필드를 제거합니다.

    결과물: 검토된 공개 구성 및 오류 응답

  5. 5

    신중하게 관찰

    비밀 및 민감한 인수를 제외하고 유용한 기술적 ID, 작업, 비용, 거부 및 상관 관계를 로깅합니다. 경고 담당자를 지정합니다.

    결과물: 대시보드 및 조사 절차

  6. 6

    변경 후 재현

    필드, 역할 또는 클라이언트가 변경될 때 권한 부여 및 로드 케이스를 반복합니다. 수정된 그래프를 통과하는 이전 쿼리를 확인합니다.

    결과물: 회귀 테스트 결과 및 릴리스 결정

관리 지표

지표측정 대상첫 번째 조치
접근 권한객체 및 필드 관련 사례가 예상대로 거부됨리졸버 수정
비용정책에 의해 과도한 쿼리가 억제됨필드 및 제한 조정
오류내부 세부 정보 없이 공개 응답 제공노출되는 세부 정보 감소
회귀 분석변경 후 클라이언트 작업 재실행의도치 않은 오류 차단

일반적인 실수

  • 엔드포인트 접근만 신뢰
  • 깊이 제한은 하지만 범위는 무시
  • 중첩 필드 권한 부여 누락
  • 민감한 데이터가 포함된 인수 로깅

자주 묻는 질문

GraphQL이 일반 API 권한 부여를 없애는가?

아니요. 모든 객체 및 필드 접근에는 여전히 ID 및 컨텍스트 기반 결정이 필요합니다.

인트로스펙션 비활성화로 충분한가?

아니요. 스키마 노출은 줄일 수 있지만 접근 또는 쿼리 비용을 해결하지는 못합니다.

깊이 제한으로 충분한가?

아니요. 별칭, 범위, 목록 및 필드별 비용도 중요합니다.

GraphQL: 오류, 목록 및 부분 데이터

이 언어판의 상세 참고 설명은 영어로 제공됩니다.

How should a client read a GraphQL response when part of the data fails? Start with the processing phase, then follow Non-Null constraints to the first position that permits null. A screen that displays success simply because transport returned can hide an incomplete record. This dossier connects schema, JSON result and interface decisions through a fictional evidence-viewing scenario.

Reference: the published September 2025 edition, reviewed on 23 October 2026. The eight rules below are a CIE editorial selection, not a conformance certification. All scenarios and sample data are fictional.

GraphQL Specification · September 2025 · Published edition · September 2025

Eight points for interpreting the result

Eight points for interpreting the result
PointClient consequenceSource
Request error resultAn error preventing execution yields errors and no data entry. Invalid variables follow this route even when the document parses.GraphQL 2025
Execution resultAfter execution, data is present. Its value may be a partial object or null. With no raised error, errors must be absent rather than an empty list.GraphQL 2025
errors[].messageEach error includes a developer-facing message. Give visitors useful wording without exposing internal details or sensitive identifiers.GraphQL 2025
errors[].locationsWhen a document position can be associated with an error, locations should give line and column starting at 1. These are not data paths.GraphQL 2025
errors[].pathThe path uses response names, including aliases, and zero-based integer indices. It keeps the failing position even when a parent is subsequently replaced with null.GraphQL 2025
List / Non-NullSeparate list nullability from item nullability. A failing non-null item nulls the list; a non-null list propagates the error further to its parent.GraphQL 2025
extensionsResponse and error extensions are metadata maps defined by implementations. A code in extensions is not a universal GraphQL error-code catalogue.GraphQL 2025
GraphQL / HTTPThe GraphQL specification does not define transport. GraphQL over HTTP is identified here as a working draft; test its media-type negotiation separately.HTTP draft

Identify the phase before choosing the message

Identify the phase before choosing the message
SituationExpected shapeJourney action
Request rejected before executionNon-empty errors; data absentFix the operation or its variables. Keep an actionable error instead of automatically replaying an unchanged request.
Execution with no raised errordata present; errors absentDisplay returned data. A schema-permitted null may be normal and alone does not diagnose failure.
Execution with partial resultObject data; non-empty errorsSeparate retained fields from failing positions. Prevent confirmation that depends on unavailable evidence.
Propagation reaches the rootdata: null; non-empty errorsPresent an unavailable state for this operation. Do not silently recycle a response belonging to another case.

GraphQL null 전파 시뮬레이터

The model fixes a query using affaire as the alias of dossier. The case contains reference: String! and preuves, a three-item String list. statut: String! is a root sibling. Items are A-01, A-02 and A-03 before the injected failure. Choose the preuves type, dossier nullability and failing item.

query Demo {
  affaire: dossier { reference preuves }
  statut
}

Local simulation of one item-resolution error on this fixed schema. No API call, query parser, permission test, cost calculation or HTTP verdict. Nested types, subscriptions and incremental delivery are outside the model. The JSON illustrates propagation and contains no real investigation data.

Four list types, two distinct constraints

Four list types, two distinct constraints
preuves typeNull list allowedNull item allowedSingle item failure
[String]YesYesOne item becomes null.
[String!]YesNoThe list becomes null.
[String]!NoYesOne item becomes null; the list remains present.
[String!]!NoNoPropagation reaches dossier, then the root depending on its type.

Eight reference results, readable without JavaScript

G01 · [String] · affaire: Dossier

Only item 1 becomes null; the other two items and the case remain readable.

{
    "data": {
        "affaire": {
            "reference": "DEMO-01",
            "preuves": [
                "A-01",
                null,
                "A-03"
            ]
        },
        "statut": "fictif"
    },
    "errors": [
        {
            "message": "Illustrative item resolution failure",
            "path": [
                "affaire",
                "preuves",
                1
            ]
        }
    ]
}

Acceptance check : Check the received JSON and retain errors[0].path = ["affaire", "preuves", 1], even when affaire is replaced by null.

G02 · [String!] · affaire: Dossier

The preuves list becomes null; the case reference and status remain readable.

{
    "data": {
        "affaire": {
            "reference": "DEMO-01",
            "preuves": null
        },
        "statut": "fictif"
    },
    "errors": [
        {
            "message": "Illustrative item resolution failure",
            "path": [
                "affaire",
                "preuves",
                1
            ]
        }
    ]
}

Acceptance check : Check the received JSON and retain errors[0].path = ["affaire", "preuves", 1], even when affaire is replaced by null.

G03 · [String]! · affaire: Dossier

Only item 1 becomes null; the other two items and the case remain readable.

{
    "data": {
        "affaire": {
            "reference": "DEMO-01",
            "preuves": [
                "A-01",
                null,
                "A-03"
            ]
        },
        "statut": "fictif"
    },
    "errors": [
        {
            "message": "Illustrative item resolution failure",
            "path": [
                "affaire",
                "preuves",
                1
            ]
        }
    ]
}

Acceptance check : Check the received JSON and retain errors[0].path = ["affaire", "preuves", 1], even when affaire is replaced by null.

G04 · [String!]! · affaire: Dossier

The affaire case becomes null; the sibling statut field remains available.

{
    "data": {
        "affaire": null,
        "statut": "fictif"
    },
    "errors": [
        {
            "message": "Illustrative item resolution failure",
            "path": [
                "affaire",
                "preuves",
                1
            ]
        }
    ]
}

Acceptance check : Check the received JSON and retain errors[0].path = ["affaire", "preuves", 1], even when affaire is replaced by null.

G05 · [String] · affaire: Dossier!

Only item 1 becomes null; the other two items and the case remain readable.

{
    "data": {
        "affaire": {
            "reference": "DEMO-01",
            "preuves": [
                "A-01",
                null,
                "A-03"
            ]
        },
        "statut": "fictif"
    },
    "errors": [
        {
            "message": "Illustrative item resolution failure",
            "path": [
                "affaire",
                "preuves",
                1
            ]
        }
    ]
}

Acceptance check : Check the received JSON and retain errors[0].path = ["affaire", "preuves", 1], even when affaire is replaced by null.

G06 · [String!] · affaire: Dossier!

The preuves list becomes null; the case reference and status remain readable.

{
    "data": {
        "affaire": {
            "reference": "DEMO-01",
            "preuves": null
        },
        "statut": "fictif"
    },
    "errors": [
        {
            "message": "Illustrative item resolution failure",
            "path": [
                "affaire",
                "preuves",
                1
            ]
        }
    ]
}

Acceptance check : Check the received JSON and retain errors[0].path = ["affaire", "preuves", 1], even when affaire is replaced by null.

G07 · [String]! · affaire: Dossier!

Only item 1 becomes null; the other two items and the case remain readable.

{
    "data": {
        "affaire": {
            "reference": "DEMO-01",
            "preuves": [
                "A-01",
                null,
                "A-03"
            ]
        },
        "statut": "fictif"
    },
    "errors": [
        {
            "message": "Illustrative item resolution failure",
            "path": [
                "affaire",
                "preuves",
                1
            ]
        }
    ]
}

Acceptance check : Check the received JSON and retain errors[0].path = ["affaire", "preuves", 1], even when affaire is replaced by null.

G08 · [String!]! · affaire: Dossier!

data becomes null: the chain of non-null response positions reaches the root.

{
    "data": null,
    "errors": [
        {
            "message": "Illustrative item resolution failure",
            "path": [
                "affaire",
                "preuves",
                1
            ]
        }
    ]
}

Acceptance check : Check the received JSON and retain errors[0].path = ["affaire", "preuves", 1], even when affaire is replaced by null.

Six business checks for a GraphQL viewing API

Six business checks for a GraphQL viewing API
CIE scenarioEvidence to collectDecision criterion
G-ACC · Another tenant’s objectTwo test identities and the same case ID, without production data.The service enforces access on the object, relations and fields; possessing an ID grants no access.
G-ALIAS · Two aliases, one objectTwo aliased selections and correlated traces in an authorized environment.Aliases change neither access scope nor cost policy. The client links each error to the received response name.
G-CACHE · Account changeThe sign-out journey followed by sign-in as another test account.Cached data does not cross identity changes. Partial responses do not present an old proof as newly read.
G-COST · Volume and depthTest measurements of cardinality, depth, time and service-specific quotas.Depth alone is insufficient: bound list size, expensive fields and grouped operations. No universal threshold is invented.
G-ERROR · Public messageExamples of visitor-facing messages and operator-only traces.Expose no stack, secret, table name or sensitive evidence. A non-sensitive correlation identifier supports troubleshooting.
G-SXO · Missing evidence blocks an actionKeyboard and screen-reader journey with a required field failing.Announce the partial state, keep retained data readable, and explain then prevent confirmation that depends on the unavailable field.

OWASP · GraphQL Cheat Sheet · Living guidance consulted 2026-10-23

A partial response proves neither a leak nor correct protection. Only service-side authorization tests can verify access. Link each acceptance case to the deployed schema, its version and client observations: data controls, interface resilience and transport need coordinated checks with distinct criteria.

Provenance, edition and licence

GraphQL Specification · September 2025 · reviewed 2026-10-23. CIE: original explanations, fictional scenarios and limited educational model.

GraphQL HTML SHA-256: 39fb3aeffd9b5acebb0830ddc6dcc243c1280a9f0e977897ae59c5cc165511d6

HTTP draft HTML SHA-256: 90a686f8251073b05e105697c6028288520d0c0fa6442924c0d1751cad3f14ac

GraphQL over HTTP · Current Working Draft · Working draft consulted 2026-10-23 · may change

GraphQL · Copyright and Licensing · Open Web Foundation Agreement 1.0

공식 참조

참조는 방법을 뒷받침합니다. 상황에 맞게 검사를 조정하십시오. 이는 인증이 아닙니다. 원본 참조 제목 및 소스 문서는 다른 언어로 작성되었을 수 있습니다.

참고 자료 확인일 .