Skip to content

Commit

Permalink
Ensure that admin operations are gated by super user check (apache#7226)
Browse files Browse the repository at this point in the history
* Ensure that admin operations are gated by super user check

* keep /clusters open

Co-authored-by: Sanjeev Kulkarni <sanjeevk@splunk.com>
  • Loading branch information
srkukarni and Sanjeev Kulkarni authored Jun 11, 2020
1 parent 47f57b0 commit eda3526
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,12 @@ public void deleteDynamicConfiguration(@PathParam("configName") String configNam
@Path("/configuration/values")
@ApiOperation(value = "Get value of all dynamic configurations' value overridden on local config")
@ApiResponses(value = {
@ApiResponse(code = 403, message = "You don't have admin permission to view configuration"),
@ApiResponse(code = 404, message = "Configuration not found"),
@ApiResponse(code = 500, message = "Internal server error")})
public Map<String, String> getAllDynamicConfigurations() throws Exception {
validateSuperUserAccess();

ZooKeeperDataCache<Map<String, String>> dynamicConfigurationCache = pulsar().getBrokerService()
.getDynamicConfigurationCache();
Map<String, String> configurationMap = null;
Expand All @@ -175,7 +178,10 @@ public Map<String, String> getAllDynamicConfigurations() throws Exception {
@GET
@Path("/configuration")
@ApiOperation(value = "Get all updatable dynamic configurations's name")
@ApiResponses(value = {
@ApiResponse(code = 403, message = "You don't have admin permission to get configuration")})
public List<String> getDynamicConfigurationName() {
validateSuperUserAccess();
return BrokerService.getDynamicConfiguration();
}

Expand Down Expand Up @@ -240,7 +246,9 @@ private synchronized void updateDynamicConfigurationOnZk(String configName, Stri
@GET
@Path("/internal-configuration")
@ApiOperation(value = "Get the internal configuration data", response = InternalConfigurationData.class)
@ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission") })
public InternalConfigurationData getInternalConfigurationData() {
validateSuperUserAccess();
return pulsar().getInternalConfigurationData();
}

Expand Down

0 comments on commit eda3526

Please sign in to comment.