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 extensionName() to security extension #79329

Merged
merged 5 commits into from
Oct 19, 2021

Conversation

tvernum
Copy link
Contributor

@tvernum tvernum commented Oct 18, 2021

Extension loading code needs to know how to refer to an extension at
runtime. It previously used "toString()", but there was no contract
that required that this method be implemented in a meaningful way.

A new extensionName() method is added which defaults to the class name of the
extension, but can be customized by implementations

Extension loading code needs to know how to refer to an extension at
runtime. It previously used "toString()", but there was no contract
that required that this method be implemented in a meaningful way.

A new name() method is added which defaults to the class name of the
extension, but can be customized by implementations
@tvernum tvernum added >enhancement :Security/Security Security issues without another label v8.0.0 v7.16.0 labels Oct 18, 2021
@tvernum tvernum requested a review from ywangd October 18, 2021 01:04
@elasticmachine elasticmachine added the Team:Security Meta label for security team label Oct 18, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

@tvernum

This comment has been minimized.

@tvernum tvernum changed the title Add name() to security extension Add extensionName() to security extension Oct 18, 2021
+ "both set an authorization engine");
}
authorizationEngine = extensionEngine;
extensionName = extension.toString();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This old code was buggy.
If you have 3 extensions "a", "b", "c" and "a" & "b" both return an engine (but "c" doesn't) then the result would depend on the order of the extension list.

  • "a" "b" "c" ⇒ exception
  • "a" "c" "b" ⇒ return the engine from "b"

Because we set authorizationEngine and extensionName to the current extension in the list, even if that extension didn't return an engine.

Copy link
Member

@ywangd ywangd left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -115,4 +115,8 @@ default AuthenticationFailureHandler getAuthenticationFailureHandler(SecurityCom
default AuthorizationEngine getAuthorizationEngine(Settings settings) {
return null;
}

default String extensionName() {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: why not just name() since the word extension is already part of the class name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because I didn't think it would be as clear to people implementing security extensions what "name" was supposed to be, and what behaviour it should have.
extensionName is self describing

@tvernum
Copy link
Contributor Author

tvernum commented Oct 19, 2021

FIPS tests are failing for an unrelated reason. Merging this PR while we work on fixing them.

@tvernum tvernum merged commit c369f97 into elastic:master Oct 19, 2021
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
7.x Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 79329

weizijun added a commit to weizijun/elasticsearch that referenced this pull request Oct 19, 2021
* upstream/master: (34 commits)
  Add extensionName() to security extension (elastic#79329)
  More robust and consistent allowAll indicesAccessControl (elastic#79415)
  Fix circuit breaker leak in MultiTerms aggregation (elastic#79362)
  guard geoline aggregation from parents aggegator that emit empty buckets (elastic#79129)
  Vector tiles: increase the size of the envelope used to clip geometries (elastic#79030)
  Revert "[ML] Add queue_capacity setting to start deployment API (elastic#79369)" (elastic#79374)
  Convert token service license object to LicensedFeature (elastic#79284)
  [TEST] Fix ShardPathTests for MDP (elastic#79393)
  Fix fleet search API with no checkpints (elastic#79400)
  Reduce BWC version for transient settings (elastic#79396)
  EQL: Rename a test class for eclipse (elastic#79254)
  Use search_coordination threadpool in field caps (elastic#79378)
  Use query param instead of a system property for opting in for new cluster health response code (elastic#79351)
  Add new kNN search endpoint (elastic#79013)
  Disable BWC tests
  Convert auditing license object to LicensedFeature (elastic#79280)
  Update BWC versions after backport of elastic#78551
  Enable InstantiatingObjectParser to pass context as a first argument (elastic#79206)
  Move xcontent filtering tests (elastic#79298)
  Update links to Fleet/Agent docs (elastic#79303)
  ...
tvernum added a commit to tvernum/elasticsearch that referenced this pull request Oct 19, 2021
Extension loading code needs to know how to refer to an extension at
runtime. It previously used "toString()", but there was no contract
that required that this method be implemented in a meaningful way.

A new extensionName() method is added which defaults to the class
name of the extension, but can be customized by implementations

Backport of: elastic#79329
elasticsearchmachine pushed a commit that referenced this pull request Oct 19, 2021
Extension loading code needs to know how to refer to an extension at
runtime. It previously used "toString()", but there was no contract
that required that this method be implemented in a meaningful way.

A new extensionName() method is added which defaults to the class
name of the extension, but can be customized by implementations

Backport of: #79329
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Security/Security Security issues without another label Team:Security Meta label for security team v7.16.0 v8.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants