Skip to content

Commit a2a7288

Browse files
committed
Merge pull request apache#1021 from koushik-das/CLOUDSTACK-8485
CLOUDSTACK-8485: listAPIs are taking too long to return results- Removed regex. based search/replace of sensitive data on API response introduced as part of commit b0c6d47 - Added new response serializer to skip sensitive data from getting logged based on annotation present in resposne object fields - Added annotation (@loglevel(Log4jLevel.Off)) to sensitive response object fields Ran the following tests on simulator: test_vm_life_cycle.py Test advanced zone virtual router ... === TestName: test_advZoneVirtualRouter | Status : SUCCESS === ok Test Deploy Virtual Machine ... === TestName: test_deploy_vm | Status : SUCCESS === ok Test Multiple Deploy Virtual Machine ... === TestName: test_deploy_vm_multiple | Status : SUCCESS === ok Test Stop Virtual Machine ... === TestName: test_01_stop_vm | Status : SUCCESS === ok Test Start Virtual Machine ... === TestName: test_02_start_vm | Status : SUCCESS === ok Test Reboot Virtual Machine ... === TestName: test_03_reboot_vm | Status : SUCCESS === ok Test destroy Virtual Machine ... === TestName: test_06_destroy_vm | Status : SUCCESS === ok Test recover Virtual Machine ... === TestName: test_07_restore_vm | Status : SUCCESS === ok Test migrate VM ... === TestName: test_08_migrate_vm | Status : SUCCESS === ok Test destroy(expunge) Virtual Machine ... === TestName: test_09_expunge_vm | Status : SUCCESS === ok ---------------------------------------------------------------------- Ran 10 tests in 306.429s OK test_volumes.py Download a Volume attached to a VM ... === TestName: test_03_download_attached_volume | Status : SUCCESS === ok Delete a Volume attached to a VM ... === TestName: test_04_delete_attached_volume | Status : SUCCESS === ok Detach a Volume attached to a VM ... === TestName: test_05_detach_volume | Status : SUCCESS === ok Delete a Volume unattached to an VM ... === TestName: test_09_delete_detached_volume | Status : SUCCESS === ok ---------------------------------------------------------------------- Ran 4 tests in 184.132s OK test_network.py Test for delete account ... === TestName: test_delete_account | Status : SUCCESS === ok Test for Associate/Disassociate public IP address for admin account ... === TestName: test_public_ip_admin_account | Status : SUCCESS === ok Test for Associate/Disassociate public IP address for user account ... === TestName: test_public_ip_user_account | Status : SUCCESS === ok Test for release public IP address ... === TestName: test_releaseIP | Status : SUCCESS === ok ---------------------------------------------------------------------- Ran 4 tests in 783.726s OK test_routers.py Test router internal advanced zone ... SKIP: Marvin configuration has no host credentials to check router services Test restart network ... === TestName: test_03_restart_network_cleanup | Status : SUCCESS === ok Test router basic setup ... === TestName: test_05_router_basic | Status : SUCCESS === ok Test router advanced setup ... === TestName: test_06_router_advanced | Status : SUCCESS === ok Test stop router ... === TestName: test_07_stop_router | Status : SUCCESS === ok Test start router ... === TestName: test_08_start_router | Status : SUCCESS === ok Test reboot router ... === TestName: test_09_reboot_router | Status : SUCCESS === ok ---------------------------------------------------------------------- Ran 7 tests in 42.958s OK (SKIP=1) test_global_settings.py test update configuration setting at zone level scope ... === TestName: test_UpdateConfigParamWithScope | Status : SUCCESS === ok ---------------------------------------------------------------------- Ran 1 test in 0.127s OK test_resource_detail.py Test volume detail ... === TestName: test_01_updatevolumedetail | Status : SUCCESS === ok ---------------------------------------------------------------------- Ran 1 test in 11.492s OK * pr/1021: CLOUDSTACK-8485: listAPIs are taking too long to return results - Removed regex. based search/replace of sensitive data on API response introduced as part of commit b0c6d47 - Added new response serializer to skip sensitive data from getting logged based on annotation present in resposne object fields - Added new parameter 'isSensitive' to @PARAM for marking a field as sensitive in response objects Signed-off-by: Remi Bergsma <[email protected]>
2 parents 36d0bfd + e13df96 commit a2a7288

16 files changed

Lines changed: 153 additions & 77 deletions

File tree

‎api/src/com/cloud/serializer/Param.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,6 @@
3737
String since() default "";
3838

3939
RoleType[] authorized() default {};
40+
41+
boolean isSensitive() default false;
4042
}

