UMDLARS / dtanm

A framework to teach adversarial thinking to software developers without requiring any special security knowledge
3 stars 2 forks source link

Remove duplicated Result code in worker #100

Closed ChandlerSwift closed 4 years ago

ChandlerSwift commented 4 years ago

In the worker, result.py consists of a lot of redefinitions from web/web/models/result.py, which could be replaced with something like

    __table__ = Table('result', Base.metadata,
                      autoload=True, autoload_with=engine)
ChandlerSwift commented 4 years ago

Currently this has problems because when we try to assign start_time, it doesn't seem to be properly cast.

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.DatatypeMismatch) column "start_time" is of type timestamp without time zone but expression is of type numeric
LINE 3: ...NULL, true, '', NULL, true, NULL, true, 0, false, 1593375265...

Adding a single field is not possible:

class Result(Base):
    __table__ = Table('result', Base.metadata,
                      autoload=True, autoload_with=engine)

    start_time = Column(DateTime) # If this is autoloaded, Python doesn't cast correctly.
sqlalchemy.exc.ArgumentError: Can't add additional column 'start_time' when specifying __table__