Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResultsTransformer interface #466

Merged
merged 6 commits into from
Apr 13, 2021

Conversation

degenaro
Copy link
Collaborator

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commits are signed-off.

Description

  • support blob interface
  • only support dir output (not merged file)
  • adjust cli doc
  • move to folder transforms/implementations/tanium.py
  • move to folder transforms/utils/tanium_helper.py
  • catch exceptions
  • use oscal_write

Addresses 1/2 of issue #452

@degenaro degenaro self-assigned this Apr 13, 2021
@codecov
Copy link

codecov bot commented Apr 13, 2021

Codecov Report

Merging #466 (bfcc7bc) into develop (1407911) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #466   +/-   ##
========================================
  Coverage    98.18%   98.19%           
========================================
  Files           70       71    +1     
  Lines         7458     7464    +6     
========================================
+ Hits          7323     7329    +6     
  Misses         135      135           
Impacted Files Coverage Δ
trestle/transforms/utils/tanium_helper.py 100.00% <ø> (ø)
trestle/tasks/tanium_to_oscal.py 100.00% <100.00%> (ø)
trestle/transforms/implementations/tanium.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1407911...bfcc7bc. Read the comment docs.

@degenaro degenaro requested a review from butler54 April 13, 2021 01:10
Comment on lines +36 to +44
def set_timestamp(value: str) -> None:
"""Set the default timestamp value."""
datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S%z')
TaniumTransformer._timestamp = value

@staticmethod
def get_timestamp() -> str:
"""Get the default timestamp value."""
return TaniumTransformer._timestamp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@degenaro do you think timestamp is something we should generically make available as part of the base class? I see it as been something that is generic enough it might be worthwhile (as a future enhancement).

Will not block the PR but feedback would be appreciated.

Copy link
Collaborator

@butler54 butler54 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fsuits to add transformer registration prior to the PR being merged.