‎api/src/org/apache/cloudstack/api/response/CreateSSHKeyPairResponse.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717
package org.apache.cloudstack.api.response;
1818

1919
import com.google.gson.annotations.SerializedName;
20-
2120
import com.cloud.serializer.Param;
2221

2322
public class CreateSSHKeyPairResponse extends SSHKeyPairResponse {
2423

2524
@SerializedName("privatekey")
26-
@Param(description = "Private key")
25+
@Param(description = "Private key", isSensitive = true)
2726
private String privateKey;
2827

2928
public CreateSSHKeyPairResponse() {

‎api/src/org/apache/cloudstack/api/response/GetVMPasswordResponse.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
public class GetVMPasswordResponse extends BaseResponse {
2626

2727
@SerializedName("encryptedpassword")
28-
@Param(description = "The base64 encoded encrypted password of the VM")
28+
@Param(description = "The base64 encoded encrypted password of the VM", isSensitive = true)
2929
private String encryptedPassword;
3030

3131
public GetVMPasswordResponse() {

‎api/src/org/apache/cloudstack/api/response/LoginCmdResponse.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public class LoginCmdResponse extends AuthenticationCmdResponse {
6363
private String registered;
6464

6565
@SerializedName(value = ApiConstants.SESSIONKEY)
66-
@Param(description = "Session key that can be passed in subsequent Query command calls")
66+
@Param(description = "Session key that can be passed in subsequent Query command calls", isSensitive = true)
6767
private String sessionKey;
6868

6969
public String getUsername() {

‎api/src/org/apache/cloudstack/api/response/RegisterResponse.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424

2525
public class RegisterResponse extends BaseResponse {
2626
@SerializedName("apikey")
27-
@Param(description = "the api key of the registered user")
27+
@Param(description = "the api key of the registered user", isSensitive = true)
2828
private String apiKey;
2929

3030
@SerializedName("secretkey")
31-
@Param(description = "the secret key of the registered user")
31+
@Param(description = "the secret key of the registered user", isSensitive = true)
3232
private String secretKey;
3333

3434
public String getApiKey() {

‎api/src/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class RemoteAccessVpnResponse extends BaseResponse implements ControlledE
4242
private String ipRange;
4343

4444
@SerializedName("presharedkey")
45-
@Param(description = "the ipsec preshared key")
45+
@Param(description = "the ipsec preshared key", isSensitive = true)
4646
private String presharedKey;
4747

4848
@SerializedName(ApiConstants.ACCOUNT)

‎api/src/org/apache/cloudstack/api/response/Site2SiteCustomerGatewayResponse.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class Site2SiteCustomerGatewayResponse extends BaseResponse implements Co
5151
private String guestCidrList;
5252

5353
@SerializedName(ApiConstants.IPSEC_PSK)
54-
@Param(description = "IPsec preshared-key of customer gateway")
54+
@Param(description = "IPsec preshared-key of customer gateway", isSensitive = true)
5555
private String ipsecPsk;
5656

5757
@SerializedName(ApiConstants.IKE_POLICY)

‎api/src/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class Site2SiteVpnConnectionResponse extends BaseResponse implements Cont
5858
private String guestCidrList;
5959

6060
@SerializedName(ApiConstants.IPSEC_PSK)
61-
@Param(description = "IPsec Preshared-Key of the customer gateway")
61+
@Param(description = "IPsec Preshared-Key of the customer gateway", isSensitive = true)
6262
//from CustomerGateway
6363
private String ipsecPsk;
6464

‎api/src/org/apache/cloudstack/api/response/UserResponse.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ public class UserResponse extends BaseResponse {
7878
private String timezone;
7979

8080
@SerializedName("apikey")
81-
@Param(description = "the api key of the user")
81+
@Param(description = "the api key of the user", isSensitive = true)
8282
private String apiKey;
8383

8484
@SerializedName("secretkey")
85-
@Param(description = "the secret key of the user")
85+
@Param(description = "the secret key of the user", isSensitive = true)
8686
private String secretKey;
8787

8888
@SerializedName("accountid")

‎api/src/org/apache/cloudstack/api/response/UserVmResponse.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
221221
private Set<SecurityGroupResponse> securityGroupList;
222222

223223
@SerializedName(ApiConstants.PASSWORD)
224-
@Param(description = "the password (if exists) of the virtual machine")
224+
@Param(description = "the password (if exists) of the virtual machine", isSensitive = true)
225225
private String password;
226226

227227
@SerializedName("nic")

0 commit comments

Comments
 (0)