Skip to content

fix(bnf,schema): harmonize SecurityQueryFilter and add FILTERLIST#579

Open
aorzelskiGH wants to merge 1 commit into
IDTA-01002-3-2_workingfrom
fix/filter-filterlist-harmonization
Open

fix(bnf,schema): harmonize SecurityQueryFilter and add FILTERLIST#579
aorzelskiGH wants to merge 1 commit into
IDTA-01002-3-2_workingfrom
fix/filter-filterlist-harmonization

Conversation

@aorzelskiGH
Copy link
Copy Markdown
Contributor

Summary

Harmonizes SecurityQueryFilter between aas-specs-api and
aas-specs-security, and adds the missing FILTERLIST construct to
the API grammar and JSON schemas. Pairs with the review-finding T-02
"incompatible FILTER definitions".

Problem

  • The API BNF defined <SecurityQueryFilter> over <FragmentObject>
    (i.e. "FRAGMENT" <RouteLiteral>), while the Security BNF uses
    "FRAGMENT:" <FieldIdentifierFragment>. These are syntactically
    distinct and describe different things.
  • The API AccessPermissionRule had no FILTERLIST, whereas the
    Security spec has used FILTERLIST for some time.
  • The API JSON Schema typed SecurityQueryFilter.FRAGMENT as a plain
    string, losing all validation semantics of a field identifier.

Consequence: Implementers cannot reuse one parser/validator for both
specs; rules valid under the security spec are not valid under the
API spec and vice versa.

Solution

The Security spec is taken as the canonical form.

BNF (partials/bnf/grammar.bnf):

  • <SecurityQueryFilter> is rewritten to
    "FRAGMENT:" <ws> <FieldIdentifierFragment>.
  • <AccessPermissionRule> gains the optional
    "FILTERLIST:" ( <SecurityQueryFilter> )* block (sibling of
    FILTER).
  • The <FieldIdentifierFragment> family (AAS, SM, SME, CD, AAS
    Descriptor, SM Descriptor) and its supporting *Fragment clauses
    (SpecificAssetIds, SemanticId, Reference, Endpoint,
    SmDescriptor) are ported from aas-specs-security.

JSON Schema (partials/query-json-schema.json and
pages/schema.adoc):

  • New FragmentFieldIdentifier definition (regex sibling of
    modelStringPattern, restricted to fragment-legal fields).
  • SecurityQueryFilter.FRAGMENT becomes $ref: "#/definitions/FragmentFieldIdentifier".
  • AccessPermissionRule.properties.FILTERLIST added (array of
    SecurityQueryFilter).

Impact

  • Affected specs: IDTA-01002 (API), indirectly IDTA-01004 (Security,
    no change here; this PR aligns API to Security).
  • Rules containing FILTER: FRAGMENT "..." (literal route form) were
    never interoperable and are now explicitly invalid — recommended
    migration: FILTER: FRAGMENT: $sme("...").path#idShort.
  • Rules currently valid on Security become valid on API as well.
  • Follow-up PR 1 will deduplicate these definitions into a shared
    partial (single source of truth).

Review notes

  • Please confirm the port of <FieldIdentifierFragment> productions
    is byte-identical to aas-specs-security/partials/bnf/access-rules.bnf
    lines 224–235.
  • FragmentFieldIdentifier regex is identical to the one in
    aas-specs-security/partials/json/aas-queries-and-access-rules-schema.json
    line 17.
  • Prose updates documenting FILTERLIST and the new FILTER
    fragment syntax are intentionally left for PR 11 to keep the diff
    focused.

Related

Review Finding T-02: SecurityQueryFilter / FILTERLIST mismatch.
Depends on: T-04 (aas-specs-security PR #71) for schema validity.

The API and Security specs gave two incompatible definitions for
SecurityQueryFilter, and the API grammar lacked FILTERLIST entirely.

BNF (partials/bnf/grammar.bnf):
- <SecurityQueryFilter> now uses "FRAGMENT:" <FieldIdentifierFragment>
  instead of <FragmentObject>, aligning with aas-specs-security.
- <AccessPermissionRule> now accepts an optional FILTERLIST block.
- Added the <FieldIdentifierFragment> production family (AAS, SM, SME,
  CD, AAS Descriptor, SM Descriptor) together with the supporting
  *Fragment clauses (SpecificAssetIds, SemanticId, Reference, Endpoint,
  SmDescriptor).

JSON Schema (partials/query-json-schema.json and pages/schema.adoc):
- Added FragmentFieldIdentifier definition (regex sibling of
  modelStringPattern, restricted to fragment-legal fields).
- SecurityQueryFilter.FRAGMENT now $refs FragmentFieldIdentifier
  (was: plain string).
- AccessPermissionRule gains FILTERLIST (array of SecurityQueryFilter).

Refs: Review Finding T-02
Made-with: Cursor
Comment thread documentation/IDTA-01002-3/modules/ROOT/pages/schema.adoc Dismissed
},
"FragmentFieldIdentifier": {
"type": "string",
"pattern": "^(?:\\$aas#(?:idShort|assetInformation\\.assetType|assetInformation\\.globalAssetId|assetInformation\\.specificAssetIds\\[[0-9]*\\](?:\\.externalSubjectId(?:\\.keys\\[[0-9]*\\])?)?|submodels\\[[0-9]*\\](?:\\.keys\\[[0-9]*\\])?)|\\$sm#(?:semanticId(?:\\.keys\\[[0-9]*\\])?|idShort|id)|\\$sme(?:\\.[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?(?:\\[[0-9]*\\])*(?:\\.[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?(?:\\[[0-9]*\\])*)*)?(?:#(?:semanticId(?:\\.keys\\[[0-9]*\\])?|idShort|value|valueType|language))?|\\$cd#idShort|\\$aasdesc#(?:idShort|description|displayName|extension|administration|assetKind|assetType|globalAssetId|specificAssetIds\\[[0-9]*\\](?:\\.externalSubjectId(?:\\.keys\\[[0-9]*\\])?)?|endpoints\\[[0-9]*\\]|submodelDescriptors\\[[0-9]*\\](?:\\.(?:semanticId(?:\\.keys\\[[0-9]*\\])?|idShort|endpoints\\[[0-9]*\\]))?)|\\$smdesc#(?:semanticId(?:\\.keys\\[[0-9]*\\])?|idShort|endpoints\\[[0-9]*\\]))$"
Comment thread documentation/IDTA-01002-3/modules/ROOT/partials/bnf/grammar.bnf Dismissed
"$ref": "#/definitions/SecurityQueryFilter",
"additionalProperties": false
},
"FILTERLIST": {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants