Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(schema): run check on invalid field #13923

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

gszr
Copy link
Member

@gszr gszr commented Nov 25, 2024

This fixes a nil reference if a checker referred to an inexistent field.

./kong/db/schema/init.lua:1267: attempt to index a nil value
stack traceback:
	./kong/db/schema/init.lua: in function 'run_entity_check'
	./kong/db/schema/init.lua:1384: in function 'run_checks'
	./kong/db/schema/init.lua:1400: in function 'run_entity_checks'
	./kong/db/schema/init.lua:2101: in function 'validate'
	./kong/db/schema/init.lua:957: in function 'validate_field'
	./kong/db/schema/init.lua:1187: in function 'validate_fields'
	./kong/db/schema/init.lua:2091: in function 'validate_insert'
	./kong/db/dao/init.lua:470: in function 'check_insert'
	./kong/db/dao/init.lua:1155: in function 'insert_entity'
	./kong/api/endpoints.lua:409: in function 'fn'
	./kong/api/api_helpers.lua:329: in function <./kong/api/api_helpers.lua:307>

@github-actions github-actions bot added core/db schema-change-noteworthy cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee labels Nov 25, 2024
This fixes a nil reference if a checker referred to an inexistent field.

```
./kong/db/schema/init.lua:1267: attempt to index a nil value
stack traceback:
	./kong/db/schema/init.lua: in function 'run_entity_check'
	./kong/db/schema/init.lua:1384: in function 'run_checks'
	./kong/db/schema/init.lua:1400: in function 'run_entity_checks'
	./kong/db/schema/init.lua:2101: in function 'validate'
	./kong/db/schema/init.lua:957: in function 'validate_field'
	./kong/db/schema/init.lua:1187: in function 'validate_fields'
	./kong/db/schema/init.lua:2091: in function 'validate_insert'
	./kong/db/dao/init.lua:470: in function 'check_insert'
	./kong/db/dao/init.lua:1155: in function 'insert_entity'
	./kong/api/endpoints.lua:409: in function 'fn'
	./kong/api/api_helpers.lua:329: in function <./kong/api/api_helpers.lua:307>
```
@gszr gszr requested a review from locao November 26, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee core/db schema-change-noteworthy size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants