Skip to content

Commit

Permalink
Revert "Add a hook to determine if it's an updating clause"
Browse files Browse the repository at this point in the history
This reverts commit eedb546.
  • Loading branch information
kpom-specter committed Dec 23, 2024
1 parent eedb546 commit 01d5a71
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
3 changes: 0 additions & 3 deletions cmd/api/src/queries/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ type PreparedQuery struct {
}

func (s *GraphQuery) PrepareCypherQuery(rawCypher string) (PreparedQuery, error) {

var (
cypherFilters = []frontend.Visitor{
&frontend.ExplicitProcedureInvocationFilter{},
Expand All @@ -381,8 +380,6 @@ func (s *GraphQuery) PrepareCypherQuery(rawCypher string) (PreparedQuery, error)

// If cypher mutations are disabled, we want to add the updating clause filter to properly error as unsupported query
if !s.EnableCypherMutations {
cypherFilters = append(cypherFilters, &frontend.UpdatingNotAllowedClauseFilter{})
} else {
cypherFilters = append(cypherFilters, &frontend.UpdatingClauseFilter{})
}

Expand Down
11 changes: 1 addition & 10 deletions packages/go/cypher/frontend/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
// TODO: Review if relying on a deny model is less secure than explicit allow
func DefaultCypherContext() *Context {
return NewContext(
&UpdatingNotAllowedClauseFilter{},
&UpdatingClauseFilter{},
&ExplicitProcedureInvocationFilter{},
&ImplicitProcedureInvocationFilter{},
Expand Down Expand Up @@ -57,18 +56,10 @@ func (s *SpecifiedParametersFilter) EnterOC_Parameter(ctx *parser.OC_ParameterCo
s.ctx.AddErrors(ErrUserSpecifiedParametersNotSupported)
}

type UpdatingNotAllowedClauseFilter struct {
BaseVisitor
}

func (s *UpdatingNotAllowedClauseFilter) EnterOC_UpdatingClause(ctx *parser.OC_UpdatingClauseContext) {
s.ctx.AddErrors(ErrUpdateClauseNotSupported)
}

type UpdatingClauseFilter struct {
BaseVisitor
}

func (s *UpdatingClauseFilter) EnterOC_UpdatingClause(ctx *parser.OC_UpdatingClauseContext) {
// Do something that marks this as an updating clause to check later (in pattern.go)
s.ctx.AddErrors(ErrUpdateClauseNotSupported)
}

0 comments on commit 01d5a71

Please sign in to comment.