Add parent path information to malware detected items (#3221)
This allows identifying the file location when an item is detected with malware --- #### Does this PR need a docs update or release note? - [x] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [ ] ⛔ No #### Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [x] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * #3112 #### Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
559ad37a7e
commit
6395dcbe39
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Permissions backup for OneDrive is now out of experimental (By default, only newly backed up items will have their permissions backed up. You will have to run a full backup to ensure all items have their permissions backed up.)
|
- Permissions backup for OneDrive is now out of experimental (By default, only newly backed up items will have their permissions backed up. You will have to run a full backup to ensure all items have their permissions backed up.)
|
||||||
- LocationRef is now populated for all services and data types. It should be used in place of RepoRef if a location for an item is required.
|
- LocationRef is now populated for all services and data types. It should be used in place of RepoRef if a location for an item is required.
|
||||||
- User selection for Exchange and OneDrive can accept either a user PrincipalName or the user's canonical ID.
|
- User selection for Exchange and OneDrive can accept either a user PrincipalName or the user's canonical ID.
|
||||||
|
- Add path information to items that were skipped during backup because they were flagged as malware.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed permissions restore in latest backup version.
|
- Fixed permissions restore in latest backup version.
|
||||||
|
|||||||
@ -317,6 +317,15 @@ func ItemInfo(item models.DriveItemable) map[string]any {
|
|||||||
if parent != nil {
|
if parent != nil {
|
||||||
m[fault.AddtlContainerID] = ptr.Val(parent.GetId())
|
m[fault.AddtlContainerID] = ptr.Val(parent.GetId())
|
||||||
m[fault.AddtlContainerName] = ptr.Val(parent.GetName())
|
m[fault.AddtlContainerName] = ptr.Val(parent.GetName())
|
||||||
|
containerPath := ""
|
||||||
|
|
||||||
|
// Remove the "/drives/b!vF-sdsdsds-sdsdsa-sdsd/root:" prefix
|
||||||
|
splitPath := strings.SplitN(ptr.Val(parent.GetPath()), ":", 2)
|
||||||
|
if len(splitPath) > 1 {
|
||||||
|
containerPath = splitPath[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
m[fault.AddtlContainerPath] = containerPath
|
||||||
}
|
}
|
||||||
|
|
||||||
malware := item.GetMalware()
|
malware := item.GetMalware()
|
||||||
|
|||||||
@ -261,16 +261,18 @@ func (suite *GraphErrorsUnitSuite) TestIsErrUnauthorized() {
|
|||||||
|
|
||||||
func (suite *GraphErrorsUnitSuite) TestMalwareInfo() {
|
func (suite *GraphErrorsUnitSuite) TestMalwareInfo() {
|
||||||
var (
|
var (
|
||||||
i = models.DriveItem{}
|
i = models.DriveItem{}
|
||||||
cb = models.User{}
|
cb = models.User{}
|
||||||
cbID = "created-by"
|
cbID = "created-by"
|
||||||
lm = models.User{}
|
lm = models.User{}
|
||||||
lmID = "last-mod-by"
|
lmID = "last-mod-by"
|
||||||
ref = models.ItemReference{}
|
ref = models.ItemReference{}
|
||||||
refCID = "container-id"
|
refCID = "container-id"
|
||||||
refCN = "container-name"
|
refCN = "container-name"
|
||||||
mal = models.Malware{}
|
refCP = "/drives/b!vF-sdsdsds-sdsdsa-sdsd/root:/Folder/container-name"
|
||||||
malDesc = "malware-description"
|
refCPexp = "/Folder/container-name"
|
||||||
|
mal = models.Malware{}
|
||||||
|
malDesc = "malware-description"
|
||||||
)
|
)
|
||||||
|
|
||||||
cb.SetId(&cbID)
|
cb.SetId(&cbID)
|
||||||
@ -281,6 +283,7 @@ func (suite *GraphErrorsUnitSuite) TestMalwareInfo() {
|
|||||||
|
|
||||||
ref.SetId(&refCID)
|
ref.SetId(&refCID)
|
||||||
ref.SetName(&refCN)
|
ref.SetName(&refCN)
|
||||||
|
ref.SetPath(&refCP)
|
||||||
i.SetParentReference(&ref)
|
i.SetParentReference(&ref)
|
||||||
|
|
||||||
mal.SetDescription(&malDesc)
|
mal.SetDescription(&malDesc)
|
||||||
@ -291,6 +294,7 @@ func (suite *GraphErrorsUnitSuite) TestMalwareInfo() {
|
|||||||
fault.AddtlLastModBy: lmID,
|
fault.AddtlLastModBy: lmID,
|
||||||
fault.AddtlContainerID: refCID,
|
fault.AddtlContainerID: refCID,
|
||||||
fault.AddtlContainerName: refCN,
|
fault.AddtlContainerName: refCN,
|
||||||
|
fault.AddtlContainerPath: refCPexp,
|
||||||
fault.AddtlMalwareDesc: malDesc,
|
fault.AddtlMalwareDesc: malDesc,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ const (
|
|||||||
AddtlLastModBy = "last_modified_by"
|
AddtlLastModBy = "last_modified_by"
|
||||||
AddtlContainerID = "container_id"
|
AddtlContainerID = "container_id"
|
||||||
AddtlContainerName = "container_name"
|
AddtlContainerName = "container_name"
|
||||||
|
AddtlContainerPath = "container_path"
|
||||||
AddtlMalwareDesc = "malware_description"
|
AddtlMalwareDesc = "malware_description"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user