mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +00:00
security: Drop use of loaded_modules and use App.list
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
bc3a879ead
commit
8382a604bb
@ -11,7 +11,7 @@ from django.utils.translation import gettext_lazy as _
|
|||||||
|
|
||||||
from plinth import actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import menu, module_loader
|
from plinth import menu
|
||||||
from plinth.daemon import Daemon, RelatedDaemon
|
from plinth.daemon import Daemon, RelatedDaemon
|
||||||
from plinth.modules.backups.components import BackupRestore
|
from plinth.modules.backups.components import BackupRestore
|
||||||
from plinth.package import Packages
|
from plinth.package import Packages
|
||||||
@ -128,8 +128,8 @@ def get_apps_report():
|
|||||||
'vulns': 0,
|
'vulns': 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for module_name, module in module_loader.loaded_modules.items():
|
for app_ in app_module.App.list():
|
||||||
components = module.app.get_components_of_type(Packages)
|
components = app_.get_components_of_type(Packages)
|
||||||
packages = []
|
packages = []
|
||||||
for component in components:
|
for component in components:
|
||||||
packages += component.packages
|
packages += component.packages
|
||||||
@ -137,24 +137,24 @@ def get_apps_report():
|
|||||||
if not packages:
|
if not packages:
|
||||||
continue # app has no managed packages
|
continue # app has no managed packages
|
||||||
|
|
||||||
components = module.app.get_components_of_type(Daemon)
|
components = app_.get_components_of_type(Daemon)
|
||||||
services = []
|
services = []
|
||||||
for component in components:
|
for component in components:
|
||||||
services.append(component.unit)
|
services.append(component.unit)
|
||||||
|
|
||||||
# filter out apps not setup yet
|
# filter out apps not setup yet
|
||||||
if module.app.needs_setup():
|
if app_.needs_setup():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
apps[module_name] = {
|
apps[app_.app_id] = {
|
||||||
'name': module_name,
|
'name': app_.app_id,
|
||||||
'packages': set(packages),
|
'packages': set(packages),
|
||||||
'vulns': 0,
|
'vulns': 0,
|
||||||
'sandboxed': None,
|
'sandboxed': None,
|
||||||
}
|
}
|
||||||
|
|
||||||
if services:
|
if services:
|
||||||
apps[module_name]['sandboxed'] = False
|
apps[app_.app_id]['sandboxed'] = False
|
||||||
for service in services:
|
for service in services:
|
||||||
# If an app lists a timer, work on the associated service
|
# If an app lists a timer, work on the associated service
|
||||||
# instead
|
# instead
|
||||||
@ -162,8 +162,8 @@ def get_apps_report():
|
|||||||
service = service.rpartition('.')[0]
|
service = service.rpartition('.')[0]
|
||||||
|
|
||||||
if _get_service_is_sandboxed(service):
|
if _get_service_is_sandboxed(service):
|
||||||
apps[module_name]['sandboxed'] = True
|
apps[app_.app_id]['sandboxed'] = True
|
||||||
apps[module_name][
|
apps[app_.app_id][
|
||||||
'sandbox_coverage'] = sandbox_coverage.get(service)
|
'sandbox_coverage'] = sandbox_coverage.get(service)
|
||||||
|
|
||||||
for cve_packages in cves.values():
|
for cve_packages in cves.values():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user