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

Merged
merged 1 commit into from
Nov 28, 2024
Merged

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

merged 1 commit into from
Nov 28, 2024

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 force-pushed the fix/schema-nil-error branch from c253a77 to 0f932bb Compare November 25, 2024 23:44
@gszr gszr requested review from bungle, samugi and brentos November 26, 2024 00:43
@gszr gszr requested a review from locao November 26, 2024 17:25
@bungle bungle merged commit a13ed4a into master Nov 28, 2024
28 checks passed
@bungle bungle deleted the fix/schema-nil-error branch November 28, 2024 12:56
@team-gateway-bot
Copy link
Collaborator

Successfully created cherry-pick PR for master:

lhanjian pushed a commit that referenced this pull request Dec 23, 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>
```

(cherry picked from commit a13ed4a)
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.

4 participants