fsuits added 2 commits April 13, 2021 12:53
Signed-off-by: FrankSuits <frankst@au1.ibm.com>
Signed-off-by: FrankSuits <frankst@au1.ibm.com>
@butler54 butler54 merged commit 6fced57 into develop Apr 13, 2021
@butler54 butler54 deleted the feat/results-transformer-interface-tanium branch April 13, 2021 03:16
vikas-agarwal76 pushed a commit that referenced this pull request Apr 14, 2021
…former interface (#466)

* ResultsTransformer interface

* remove trestle.utils.tanium

* remove trestle.utils.tanium.py

* added registration of tanium transformer

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

* added name for registration

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

Co-authored-by: Chris Butler <chris@thebutlers.me>
Co-authored-by: FrankSuits <frankst@au1.ibm.com>
Signed-off-by: Vikas <avikas@in.ibm.com>
butler54 added a commit that referenced this pull request Apr 15, 2021
* changed print to logger

* Added experiments profiling setup

Signed-off-by: Chris Butler <chris@thebutlers.me>

* added flah to benchmark with or without json serialization

* readme file for assessment. result object

* changed prinet to logger

Signed-off-by: Vikas <avikas@in.ibm.com>

* feat: Update NIST models to latest including refactors & UT's

* feat:Update Oscal version

Signed-off-by: Chris Butler <chris@thebutlers.me>

* transformer changes with respect to OSCAL 1.0.0 rc2

* update documentation (transform results)

* multiple changes for latest nist - some tests still fail

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

* removed ssp validate test

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

* fixed code format

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

* fix:Reworking generators

Signed-off-by: Chris Butler <chris@thebutlers.me>

* cleaned up gen-oscal.py and regenerated the oscal models.

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

Co-authored-by: Chris Butler <chris@thebutlers.me>
Co-authored-by: degenaro <lou.degenaro@gmail.com>
Signed-off-by: Vikas <avikas@in.ibm.com>

* 0.11.0

Automatically generated by python-semantic-release

Signed-off-by: Vikas <avikas@in.ibm.com>

* feat:Improved serialisation support for OscalBaseModel (#454)

* feat:Improved serialization support.

Signed-off-by: Chris Butler <chris@thebutlers.me>

* fix:Serializing by appropriate key and minimizing file size.

Signed-off-by: Chris Butler <chris@thebutlers.me>
Signed-off-by: Vikas <avikas@in.ibm.com>

* Feat:transformer factory (#455)

* initial prototype of transformer factory

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

* added singleton transformer factory

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

* added base transformer class

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

* more fixes and added tests

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

* added test for transform factory

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

* restructured, added more docs and tests.

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

* removed bad file names.

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

* fix:Typing information

Signed-off-by: Chris Butler <chris@thebutlers.me>

Co-authored-by: Chris Butler <chris@thebutlers.me>
Signed-off-by: Vikas <avikas@in.ibm.com>

* 0.12.0

Automatically generated by python-semantic-release

Signed-off-by: Vikas <avikas@in.ibm.com>

* Added experiments profiling setup

Signed-off-by: Chris Butler <chris@thebutlers.me>
Signed-off-by: Vikas <avikas@in.ibm.com>

* added flah to benchmark with or without json serialization

Signed-off-by: Vikas <avikas@in.ibm.com>

* readme file for assessment. result object

Signed-off-by: Vikas <avikas@in.ibm.com>

* feat: Update of OSCAL schema to 1.0.0-rc2 (#465)

* feat:Update core OSCAL schema

Signed-off-by: Chris Butler <chris@thebutlers.me>

* fix:Corrected OSCAL version in the docs

Signed-off-by: Chris Butler <chris@thebutlers.me>
Signed-off-by: Vikas <avikas@in.ibm.com>

* fix: Cleanup of fs.py to allow relative and absolute paths (#464)

* cleanup of fs.py to allow relative and absolute paths

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

* global change of absolute() to resolve()

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

Co-authored-by: Chris Butler <chris@thebutlers.me>
Signed-off-by: Vikas <avikas@in.ibm.com>

* feat: Tanium to oscal tranform refactored to exploit the ResultsTransformer interface (#466)

* ResultsTransformer interface

* remove trestle.utils.tanium

* remove trestle.utils.tanium.py

* added registration of tanium transformer

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

* added name for registration

Signed-off-by: FrankSuits <frankst@au1.ibm.com>

Co-authored-by: Chris Butler <chris@thebutlers.me>
Co-authored-by: FrankSuits <frankst@au1.ibm.com>
Signed-off-by: Vikas <avikas@in.ibm.com>

* 0.13.0

Automatically generated by python-semantic-release

Signed-off-by: Vikas <avikas@in.ibm.com>

* fix:Corrected transforms behaviour and added example script. (#468)

Signed-off-by: Chris Butler <chris@thebutlers.me>
Signed-off-by: Vikas <avikas@in.ibm.com>

* 0.13.1

Automatically generated by python-semantic-release

Signed-off-by: Vikas <avikas@in.ibm.com>

* chore: Update pre-commit markdown formatting (#476)

Signed-off-by: Chris Butler <chris@thebutlers.me>
Signed-off-by: Vikas <avikas@in.ibm.com>

* fix:Moved directories to fix testing errors.

Signed-off-by: Chris Butler <chris@thebutlers.me>

* fix:Moved directories to fix testing errors.

Signed-off-by: Chris Butler <chris@thebutlers.me>

* chnaged benchmark to use transform API

* removed script reslted to thrid party - exchange protocol, observations and their tests

* fix:Perf tuning of OscalBaseModel serialization.

Signed-off-by: Chris Butler <chris@thebutlers.me>

* fix:Mkdocs automation

Signed-off-by: Chris Butler <chris@thebutlers.me>

* fix:Mkdocs automation

Signed-off-by: Chris Butler <chris@thebutlers.me>

Co-authored-by: Vikas <avikas@in.ibm.com>
Co-authored-by: Chris Butler <chris@thebutlers.me>
Co-authored-by: Frank Suits <47203786+fsuits@users.noreply.github.com>
Co-authored-by: degenaro <lou.degenaro@gmail.com>
Co-authored-by: semantic-release <semantic-release>
Co-authored-by: FrankSuits <frankst@au1.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants