diff --git a/PYEGERIA_ISSUES.md b/PYEGERIA_ISSUES.md index 1255d341..276bc491 100644 --- a/PYEGERIA_ISSUES.md +++ b/PYEGERIA_ISSUES.md @@ -172,6 +172,7 @@ re-test candidates moved into *Awaiting re-test* below the open sections. create-from-template) and 7 (`viewElementGUID`) are still open. **Open pyegeria items** +- ISSUE-182: an element hidden by zone security (403-020) was reported as AUTHORIZATION_ERROR_401 (fixed in 6.2.34) - ISSUE-181 (HIGH): Dr.Egeria Parent ID on an Update deleted an unrelated relationship of the parent type, e.g. a folder's member (fixed for 6.2.32; moves to the Appendix on release) - ISSUE-174: link methods discarded the new relationship GUID (fixed for 6.2.19; moves to the Appendix on release) - ISSUE-155: pyegeria gaps against Egeria `main` since 6.2 (omvs_audit + source diff, V6.2..05a5e982) @@ -194,6 +195,56 @@ into the entry now, so it isn't rediscovered from scratch later. --- +### ISSUE-182: an element hidden by zone security is reported as "AUTHORIZATION_ERROR_401" + +**Layer:** pyegeria · **Severity:** medium: misleading diagnosis, no wrong data · **Status:** fixed 2026-11-10 on branch `docs/issue-182-unauthorized-banner`; released in 6.2.34 · **Found:** 2026-11-10 on 6.2.32 (laz), reading a Report zoned `['peterprofile']` as erinoverview; the Architect confirmed `is_not_visible_error` is True for it. + +**What:** `get_element_by_guid` as erinoverview on that Report, through `BaseServerClient._async_get_element_by_guid_`, logs a banner that starts: + +``` +=> AUTHORIZATION_ERROR_401 +=> User not authorized received for user - `erinoverview`. +``` + +Egeria actually said something different. The reply was wrapped in HTTP 200, with `relatedHTTPCode` 403, `OPEN-METADATA-SECURITY-403-020` and `exceptionClassName` …`UserNotAuthorizedException`: the element is in a zone this user can't see. Those fields appear lower down, under "Egeria error information", but the first two lines say 401. + +**Why it happens:** +- `_base_server_client._async_make_request` raises `PyegeriaUnauthorizedException` for two different failures: + - a transport 401 (a bad or expired token); + - an Egeria-wrapped 401/403 whose exception is a `UserNotAuthorizedException` (`_is_authorization_failure`). +- `PyegeriaUnauthorizedException.__init__` (`pyegeria/core/_exceptions.py`) always uses `PyegeriaErrorCode.AUTHORIZATION_ERROR`, whose `http_code` is 401 and `message_id` is `AUTHORIZATION_ERROR_401`. The `message_id` becomes `pyegeria_code`, the banner's first line, whatever Egeria returned. + +**Why it matters:** the two need opposite responses. +- A 401 means "re-authenticate": get a new token or check the credentials. The error's own `user_action` says the same. +- A 403-020 means "this element is hidden from you by zone security": a new token changes nothing. + +An operator reading the banner chases credentials. In the Portal, one zoned Report on a Dashboard Sheet then looks like a broken sign-in. + +Related: `PyegeriaErrorCode` labels 401 `AUTHORIZATION_ERROR` and 403 `AUTHENTICATION_ERROR`, which is the wrong way round. A 401 is unauthenticated; a 403 is authenticated but not permitted. + +**Proposed fix:** +- Build the banner from what Egeria returned. When `additional_info` carries `relatedHTTPCode` / `exceptionErrorMessageId`, the first lines would read, for example, "403 OPEN-METADATA-SECURITY-403-020: not visible to user `erinoverview`", followed by Egeria's own message and user action. +- Keep `AUTHORIZATION_ERROR_401` and its "check your credentials" action only for a real transport 401. +- Keep the exception class (`PyegeriaUnauthorizedException`, a `PyegeriaAPIException`) and `related_http_code` unchanged, so callers don't break. That covers the 401 retry in `_async_make_request` and `dashboard_resolver.is_not_visible_error`, which already checks for 403. +- Optionally, distinguish the two cases on the exception itself (e.g. `e.not_visible` or `e.message_id`), so callers don't have to parse text. + +**Test to add:** an Egeria-wrapped 200 response with `relatedHTTPCode` 403, `exceptionClassName` `org.odpi.openmetadata.frameworks.openmetadata.ffdc.UserNotAuthorizedException` and `exceptionErrorMessageId` `OPEN-METADATA-SECURITY-403-020`. Check that: +- the exception is still a `PyegeriaUnauthorizedException`; +- `related_http_code` is 403; +- `str(e)` names 403 and the message id and doesn't say `AUTHORIZATION_ERROR_401`. + +Also check that a bare transport 401 still says `AUTHORIZATION_ERROR_401` and its credentials action. + +**Done:** +- `PyegeriaErrorCode.FORBIDDEN_ERROR` is new: message_id `AUTHORIZATION_ERROR_403`, message "HTTP Code: 403 (user ``)", and a "a new token will not help" action. +- `PyegeriaUnauthorizedException` uses it when Egeria's `relatedHTTPCode` is 403, and sets `egeria_message_id`. A transport 401 or a wrapped 401 is unchanged. +- Class and `related_http_code` are unchanged, and the token retry still fires only on a transport 401. +- The message_id keeps the `AUTHORIZATION_ERROR` prefix and the text carries "HTTP Code: 403". This is because the Portal's `_is_auth_error` helpers match those substrings (tech_catalog and audit handlers match only "AUTHORIZATION_ERROR"/"NOT_AUTHORIZED"). With it, `egeria_error_mapping._auth_status` now answers 403 instead of 401. +- trellis classifies by class and by the OPEN-METADATA-SECURITY-403 marker. Egeria's sentence is still the first marker occurrence, so `_refusal_sentence` is unchanged. +- **The 401/403 name swap is not changed.** `AUTHORIZATION_ERROR_401` is matched as text by the Portal (10 handlers, both stacks) and trellis (`egeria_clients.classify_token_check_failure`), so renaming it is a coordinated change for later. `AUTHENTICATION_ERROR` (403) is unused and marked so. + +Tests: `tests/micro-tests/test_issue_182_forbidden_banner.py`. + ### ISSUE-181: Parent ID on an Update deletes an unrelated relationship of the parent type (e.g. a folder's member) **Layer:** pyegeria (Dr.Egeria) · **Severity:** HIGH: silent membership loss, no error or warning · **Status:** fixed 2026-11-10 on branch `fix/ops-commands-review` (the proposed fix below; separate commit from ISSUE-175..180), targets 6.2.32 · **Found:** 2026-11-10, by the publish-portal-specs builder while renaming `ReportSpecFolder::EgeriaPortal` (fe5aad27); confirmed by the Architect's read-back of consumer folders phase 1 (e71e4e90). diff --git a/docs/release-notes/6.2.34.md b/docs/release-notes/6.2.34.md new file mode 100644 index 00000000..b197fc19 --- /dev/null +++ b/docs/release-notes/6.2.34.md @@ -0,0 +1,128 @@ +# pyegeria 6.2.34 + +pyegeria 6.2.34 makes these changes: +- A Report can name a collection by qualifiedName (W1). +- A Report can show a saved query's answer, cached or live, with parameters (Route B). +- Every trend point says whether its number is exact (W2). +- Dr.Egeria's Saved Query commands take Formula and Formula Type. +- An element hidden by zone security is reported as a 403, not a 401 (ISSUE-182). + +## New + +- **`saved_query`: a saved query as the source of a Report (Route B).** + `saved_query(client, name, mode="cached"|"live", output="count"|"list")` is a registered analytic + function, so a Report can name a SavedQuery by qualifiedName and a tile can show its answer as a count + KPI or a list. + - **As the viewer:** the SavedQuery is found by an exact qualifiedName find, as the viewer, so zones + apply. + - **cached:** the members of its Results Set, `asOf` its last refresh. A query never refreshed is "not + established", not 0. + - **live:** runs the stored request now with the viewer's token. It reads every page (an empty page is + the end), up to 20 pages of 500. A read that stops at that bound is a lower bound: `value` is None, + `capped` is true and `display` reads "≥N". + - **Absence is never 0:** a missing, ambiguous, hidden (not_permitted) or failed read is + `not_established`, with the reason. + - **Security:** a SavedQuery's Query URL is authored data, so it never chooses where the viewer's token + goes. The same class of problem was behind the Portal's `?url=` leak. The URL is only checked, never + followed: + - its path must be the one allow-listed endpoint, MetadataExpert + `metadata-elements/by-search-conditions`, given relative or under this client's own + `/servers/`; + - the stored host is not the boundary, because the URL is never followed: a different http(s) + scheme or host:port is accepted and noted in the result's `how`. The Portal stores the + in-container URL, `https://host.docker.internal:9443/...`, while EA, notebooks and the CLI use + `https://localhost:9443`; + - refused with a sentence, and nothing is sent: user info, a scheme-relative or non-http(s) URL, a + query string or fragment, an encoded or dotted path, another view server, a path off the + allow-list, or a body that isn't a FindRequestBody; + - the request is made by pyegeria's own `find_metadata_elements` on the viewer's client. + - **Parameters: a saved query as a template, with one model shared with the Portal.** + - **Declaring:** `additionalProperties.parameters` is a JSON list of `{name, type, default?, + searchPath?, requestPath?}`, using the Portal's types (string, integer, number, boolean, list), with + no coercion. There are no placeholders, so the stored bodies stay runnable: Egeria's Smart Collections + connector runs `queryURL`/`queryRequestBody` literally. + - **`searchPath`** (default `name`) is where the Portal applies a value, in its stored search + (`formula`, else `additionalProperties.searchSpec`). **`requestPath`** is where live mode applies it, + in `queryRequestBody`: typed, as a value only, never a key and never the URL. + - **The effective value, by the Portal's own rule:** the value given, else the stored search value, + else the default. The Portal records this map for every declared name as `lastRefreshParams`. A + cached answer is returned only when that record equals it, and is labelled "as of