You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "hanahmily (via GitHub)" <gi...@apache.org> on 2026/08/27 21:40:48 UTC

[PR] feat(liaison): authorize global cluster methods from an immutable security snapshot [skywalking-banyandb]

hanahmily opened a new pull request, #1314:
URL: https://github.com/apache/skywalking-banyandb/pull/1314

   ## What this changes
   
   Until now the liaison could tell *who* a caller was and nothing else. The security
   file it watches carries a list of users, Basic authentication checks a request
   against that list, and every method the liaison serves is equally open to everybody
   who gets past it. An operator who wants a read-only monitoring account, or who wants
   to keep `Snapshot` away from the accounts that only write data, has nowhere to say so.
   
   This change gives the liaison a security *snapshot*: one immutable value that holds
   both the credentials and the compiled role grants at a single revision. Everything
   downstream reads that one value. Authentication mints a trusted principal from it,
   and the authoritative authorization decision for the cluster-wide methods is taken
   from that principal in the gRPC unary chain — one decision per request, on the way in,
   before the handler.
   
   ## The shape of it
   
   The security file grows an optional `rbac` block with flat roles and user bindings.
   Roles do not nest and do not inherit; a role is a named set of permissions drawn from
   a closed vocabulary, and a binding grants one user one role. Omitting the block, or
   setting `enabled: false`, leaves the file behaving exactly as a users-only file does —
   which is what every deployment on `main` has today, so nobody is opted in by upgrading.
   A file that lies about its own model (a permission outside the vocabulary, a binding to
   an undeclared role or user, a duplicated name) is refused outright rather than compiled
   into a partial grant set that would quietly under-protect the cluster.
   
   ```mermaid
   flowchart TD
       subgraph Config["security file on disk"]
           Y["users + optional rbac block"]
       end
       Y -->|"watch, debounce, compile"| C{"compiles?"}
       C -->|"no"| K["keep previous revision<br/>(last known good)"]
       C -->|"yes"| P["publish snapshot @ rev N+1<br/>credentials + compiled grants"]
       K -.->|"revision unchanged"| S
       P --> S[["current snapshot<br/><i>immutable, read once per request</i>"]]
   
       subgraph Ingress["one request"]
           H["HTTP request"] -->|"strip forged identity headers,<br/>verify Basic auth,<br/>re-set from what was verified"| GW["grpc-gateway"]
           GW --> I
           G["gRPC request"] --> I["unary authorization interceptor"]
       end
   
       S -.->|"read"| I
       I --> A{"credentials verify?"}
       A -->|"no"| U["Unauthenticated"]
       A -->|"yes"| T["trusted principal<br/>into request context"]
       T --> D{"method table decision"}
       D -->|"no activated executor"| X["PermissionDenied<br/>(fail closed)"]
       D -->|"principal lacks permission"| N["PermissionDenied"]
       D -->|"allow"| R["handler runs"]
   ```
   
   Two properties are load-bearing and are worth calling out.
   
   **The trusted principal is not something a caller can hand us.** It is minted only by
   verifying credentials against the snapshot, and it travels under a context key that is
   not exported, so no gRPC metadata key and no HTTP header can put one there. The HTTP
   middleware in front of the gateway strips the identity headers the gateway would
   otherwise forward as metadata and re-sets them from the credentials it just verified.
   A request that presents a reader's password while also claiming to be the admin is
   decided as the reader.
   
   **A method that this release cannot decide fails closed.** The classification covers
   every method the liaison serves, and it is checked against the registered service
   descriptors during validation — before any watcher, repair goroutine or listener
   starts — so a method that is added, removed, classified twice or left unclassified
   stops the process at boot instead of surfacing as a request-time surprise. Only the
   cluster-scoped methods have an executor in this release. Schema and data permissions
   additionally need group scope, which lands later; until then every method carrying one
   is refused for every principal, the admin included.
   
   Ordering is fixed and observable. Bad credentials are `Unauthenticated` before request
   validation runs, so a caller cannot use the difference between 401 and 403 to probe
   what a valid account is allowed to do. A denied call is refused before the handler, so
   a denied `Snapshot` leaves no snapshot behind. A method whose handler is the generated
   `Unimplemented` fallback is authorized *first*, which is why an admin gets
   `Unimplemented` there and everyone else gets `PermissionDenied`.
   
   ## Reload
   
   The file is already watched; what is new is that a reload now publishes a whole
   snapshot atomically at a higher revision rather than mutating shared state in place.
   A request that took the snapshot keeps answering from the revision it took, so a
   decision cannot straddle two configurations. A rewrite that does not compile — very
   much including the truncated document a watcher observes if it wakes between the
   writer's open and its final write — leaves the previous revision serving and does not
   move the revision counter. A malformed file can never disarm authorization or
   resurrect a grant that was just revoked.
   
   ## Observability
   
   Each unary request reports exactly one decision, labelled with a method name drawn
   from the registered set and an outcome drawn from a closed set of four. Nothing a
   caller controls reaches a label, so the new series cannot grow unbounded, and no
   user name, role name or credential appears in any metric, log line or rejection body.
   
   ## Compatibility
   
   No protocol, stored-data, WAL or segment format changes. Deployments running without
   authentication, or with a users-only security file, or with `rbac.enabled: false`,
   behave exactly as they do on `main`, including the static-asset paths the console
   loads before it has credentials.
   
   Fixes apache/skywalking#14014
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(liaison): authorize global cluster methods from an immutable security snapshot [skywalking-banyandb]

Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily commented on PR #1314:
URL: https://github.com/apache/skywalking-banyandb/pull/1314#issuecomment-5448494043

   Both standalone remainder jobs fail because the reload test marshals `serverAuth.Config`, emitting the runtime-only `Enabled` field that the new strict policy decoder rejects; replacement credentials therefore never become active. Keep runtime-only fields out of serialized auth configuration, such as with JSON exclusion tags, then rerun both shards. test/integration/standalone/other/auth_test.go:167
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(liaison): authorize global cluster methods from an immutable security snapshot [skywalking-banyandb]

Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily merged PR #1314:
URL: https://github.com/apache/skywalking-banyandb/pull/1314


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(liaison): authorize global cluster methods from an immutable security snapshot [skywalking-banyandb]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #1314:
URL: https://github.com/apache/skywalking-banyandb/pull/1314#issuecomment-5445641934

   ## [Codecov](https://app.codecov.io/gh/apache/skywalking-banyandb/pull/1314?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 50.18%. Comparing base ([`3530dd9`](https://app.codecov.io/gh/apache/skywalking-banyandb/commit/3530dd9b5cefaa4fef60eec91ecbfbdfcaf243c5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`c3517da`](https://app.codecov.io/gh/apache/skywalking-banyandb/commit/c3517dac6c34f2f01aa41f98e613c744d267f407?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 407 commits behind head on main.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##             main    #1314      +/-   ##
   ==========================================
   + Coverage   45.97%   50.18%   +4.20%     
   ==========================================
     Files         328      282      -46     
     Lines       55505    29291   -26214     
   ==========================================
   - Hits        25520    14700   -10820     
   + Misses      27909    13233   -14676     
   + Partials     2076     1358     -718     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/skywalking-banyandb/pull/1314/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [fodc](https://app.codecov.io/gh/apache/skywalking-banyandb/pull/1314/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `59.97% <ø> (?)` | |
   | [pkg](https://app.codecov.io/gh/apache/skywalking-banyandb/pull/1314/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `47.52% <ø> (?)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/skywalking-banyandb/pull/1314?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org