api: avoid sending sensitive data in api response

- UI: use post when updating user
- S3: don't send s3 key in the response
- VPN: don't send preshared key in remoteaccessvpn api response
- Snapshot response should set zone id not volume's device id

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 02cadc3fb3)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	server/src/com/cloud/api/ApiResponseHelper.java
This commit is contained in:
Rohit Yadav 2015-03-11 16:30:20 +05:30
parent eed3db8851
commit c620a0640a
4 changed files with 5 additions and 11 deletions

View File

@ -41,10 +41,6 @@ public class RemoteAccessVpnResponse extends BaseResponse implements ControlledE
@Param(description = "the range of ips to allocate to the clients")
private String ipRange;
@SerializedName("presharedkey")
@Param(description = "the ipsec preshared key")
private String presharedKey;
@SerializedName(ApiConstants.ACCOUNT)
@Param(description = "the account of the remote access vpn")
private String accountName;
@ -85,10 +81,6 @@ public class RemoteAccessVpnResponse extends BaseResponse implements ControlledE
this.ipRange = ipRange;
}
public void setPresharedKey(String presharedKey) {
this.presharedKey = presharedKey;
}
@Override
public void setAccountName(String accountName) {
this.accountName = accountName;

View File

@ -1284,7 +1284,6 @@ public class ApiResponseHelper implements ResponseGenerator {
vpnResponse.setPublicIp(ip.getAddress().addr());
}
vpnResponse.setIpRange(vpn.getIpRange());
vpnResponse.setPresharedKey(vpn.getIpsecPresharedKey());
populateOwner(vpnResponse, vpn);
vpnResponse.setState(vpn.getState().toString());
vpnResponse.setId(vpn.getUuid());

View File

@ -84,7 +84,8 @@ public class ImageStoreJoinDaoImpl extends GenericDaoBase<ImageStoreJoinVO, Long
if ( detailName != null && detailName.length() > 0 && !detailName.equals(ApiConstants.PASSWORD)) {
String detailValue = ids.getDetailValue();
if (detailName.equals(ApiConstants.KEY) || detailName.equals(ApiConstants.S3_SECRET_KEY)) {
detailValue = DBEncryptionUtil.decrypt(detailValue);
// ALWAYS return an empty value for the S3 secret key since that key is managed by Amazon and not CloudStack
detailValue = "";
}
ImageStoreDetailResponse osdResponse = new ImageStoreDetailResponse(detailName, detailValue);
osResponse.addDetail(osdResponse);
@ -99,7 +100,8 @@ public class ImageStoreJoinDaoImpl extends GenericDaoBase<ImageStoreJoinVO, Long
if ( detailName != null && detailName.length() > 0 && !detailName.equals(ApiConstants.PASSWORD)) {
String detailValue = ids.getDetailValue();
if (detailName.equals(ApiConstants.KEY) || detailName.equals(ApiConstants.S3_SECRET_KEY)) {
detailValue = DBEncryptionUtil.decrypt(detailValue);
// ALWAYS return an empty value for the S3 secret key since that key is managed by Amazon and not CloudStack
detailValue = "";
}
ImageStoreDetailResponse osdResponse = new ImageStoreDetailResponse(detailName, detailValue);
response.addDetail(osdResponse);

View File

@ -37,6 +37,7 @@
id: cloudStack.context.users[0].userid,
password: md5Hashed ? $.md5(args.data.password) : todb(args.data.password)
},
type: 'POST',
dataType: 'json',
async: true,
success: function(data) {