graphql-expert-best-practices
Fail
Audited by Socket on Feb 15, 2026
1 alert found:
Obfuscated FileObfuscated Filerules/schema-field-overload.md
HIGHObfuscated FileHIGH
rules/schema-field-overload.md
The provided insecure example demonstrates a common API design anti-pattern: overloading a GraphQL field to return either the authenticated viewer or an arbitrary user based on a nullable argument and returning the same concrete type for both. This pattern risks accidental disclosure of private fields. The recommended fix — distinct fields (viewer vs user(id: ID!)) and distinct types (Viewer vs PublicUser) — is appropriate and reduces surface area for accidental leaks by using schema/type enforcement rather than runtime branching. No signs of malware or obfuscation were found in the examples; this is a security design issue rather than malicious code.
Confidence: 98%
Audit Metadata