Add skeleton for computing erasure standards

This commit is contained in:
Xavier Bustamante Talavera 2018-11-15 13:35:19 +01:00
parent 0a9fbb0226
commit 0cc2bdba4d
4 changed files with 78 additions and 23 deletions

View File

@ -302,3 +302,45 @@ class Severity(IntEnum):
else: else:
m = '' m = ''
return m return m
class PhysicalErasureMethod(Enum):
"""Methods of physically erasing the data-storage, usually
destroying the whole component.
Certified data-storage destruction mean, as of `UNE-EN 15713
<https://www.une.org/encuentra-tu-norma/busca-tu-norma/norma?c=N0044792>`_,
reducing the material to a size making it undecipherable, illegible,
and non able to be re-built.
"""
Shred = 'Reduction of the data-storage to the required certified ' \
'standard sizes.'
Disintegration = 'Reduction of the data-storage to smaller sizes ' \
'than the certified standard ones.'
def __str__(self):
return self.name
class ErasureStandards(Enum):
HMG_IS5 = 'British HMG Infosec Standard 5 (HMG IS5)'
"""`British HMG Infosec Standard 5 (HMG IS5)
<https://en.wikipedia.org/wiki/Infosec_Standard_5>`_.
In order to follow this standard, an erasure must have the
following steps:
1. A first step writing zeroes to the data-storage units.
2. A second step erasing with random data, verifying the erasure
success in each hard-drive sector.
And be an :class:`ereuse_devicehub.resources.event.models.EraseSectors`.
"""
def __str__(self):
return self.value
@classmethod
def from_data_storage(cls, erasure):
raise NotImplementedError()

View File

@ -28,9 +28,10 @@ from ereuse_devicehub.db import db
from ereuse_devicehub.resources.agent.models import Agent from ereuse_devicehub.resources.agent.models import Agent
from ereuse_devicehub.resources.device.models import Component, Computer, DataStorage, Desktop, \ from ereuse_devicehub.resources.device.models import Component, Computer, DataStorage, Desktop, \
Device, Laptop, Server Device, Laptop, Server
from ereuse_devicehub.resources.enums import AppearanceRange, Bios, FunctionalityRange, \ from ereuse_devicehub.resources.enums import AppearanceRange, Bios, ErasureStandards, \
PriceSoftware, RATE_NEGATIVE, RATE_POSITIVE, RatingRange, RatingSoftware, ReceiverRole, \ FunctionalityRange, PhysicalErasureMethod, PriceSoftware, RATE_NEGATIVE, RATE_POSITIVE, \
Severity, SnapshotExpectedEvents, SnapshotSoftware, TestDataStorageLength RatingRange, RatingSoftware, ReceiverRole, Severity, SnapshotExpectedEvents, SnapshotSoftware, \
TestDataStorageLength
from ereuse_devicehub.resources.models import STR_SM_SIZE, Thing from ereuse_devicehub.resources.models import STR_SM_SIZE, Thing
from ereuse_devicehub.resources.user.models import User from ereuse_devicehub.resources.user.models import User
@ -306,14 +307,9 @@ class EraseBasic(JoinedWithOneDeviceMixin, EventWithOneDevice):
that has overwritten data with random bits, and ``StepZero``, that has overwritten data with random bits, and ``StepZero``,
for an erasure step that has overwritten data with zeros. for an erasure step that has overwritten data with zeros.
For example, if steps are set in the following order and the user Erasure standards define steps and methodologies to use.
used `EraseSectors`, the event represents a Devicehub automatically shows the standards that each erasure
`British HMG Infosec Standard 5 (HMG IS5) <https://en.wikipedia.org/ follows.
wiki/Infosec_Standard_5>`_:
1. A first step writing zeroes to the hard-drives.
2. A second step erasing with random data, verifying the erasure
success in each hard-drive sector.
""" """
zeros = Column(Boolean, nullable=False) zeros = Column(Boolean, nullable=False)
zeros.comment = """ zeros.comment = """
@ -321,7 +317,10 @@ class EraseBasic(JoinedWithOneDeviceMixin, EventWithOneDevice):
only writing zeros. only writing zeros.
""" """
# todo return erasure properties like num steps, if it is british... @property
def standards(self):
"""A set of standards that this erasure follows."""
return ErasureStandards.from_data_storage(self)
def __str__(self) -> str: def __str__(self) -> str:
return '{} on {}.'.format(self.severity, self.end_time) return '{} on {}.'.format(self.severity, self.end_time)
@ -336,8 +335,7 @@ class EraseSectors(EraseBasic):
class ErasePhysical(EraseBasic): class ErasePhysical(EraseBasic):
"""The act of physically destroying a data storage unit.""" """The act of physically destroying a data storage unit."""
# todo add attributes method = Column(DBEnum(PhysicalErasureMethod))
pass
class Step(db.Model): class Step(db.Model):
@ -508,10 +506,11 @@ class Rate(JoinedWithOneDeviceMixin, EventWithOneDevice):
visual, and functional information; which is filled in a ``Rate`` visual, and functional information; which is filled in a ``Rate``
event. This is done through a **software**, defining the type event. This is done through a **software**, defining the type
of ``Rate`` event. At the moment we have ``WorkbenchRate``. of ``Rate`` event. At the moment we have ``WorkbenchRate``.
2. Devicehub gathers this information and computes a score that updates 2. Devicehub gathers this information and computes a score, which
the ``Rate`` event. it is embedded into the Rate event.
3. Devicehub aggregates different rates and computes a final score for 3. Devicehub takes the rate from 2. and embeds it into an
the device by performing a new ``AggregateRating`` event. `AggregateRate` which is like a total rate. This is the
official rate that agents can lookup.
There are two base **types** of ``Rate``: ``WorkbenchRate``, There are two base **types** of ``Rate``: ``WorkbenchRate``,
``ManualRate``. ``WorkbenchRate`` can have different ``ManualRate``. ``WorkbenchRate`` can have different
@ -530,9 +529,9 @@ class Rate(JoinedWithOneDeviceMixin, EventWithOneDevice):
The technical Workflow in Devicehub is as follows: The technical Workflow in Devicehub is as follows:
1. In **T1**, the user performs a ``Snapshot`` by processing the device 1. In **T1**, the agent performs a ``Snapshot`` by processing the device
through the Workbench. From the benchmarks and the visual and through the Workbench. From the benchmarks and the visual and
functional ratings the user does in the device, the system generates functional ratings the agent does in the device, the system generates
many ``WorkbenchRate`` (as many as software and versions defined). many ``WorkbenchRate`` (as many as software and versions defined).
With only this information, the system generates an ``AggregateRating``, With only this information, the system generates an ``AggregateRating``,
which is the event that the user will see in the web. which is the event that the user will see in the web.

