Skip to content

Commit

Permalink
fix(db/schema): do not allow setting priority with traditional route …
Browse files Browse the repository at this point in the history
…fields in mixed mode
  • Loading branch information
chronolaw committed May 13, 2024
1 parent d112f3c commit 0961711
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions kong/db/schema/entities/routes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@ if kong_router_flavor == "traditional_compatible" or kong_router_flavor == "expr
"simultaneously"
end

if not is_expression_empty and not is_null(entity.regex_priority) then
return nil, "Router Expression failed validation: " ..
"cannot set 'regex_priority' with 'expression' " ..
"simultaneously"
end

if not is_others_empty and not is_null(entity.priority) then
return nil, "Router Expression failed validation: " ..
"cannot set 'priority' with " ..
"'methods', 'hosts', 'paths', 'headers', 'snis', 'sources' or 'destinations' " ..
"simultaneously"
end

local schema = get_schema(entity.protocols)
local exp = get_expression(entity)

Expand Down

0 comments on commit 0961711

Please sign in to comment.