Skip to content

docs(api-reference): document operator roles and their access policies - #52

Merged
Rost-is-love merged 5 commits into
mainfrom
docs/access-policies-data-engineer-portal-admin
Aug 28, 2026
Merged

docs(api-reference): document operator roles and their access policies#52
Rost-is-love merged 5 commits into
mainfrom
docs/access-policies-data-engineer-portal-admin

Conversation

@Seryiza

@Seryiza Seryiza commented Aug 27, 2026

Copy link
Copy Markdown
Member

No description provided.

Adds an Access policies page under Configuration resources covering the two
operator roles: the built-in portal administrator, and a read-only data
engineer role shipped as an adaptable example.

The admin-role-* policies already ship in the public admin init bundle, so
the page tables what they grant and links the bundle rather than duplicating
JSON that would drift. The data engineer role ships nowhere, so it is given
in full as a copy-pasteable transaction bundle.

Every claim on the page was verified against Aidbox booted from the public
init bundle: the portal admin grant table (per resource type and
interaction), the data engineer allow/deny matrix, the SQL blocklist, and
that the data engineer role reaches the FHIR API only — the Aidbox-format
endpoints answer 403.

Role matching uses $contains throughout, which is order-independent across a
user's roles.

Refs HealthSamurai/smartbox#434, HealthSamurai/smartbox#730
@Seryiza Seryiza self-assigned this Aug 27, 2026
Comment thread docs/api-reference/configuration-resources/access-policies.md Outdated
"request-method": "post",
"body": {
"query": {
"$not": "#(?i)\\b(alter|copy|create|delete|drop|grant|insert|into|lock|merge|program|refresh|reindex|revoke|set|truncate|update|vacuum)\\b"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если query это массив (а массивом можно передавать) not вообще не применится

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Подтвердил: POST /$sql с телом ["drop table x"] проходил и выполнялся: $not не применяется к не-строке.

  • Заменил $not + блок-лист на позитивный паттерн (^SELECT|WITH, без ;, комментариев и write-ключевиков) — любое не-строковое тело теперь не матчится и получает 403.
  • Убрал полиси на /$sql (принимает jdbc-массив, UI им не пользуется) и -arr ($psql берёт только объект).
  • Проверил бандлом со страницы на локальном Aidbox: 5 легитимных запросов → 200, 9 атак (stacked TRUNCATE, DO, WITH … DELETE FROM, SELECT INTO, COPY TO PROGRAM, SET ROLE, обе массивные формы) → 403.

Comment thread docs/api-reference/configuration-resources/access-policies.md
…SQL blocklist

The published example named five operation ids Aidbox does not have
(FhirVRead, FhirSearchSystem, FhirHistoryInstance, FhirHistorySystem,
FhirCapabilities), so the role silently lost vread and instance history.
Verified against the operation registry and by request.

The SQL policies matched the body with $not over a keyword blocklist.
That never applies to a non-string body, so POST /$sql ["drop table x"]
was allowed and executed. Replaced with a single /$psql policy carrying a
positive pattern: a statement must start with SELECT or WITH and carry no
separator, comment or write keyword, which fails closed on every other
body shape.

Refs #52
@Seryiza
Seryiza requested a review from Rost-is-love August 28, 2026 05:21
@Rost-is-love
Rost-is-love merged commit ae0f79e into main Aug 28, 2026
2 checks passed
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.

2 participants