-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Remove @UpdateForV9 annotations from Security code #123176
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
Changes from all commits
c18b3ab
94d6062
1f236f1
a402f2b
7edaedc
e206c2a
32682ba
f3b7c6d
a3336f2
2012ab2
dc697d4
e756b91
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
import org.elasticsearch.common.logging.DeprecationCategory; | ||
import org.elasticsearch.common.logging.DeprecationLogger; | ||
import org.elasticsearch.common.util.Maps; | ||
import org.elasticsearch.core.UpdateForV9; | ||
import org.elasticsearch.core.UpdateForV10; | ||
import org.elasticsearch.protocol.xpack.license.GetLicenseRequest; | ||
import org.elasticsearch.rest.BaseRestHandler; | ||
import org.elasticsearch.rest.RestRequest; | ||
|
@@ -55,22 +55,21 @@ public String getName() { | |
* The licenses are sorted by latest issue_date | ||
*/ | ||
@Override | ||
@UpdateForV9(owner = UpdateForV9.Owner.SECURITY) // remove support for accept_enterprise param | ||
@UpdateForV10(owner = UpdateForV10.Owner.SECURITY) // remove support for accept_enterprise param | ||
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { | ||
final Map<String, String> overrideParams = Maps.newMapWithExpectedSize(2); | ||
overrideParams.put(License.REST_VIEW_MODE, "true"); | ||
overrideParams.put(License.LICENSE_VERSION_MODE, String.valueOf(License.VERSION_CURRENT)); | ||
|
||
// In 7.x, there was an opt-in flag to show "enterprise" licenses. In 8.0 the flag is deprecated and can only be true | ||
// TODO Remove this from 9.0 | ||
// In 7.x, there was an opt-in flag to show "enterprise" licenses. In 8.0+ the flag is deprecated and can only be true | ||
if (request.hasParam("accept_enterprise")) { | ||
deprecationLogger.warn( | ||
DeprecationCategory.API, | ||
"get_license_accept_enterprise", | ||
"Including [accept_enterprise] in get license requests is deprecated." | ||
+ " The parameter will be removed in the next major version" | ||
); | ||
if (request.paramAsBoolean("accept_enterprise", true) == false) { | ||
if (request.paramAsBoolean("accept_enterprise", true) == false) { // consumes the parameter to avoid error | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no actual change here (just updated comment). However, it is worth noting that this is BWC to leave the code as-is. 8.x has this same behavior, and the gating by REST API version (removed in a different PR) was not necessary: Removing support for |
||
throw new IllegalArgumentException("The [accept_enterprise] parameters may not be false"); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only way this could have ever been true is via REST API compatibility with v7: https://github.com/elastic/elasticsearch/blob/8.x/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java#L66-L72 . 9.x does not support REST API compatibility with v7, so this value will always be false. (If you used v7 compatibility, you could set the
accept_enterprise
parameter tofalse
which resulted inXCONTENT_HIDE_ENTERPRISE
beingtrue
, now that v7 compatibility is gone there is no way to setaccept_enterprise
tofalse
(via other validation) , soXCONTENT_HIDE_ENTERPRISE
is always false) This change is adjusting the code forhideEnterprise
is always false.