View File

@ -16,9 +16,9 @@ from teal.enums import Country
from ereuse_devicehub.resources.agent.models import Agent from ereuse_devicehub.resources.agent.models import Agent
from ereuse_devicehub.resources.device.models import Component, Computer, Device from ereuse_devicehub.resources.device.models import Component, Computer, Device
from ereuse_devicehub.resources.enums import AppearanceRange, Bios, FunctionalityRange, \ from ereuse_devicehub.resources.enums import AppearanceRange, Bios, ErasureStandards, \
PriceSoftware, RatingSoftware, ReceiverRole, Severity, SnapshotExpectedEvents, \ FunctionalityRange, PriceSoftware, RatingSoftware, ReceiverRole, Severity, \
SnapshotSoftware, TestDataStorageLength SnapshotExpectedEvents, SnapshotSoftware, TestDataStorageLength
from ereuse_devicehub.resources.models import Thing from ereuse_devicehub.resources.models import Thing
from ereuse_devicehub.resources.user.models import User from ereuse_devicehub.resources.user.models import User
@ -354,6 +354,10 @@ class EraseBasic(EventWithOneDevice):
self.zeros = ... # type: bool self.zeros = ... # type: bool
self.success = ... # type: bool self.success = ... # type: bool
@property
def standards(self) -> Set[ErasureStandards]:
pass
class EraseSectors(EraseBasic): class EraseSectors(EraseBasic):
def __init__(self, **kwargs) -> None: def __init__(self, **kwargs) -> None:

View File

@ -320,3 +320,13 @@ def test_ereuse_price():
return correct results.""" return correct results."""
# important to check Range.low no returning warranty2 # important to check Range.low no returning warranty2
# Range.verylow not returning nothing # Range.verylow not returning nothing
@pytest.mark.xfail(reson='Develop functionality')
def test_erase_standards():
pass
@pytest.mark.xfail(reson='Develop test')
def test_erase_physical():
pass