Skip to content

ErrorPosf does not check for nil *ast.Position #375

@robmyersrobmyers

Description

@robmyersrobmyers

Open Policy Agent implements a pruneIrrelevantGraphQLASTNodes() func that removes position information from the GraphQL AST.

This causes issues on the ErrorPosf() path because that function assumes that the pos *ast.Position argument will not be nil.

The result is that it is easy to crash Open Policy Agent with bad input as you can see in this playground that results in runtime error: invalid memory address or nil pointer dereference.

I think the best fix here is to add a nil check to ErrorPosf(), but perhaps there are better solutions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions