!2588 dlp权限校验

Merge pull request !2588 from jerry/master
This commit is contained in:
openharmony_ci 2022-07-30 12:26:54 +00:00 committed by Gitee
commit 5dabe234ec
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -19,6 +19,7 @@
#ifdef WITH_DLP
#include "ability_record.h"
#include "dlp_permission_kit.h"
#include "permission_verification.h"
#endif // WITH_DLP
#include "iremote_object.h"
#include "want.h"
@ -32,13 +33,17 @@ using Dlp = Security::DlpPermission::DlpPermissionKit;
static bool DlpAccessOtherAppsCheck(const sptr<IRemoteObject> &callerToken, const Want &want)
{
#ifdef WITH_DLP
auto isSaCall = AAFwk::PermissionVerification::GetInstance()->IsSACall();
if (isSaCall) {
return true;
}
if (callerToken == nullptr) {
return true;
}
auto abilityRecord = Token::GetAbilityRecordByToken(callerToken);
if (abilityRecord == nullptr) {
HILOG_ERROR("Ability has already been destroyed.");
return false;
return true;
}
if (abilityRecord->GetAppIndex() == 0) {
return true;