Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] Check for and perform upgrades on security configurations #4251

Merged

Conversation

willyborankin
Copy link
Collaborator

Backport fa877ba from #4102

…pensearch-project#4102)

This adds a new API that allows for checking and updating configurations
from the default configurations on disk. Initial feature supports only
Roles.

```
GET _plugins/_security/api/_upgrade_check
200 {
  "status": "ok",
  "upgradeAvailable" : false
}
```
```
GET _plugins/_security/api/_upgrade_check
200 {
  "status": "ok",
  "upgradeAvailable" : true,
  "upgradeActions" : {
    "roles" : {
      "add" : [ "flow_framework_full_access" ]
    }
  }
}
```
```
GET _plugins/_security/api/_upgrade_check
200 {
  "status": "ok",
  "upgradeAvailable" : true,
  "upgradeActions" : {
    "roles" : {
      "add" : [ "flow_framework_full_access" ],
      "modify" : [ "flow_framework_read_access" ]
    }
  }
}
```
```
POST _plugins/_security/api/_upgrade_perform
200 {
  "status" : "OK",
  "upgrades" : {
    "roles" : {
      "add" : [ "flow_framework_full_access" ],
      "modify" : [ "flow_framework_read_access" ]
    }
  }
}
```

```
POST _plugins/_security/api/_upgrade_perform
400 {
   "status": "BAD_REQUEST",
   "message": "Unable to upgrade, no differences found in 'roles' config"
}
```

- opensearch-project#2316

New unit test and integration test cases

- [X] New functionality includes testing
- [ ] New functionality has been documented
- [X] Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and
signing off your commits, please check
[here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).

---------

Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Andrey Pleskach <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
(cherry picked from commit fa877ba)
Copy link

codecov bot commented Apr 15, 2024

Codecov Report

Attention: Patch coverage is 75.50000% with 49 lines in your changes are missing coverage. Please review.

Project coverage is 65.79%. Comparing base (4cdf3d7) to head (ce6723f).
Report is 6 commits behind head on 2.x.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              2.x    #4251      +/-   ##
==========================================
+ Coverage   65.73%   65.79%   +0.06%     
==========================================
  Files         295      296       +1     
  Lines       21089    21258     +169     
  Branches     3461     3471      +10     
==========================================
+ Hits        13862    13986     +124     
- Misses       5487     5527      +40     
- Partials     1740     1745       +5     
Files Coverage Δ
...security/dlic/rest/api/SecurityRestApiActions.java 80.00% <ø> (ø)
.../dlic/rest/validation/RequestContentValidator.java 90.90% <ø> (ø)
...ecurity/configuration/ConfigurationRepository.java 70.35% <83.33%> (+0.30%) ⬆️
...arch/security/dlic/rest/api/AbstractApiAction.java 89.01% <92.30%> (+0.08%) ⬆️
...g/opensearch/security/securityconf/impl/CType.java 96.96% <96.15%> (-3.04%) ⬇️
...ecurity/dlic/rest/validation/ValidationResult.java 80.00% <14.28%> (-20.00%) ⬇️
...security/dlic/rest/api/ConfigUpgradeApiAction.java 72.97% <72.97%> (ø)

... and 1 file with indirect coverage changes

@peternied peternied changed the title [Backpotr 2.x] Check for and perform upgrades on security configurations [Backport 2.x] Check for and perform upgrades on security configurations Apr 15, 2024
@peternied peternied merged commit c0c4529 into opensearch-project:2.x Apr 15, 2024
78 checks passed
@willyborankin willyborankin deleted the backport-4102-to-2.x branch June 14, 2024 19:00
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