Repository navigation
Demoting All bank group roles, Adding CEL ABAC roles for possible future Scala 3 times. - #2982
Merged
Merged
Conversation
The ResourceDoc of Get Well Known URIs (getOAuth2ServerWellKnown, v5.1.0) used the JWKS endpoint's example, so API Explorer and generated clients were told the endpoint answers jwks_uris. It really answers well_known_uris, each with a provider and the url of its OpenID discovery document. The example is now wellKnownUrisJsonV510, which has that shape, and the difference from the Lift example is recorded in the parity allowlist. A new test checks that the endpoint lists each provider named in oauth2.oidc_provider with its discovery URL, lists none for none, and that the ResourceDoc's example has the same fields as a real answer.
…pprove or reject the request Until now a user could only get a Group's Roles by being added to it by someone holding CanAddUserToGroupAtOneBank or CanAddUserToGroupAtAllBanks. There was no way for them to ask for a Group, so they had to ask for each Role separately with an Entitlement Request. This adds Group Membership Requests in v7.0.0. GET /groups lists the enabled Groups a user can ask to join. Users manage their own requests at POST, GET and DELETE /my/group-membership-requests. Under a Consent, a request is made for the person who gave the Consent. Anyone who may add users to a Group sees its requests at GET /management/group-membership-requests, which can be filtered by status and group_id. They answer a request at .../approval or .../rejection. Approving adds the user to the Group with its Roles. Rejecting needs a comment. Nobody can answer their own request (MakerCheckerSameUser). A request is answered only once: a conditional update from INITIATED stops two people answering it at the same time. Answered requests stay on record, and a waiting request can be withdrawn. The new errors are OBP-30284 to OBP-30290. Adding users to a Group is moved into GroupMemberships.addUser. Both v6.0.0 Grant User Membership to Group Entitlements and the new approval endpoint now use it. When a user is added directly while their request is still waiting, the request is approved. Delete Group now also deletes the Group's requests. The new GroupMembershipRequest table is added to the schema in Boot.
…oup at its own space Any user holding CanAddUserToGroupAtAllBanks could add users to the Groups of every bank. Under ANY_BANK_ROLE_REMOVAL_PLAN.md that kind of Role is being retired. System level Groups were the only ones that needed it, so they had no Role scoped to them alone. Adding users to a Group now needs CanAddUserToGroupAtOneBank at the Group's space. That is its bank, or SYS for a system level Group. GroupMemberships gets mayAddUsers and missingAddRole for this check, and they are used by v6.0.0 Add User to Group, by the v7.0.0 Group Membership Request endpoints and by the Group sync endpoints. When the check fails, the error message names the space where the Role is missing. A Group in SYS now grants its system Roles, such as CanGetAnyUser, at the empty bank id, because that is where system Roles are read. It grants its other Roles at SYS. Adding a user, syncing members and moving Entitlements between Groups now compare (bank id, Role) pairs worked out by grantBankId. Before, they only compared Roles at the Group's bank id. The endpoint descriptions, the parity allowlist digest for addUserToGroup and the tests are updated. The Role is removed from the any-bank sweep list. This change also adds the CanGetOpenCorridorRoutingPolicy and CanUpdateOpenCorridorRoutingPolicy Roles to ApiRole, which the next commit uses.
…ank's routing policy An Open Corridor payment could only go to a bank that is a member of this OBP instance. Members could already publish onward routes to banks on other instances, but those routes could not be used for a payment, and a sending bank had no say in which member carried its payments or where they went. A sending bank now has a routing policy, stored in the new OpenCorridorRoutingPolicy table. It lists the hubs the bank approves, in order of preference, and the countries and OBP hosts its payments must not go to. It is read with GET and replaced with PUT on /obp/v7.0.0/banks/BANK_ID/open-corridor/routing-policy, which need the Roles CanGetOpenCorridorRoutingPolicy and CanUpdateOpenCorridorRoutingPolicy. An approved hub that is not a member, or is the bank itself, is refused with OBP-40073. When the bank that `to` names is not a member, OBP-API now uses HubChoice to pick a hub from the valid onward routes. It refuses the payment when members disagree about where the bank is, and otherwise follows the policy's order and exclusions. The payment is made to the hub. The onward leg is stored as the open_corridor_onward Transaction Request attribute and carried as `onward` on the hub's credit notification. The new optional beneficiary_currency field lets a hub convert currency, at the rate on its route, rounded down to the currency's smallest unit. The response shows the route taken as open_corridor_route. A refused payment gets OBP-40070, OBP-40071, OBP-40072 or OBP-40074. The Onward Routes glossary entry and the endpoint documentation describe how the hub is chosen.
…la code is not allowed ABAC rules could only be written in Scala. Scala rules are compiled into the running server, so they need allow_user_generated_scala_code=true, and most instances could not use ABAC rules at all. CEL (Common Expression Language) cannot run loops, call out or change anything, so CEL rules are allowed on every instance. The create, update and validate ABAC rule requests take rule_language, which is "scala" or "cel". A create or validate request without it is for a Scala rule, and an update without it keeps the rule's current language. An unknown language is refused with OBP-38012. A Scala rule is refused with DynamicCodeExecutionDisabled when allow_user_generated_scala_code is not true. The language is stored in a new RuleLanguage column. Rows saved before this have no language stored and are read as Scala. AbacCel defines the documented view of the data a CEL rule sees. It checks a rule when the rule is saved and reports syntax, field reference and type errors with their line and column. It compiles the rule to the same function type a Scala rule compiles to, so caching, execution and the permissiveness checks treat both languages alike. A CEL rule that constant folding reduces to true is refused as too permissive. GET /obp/v6.0.0/management/abac-rules-schema gains a cel section listing the variables, fields and examples. The cel dependency is the 0.9.1-proto3 build, which works with the pinned protobuf-java 3.25.5. The maker/checker approval hash now covers the language as well as the code, so changing only the language of an approved rule needs a new approval. A Scala rule keeps the hash of its code alone, so approvals made before rule languages existed stay valid. This commit also carries the v6.0.0 Group endpoint changes that go with the previous commit, because they are in the same file. Those endpoints now need the OneBank Roles at the Group's space. Without bank_id, Get Groups lists the Groups of each space where the caller holds CanGetGroupsAtOneBank. The resource doc parity allowlist records both changes.
…tity Audit Chains example The example response of the audit chain check showed only one problem, so the typed schema, which is built from the first problem, never showed chain_id. The example now has two problems. The first is a record changed without going through OBP-API, found in an entity's own chain with include_chains=true, and it names that chain.
…agree about a bank An Open Corridor payment through a hub was refused with OBP-40072 whenever any two members of the OBP instance placed the beneficiary bank on different OBP instances or in different countries. This happened even when the sending bank approved neither of them. One wrong or careless onward route could stop every bank paying the beneficiary bank. HubChoice now checks for disagreement after it keeps the hubs the sending bank's routing policy approves. It compares those hubs' routes to the bank in any currency, so a route from a member the bank has not approved can no longer block its payments. The OBP-40072 message, the Open Corridor glossary steps and the Create Transaction Request description say the same. ErrorMessages and Glossary also gain the texts for ABAC rules written in CEL (OBP-38012 InvalidAbacRuleLanguage and the ABAC_CEL_Rules glossary item). A later commit uses them.
… Group's own space Creating, getting, updating and deleting Groups, removing users from them and getting users' Group memberships could each be authorised by an AllBanks Role. These Roles worked at every bank at once, which goes against the plan to remove any-bank Roles. CanCreateGroupAtAllBanks, CanGetGroupsAtAllBanks, CanUpdateGroupAtAllBanks, CanDeleteGroupAtAllBanks, CanRemoveUserFromGroupAtAllBanks and CanGetUserGroupMembershipsAtAllBanks are removed. Each of these actions now needs its OneBank Role at the Group's space: the Group's bank, or SYS for a system level Group. GroupMemberships gains holdsAtSpace, holdsAtSomeSpace and missingRoleAtSpace for these checks. The v7.0.0 Group sync endpoints need CanRemoveUserFromGroupAtOneBank at the Group's space. The tests grant the OneBank Roles, check that the retired Roles no longer exist and cover a SYS Group end to end. The matching changes to the v6.0.0 Group endpoints are in the next commit, because they share a file with that commit's work.
The callContext view given to CEL ABAC rules found the User-Agent header with its own case-insensitive search of the request headers. It now uses the shared RequestHeadersUtil.find, so CEL rules see the User-Agent found the same way as in the rest of OBP-API.
|
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.



No description provided.