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

Add missing settings to plugin allowed list #1814

Merged
merged 19 commits into from
Jun 9, 2022

Conversation

peternied
Copy link
Member

@peternied peternied commented Apr 29, 2022

Description

As settings have migrated from opendistro_security -> plugins.security, there were missed settings for the audit filter entries. This caused unknown setting errors when starting OpenSearch, and these settings values were not being applied correctly affecting the runtime behavior of the audit log filters.

Created FilterEntries enum, as the filter keys/namespaced-keys are used
in more than once spot if we add a new filter key, we need a way to know
if the entries were updated in the otherside of the codebase where the
defaults are used. In the settings configuration, if a new enum value
is added and not included a runtime exception will fire on startup,
ensuring new settings are always included.

This could be better where the enum defines the default values and how
the settings are extracted from json, but that would be a considerable
larger scope with the inclusion of generics.

Signed-off-by: Peter Nied [email protected]

Issues Resolved

Check List

  • New functionality includes testing
  • New functionality has been documented
  • 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.

Created FilterEntries enum, as the filter keys/namespaced-keys are used
in more than once spot if we add a new filter key, we need a way to know
if the entries were updated in the otherside of the codebase where the
defaults are used.  In the settings configuration, if a new enum value
is added and not included a runtime exception will fire on startup,
ensuring new settings are always included.

This could be better where the enum defines the default values and how
the settings are extracted from json, but that would be a considerable
larger scope with the inclusion of generics.

Signed-off-by: Peter Nied <[email protected]>
@peternied peternied self-assigned this Apr 29, 2022
@peternied peternied added the bug Something isn't working label Apr 29, 2022
DarshitChanpura
DarshitChanpura previously approved these changes May 3, 2022
Signed-off-by: Peter Nied <[email protected]>
@peternied peternied marked this pull request as ready for review May 26, 2022 23:01
@peternied peternied requested a review from a team May 26, 2022 23:01
@peternied peternied marked this pull request as draft May 27, 2022 18:11
@peternied
Copy link
Member Author

Moving back to draft until all test cases have been fix

peternied added 3 commits May 27, 2022 18:49
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
@@ -130,9 +131,9 @@ public static AuditConfig from(final Settings settings) {
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class Filter {
private static Set<String> FIELDS = DefaultObjectMapper.getFields(Filter.class);
Copy link
Member Author

Choose a reason for hiding this comment

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

After adding changes to the .from method, this made the order of these static fields was incorrect causing static constructors to fail. A great reminder to use lazy loading avoiding static order of operations management.

@codecov-commenter
Copy link

codecov-commenter commented May 27, 2022

Codecov Report

Merging #1814 (a905e8e) into main (94cc878) will increase coverage by 0.13%.
The diff coverage is 96.72%.

@@             Coverage Diff              @@
##               main    #1814      +/-   ##
============================================
+ Coverage     60.87%   61.00%   +0.13%     
- Complexity     3215     3226      +11     
============================================
  Files           256      256              
  Lines         18012    18050      +38     
  Branches       3211     3212       +1     
============================================
+ Hits          10965    11012      +47     
+ Misses         5467     5459       -8     
+ Partials       1580     1579       -1     
Impacted Files Coverage Δ
...ensearch/security/auditlog/impl/AuditCategory.java 100.00% <ø> (ø)
.../opensearch/security/OpenSearchSecurityPlugin.java 79.67% <80.00%> (+<0.01%) ⬆️
...ensearch/security/auditlog/config/AuditConfig.java 99.12% <100.00%> (+0.27%) ⬆️
...pensearch/security/auditlog/impl/AuditMessage.java 73.73% <100.00%> (+0.26%) ⬆️
...iance/ComplianceIndexingOperationListenerImpl.java 62.31% <0.00%> (+1.44%) ⬆️
...ecurity/configuration/ConfigurationRepository.java 74.31% <0.00%> (+2.18%) ⬆️
...earch/security/ssl/util/SSLConnectionTestUtil.java 95.45% <0.00%> (+2.27%) ⬆️
...urity/ssl/transport/SecuritySSLNettyTransport.java 66.66% <0.00%> (+4.30%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 94cc878...a905e8e. Read the comment docs.

@peternied peternied marked this pull request as ready for review May 31, 2022 16:04
@peternied
Copy link
Member Author

@opensearch-project/security Could I get a review on this pull request?

@cliu123
Copy link
Member

cliu123 commented Jun 8, 2022

@peternied Could you please explain what the root cause of the issue #1581 is? That'll help me understand how this PR fixes the issue.

1 similar comment
@cliu123
Copy link
Member

cliu123 commented Jun 8, 2022

@peternied Could you please explain what the root cause of the issue #1581 is? That'll help me understand how this PR fixes the issue.

@peternied
Copy link
Member Author

@cliu123 I've updated the description with the root cause/the nature of the fix.

As settings have migrated from opendistro_security -> plugins.security, there were missed settings for the audit filter entries. This caused unknown setting errors when starting OpenSearch, and these settings values were not being applied correctly affecting the runtime behavior of the audit log filters.

@cliu123
Copy link
Member

cliu123 commented Jun 9, 2022

@peternied Please merge when you are ready.

@peternied
Copy link
Member Author

There is an issue with the main branch build process, I am going to hold off on merging until it has been resolved

@peternied peternied merged commit 001d73f into opensearch-project:main Jun 9, 2022
@peternied peternied deleted the fix-1581 branch June 9, 2022 20:13
stephen-crawford pushed a commit to stephen-crawford/security that referenced this pull request Nov 10, 2022
* Add missing settings to plugin allowed list

As settings have migrated from opendistro_security -> plugins.security, there were missed settings for the audit filter entries. This caused unknown setting errors when starting OpenSearch, and these settings values were not being applied correctly affecting the runtime behavior of the audit log filters.

Signed-off-by: Stephen Crawford <[email protected]>
wuychn pushed a commit to ochprince/security that referenced this pull request Mar 16, 2023
* Add missing settings to plugin allowed list

As settings have migrated from opendistro_security -> plugins.security, there were missed settings for the audit filter entries. This caused unknown setting errors when starting OpenSearch, and these settings values were not being applied correctly affecting the runtime behavior of the audit log filters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Documented audit log settings do not work
4 participants