added security in aasrepo#216
Merged
aaronzi merged 13 commits intoeclipse-basyx:mainfrom Mar 13, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds ABAC/OIDC security enforcement to the AAS Repository service, closing #217. It follows the same security patterns already established in the Concept Description and Submodel repositories, extending the security middleware, ABAC engine mappings, and grammar/SQL translation to support $aas# field identifiers.
Changes:
- Enabled security middleware in the AAS repository service main entry point, added OIDC/ABAC configuration files, and added ABAC-aware write checks across all AAS repository persistence write paths with pre/post-commit visibility verification.
- Extended grammar processing to support
$aas#field identifiers including field-to-SQL-column mappings, array segment bindings forsubmodels[]andspecificAssetIds[], join plan configuration, and enum literal conversion forAssetKind,ReferenceType, andKeyTypecolumns. - Added a comprehensive security integration test suite with docker-compose, Keycloak realm reuse, access rules, and test scenarios covering admin/viewer/editor role-based access control.
Reviewed changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
cmd/aasrepositoryservice/main.go |
Wire security middleware into the Chi router with a protected API subrouter |
cmd/aasrepositoryservice/config.yaml |
Add ABAC, OIDC, and implicit-cast config sections |
cmd/aasrepositoryservice/config/trustlist.json |
Default OIDC trust list for development |
cmd/aasrepositoryservice/config/access_rules/access-rules.json |
Default ABAC access rules for AAS repository |
internal/common/security/authorize.go |
Extract ShouldEnforceABACWriteCheck as public function |
internal/common/security/abac_engine_methods.go |
Map AAS HTTP methods/patterns to ABAC rights |
internal/common/security/abac_engine_objects.go |
Map AAS routes to identifiable route/filter fields |
internal/common/model/grammar/model_string_pattern.go |
Rewrite regex to support $aas#submodels[], $bd#, $smdesc#createdAt |
internal/common/model/grammar/field_column_mapping.go |
Add $aas# terminal column mappings and fix prevSimple after array tokens |
internal/common/model/grammar/fieldidentifier_processing.go |
Add ctxAAS, ctxAASSubmodelReference contexts and array segment mappings |
internal/common/model/grammar/logical_expression_to_sql.go |
Add CollectorRootAAS and joinPlanConfigForAAS() |
internal/common/model/grammar/logical_expression_simplify_backend.go |
Extend enum conversion for AssetKind, ReferenceType, KeyType; add text-cast fallback |
internal/common/model/grammar/fieldidentifier_processing_test.go |
Add test cases for $aas# field identifiers |
internal/common/model/grammar/string_pattern_unmarshal_test.go |
Add test for $aas#submodels[0].keys[0].value |
internal/common/model/grammar/logical_expression_to_sql_implicit_cast_test.go |
Add enum conversion and text-cast fallback tests |
internal/aasrepository/persistence/aas_database.go |
Add ABAC read/write checks, pass ctx to all backend methods |
internal/aasrepository/persistence/aas_database_query_utils.go |
Add position to submodel reference insert, return dataset instead of SQL for ABAC injection, fix ordering |
internal/aasrepository/api/api_asset_administration_shell_repository_api_service.go |
Pass ctx, handle ErrDenied → 403 |
basyxschema.sql |
Add position column to aas_submodel_reference |
.github/workflows/go-tests.yml |
Add CI job for AAS repository security tests |
internal/aasrepository/security_tests/ (multiple files) |
New security integration test suite |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aaronzi
reviewed
Mar 12, 2026
Member
aaronzi
left a comment
There was a problem hiding this comment.
Thanks for the PR. I added a few remarks and questions.
internal/aasrepository/security_tests/aasrepository_security_integration_test.go
Show resolved
Hide resolved
chris-koo
reviewed
Mar 12, 2026
internal/aasrepository/api/api_asset_administration_shell_repository_api_service.go
Outdated
Show resolved
Hide resolved
chris-koo
reviewed
Mar 12, 2026
internal/aasrepository/api/api_asset_administration_shell_repository_api_service.go
Outdated
Show resolved
Hide resolved
chris-koo
reviewed
Mar 12, 2026
internal/aasrepository/api/api_asset_administration_shell_repository_api_service.go
Outdated
Show resolved
Hide resolved
chris-koo
reviewed
Mar 12, 2026
internal/aasrepository/api/api_asset_administration_shell_repository_api_service.go
Outdated
Show resolved
Hide resolved
chris-koo
reviewed
Mar 12, 2026
internal/aasrepository/api/api_asset_administration_shell_repository_api_service.go
Outdated
Show resolved
Hide resolved
chris-koo
reviewed
Mar 12, 2026
internal/aasrepository/api/api_asset_administration_shell_repository_api_service.go
Outdated
Show resolved
Hide resolved
chris-koo
reviewed
Mar 12, 2026
internal/aasrepository/api/api_asset_administration_shell_repository_api_service.go
Outdated
Show resolved
Hide resolved
chris-koo
reviewed
Mar 12, 2026
internal/aasrepository/api/api_asset_administration_shell_repository_api_service.go
Outdated
Show resolved
Hide resolved
chris-koo
reviewed
Mar 12, 2026
internal/aasrepository/api/api_asset_administration_shell_repository_api_service.go
Outdated
Show resolved
Hide resolved
chris-koo
reviewed
Mar 12, 2026
internal/aasrepository/api/api_asset_administration_shell_repository_api_service.go
Outdated
Show resolved
Hide resolved
chris-koo
reviewed
Mar 12, 2026
aaronzi
approved these changes
Mar 13, 2026
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.
closes #217
AAS Repository Security PR Summary
What Changed
cmd/aasrepositoryservice/main.goso AAS Repository endpoints run with OIDC/ABAC enforcement.cmd/aasrepositoryservice/config.yaml(ABAC/OIDC + implicit-cast config)cmd/aasrepositoryservice/config/access_rules/access-rules.jsoncmd/aasrepositoryservice/config/trustlist.jsoninternal/common/security/abac_engine_methods.gointernal/common/security/abac_engine_objects.goShouldEnforceABACWriteCheckininternal/common/security/authorize.goand integrated ABAC-aware checks across AAS repository write paths.403ininternal/aasrepository/api/api_asset_administration_shell_repository_api_service.go.internal/aasrepository/persistence/aas_database.goto:positionhandling for AAS submodel references:basyxschema.sqladdsaas_submodel_reference.position.internal/aasrepository/persistence/aas_database_query_utils.go.$aas#...) and shorthand/enum handling in:internal/common/model/grammar/field_column_mapping.gointernal/common/model/grammar/fieldidentifier_processing.gointernal/common/model/grammar/logical_expression_simplify_backend.gointernal/common/model/grammar/logical_expression_to_sql.gointernal/common/model/grammar/model_string_pattern.gointernal/aasrepository/security_tests..github/workflows/go-tests.yml.