Repository navigation
fix(security): keep tenants and scoped contexts inside their boundaries - #9
Merged
Merged
Conversation
- REST API: expanded relationships skip entities the caller cannot read. - AI/MCP field tools: related_entity must be an allowed entity. - Categories: entity and parent must belong to the category's tenant; the resource sets entity_id server-side and scopes ?entity= to the tenant. - File values: must be absolute URLs or paths under the tenant upload directory (UploadPaths); generated upload fields prevent path tampering. - Database errors are reported and replaced by a generic message in the REST API, AI tool results and MCP responses. Also registers Livewire in the base test case, which the suite needs to boot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves into the package the tenant and scope checks that Flexa added on its side after a security audit, so every app using flex-fields is protected. Proposed as 0.8.1 (entry added to
CHANGELOG.md).Changes
RecordResourceno longer expands relationship fields whose target entity the caller can't read (outsideapi.allowed_entities, inactive, or withoutview).RecordResource::canExpand()andEntityRecord::relatedEntity().CreateFieldToolandUpdateFieldToolreject asettings.related_entityoutside the context's allowed entities.?include=relations.values.EntityCategoryrefuses, onsaving, anentity_idof another tenant or a parent from another entity.entity_idserver-side; it used to come from a client-controlledHiddenfield.getCurrentEntity()andgetDefaultEntity()now usecurrentTenant(); before,?entity=resolved any tenant's entity.UploadPathsclass: works out the tenant's upload directory fromdirectory_patternandtenant_key_attribute.RecordValueValidatoronly accepts absolute URLs or paths under that directory.FileUploadfields usepreventFilePathTampering()with that same rule.QueryExceptionis reported and replaced with a generic message inRecordApiController::domain(),describeException()(AI tools) andFlexFieldsMcpTool, so SQL and connection details no longer leak.Compatibility
relations(bool, ?string)stays as it is for subclasses.directory_patternortenant_key_attributeand resend old values. It's noted in the CHANGELOG.Tests
tests/Feature/TenantBoundariesTest.php: 5 tests.vendor/bin/phpunit --bootstrap vendor/autoload.php tests).TestCasenow registersLivewireServiceProvider. Without it, 165 tests failed to boot (Target class [livewire] does not exist).values.coverand now getscover. That's adjusted on the app side when it upgrades.🤖 Generated with Claude Code