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

CPLYTM-224: OSCAL Profiles sort by level - task and command (WIP) #4

Merged
merged 3 commits into from
Jan 12, 2025

Conversation

hbraswelrh
Copy link
Owner

Description

The sync_cac_content_profile sub-command will provide users with the ability to indicate the control file for use when authoring OSCAL profiles within trestle-bot. This PR will include a task that interacts directly with the CLI to sort the contents of the control files by level. The level indicated is included in the authored OSCAL profile title and is tailored to the baseline level. If there is no level associated with the control file, the task will create a single profile with all controls.

Fixes # (issue)

Type of change

  • [ X ] New feature (non-breaking change which adds functionality)
  • [ X ] This change requires a documentation update

How has this been tested?

  • Test A
  • Test B

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@hbraswelrh hbraswelrh merged commit 06ab49a into main Jan 12, 2025
4 of 10 checks passed
hbraswelrh added a commit that referenced this pull request Jan 18, 2025
# This is the 1st commit message:

docs: add CI workflows to contributing guide

# This is the commit message #2:

docs: applying suggestions from code review for authoring CI workflows

Co-authored-by: Jennifer Power <jpower@redhat.com>
# This is the commit message #3:

fix: run the paths-filter step in its own job (complytime#370)

Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
# This is the commit message #4:

build(deps-dev): bump mkdocs-material from 9.5.37 to 9.5.43 (complytime#377)

Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.5.37 to 9.5.43.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](squidfunk/mkdocs-material@9.5.37...9.5.43)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# This is the commit message #5:

build(deps-dev): bump virtualenv from 20.26.5 to 20.27.1 (complytime#379)

Bumps [virtualenv](https://github.com/pypa/virtualenv) from 20.26.5 to 20.27.1.
- [Release notes](https://github.com/pypa/virtualenv/releases)
- [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst)
- [Commits](pypa/virtualenv@20.26.5...20.27.1)

---
updated-dependencies:
- dependency-name: virtualenv
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# This is the commit message #6:

build(deps): bump argcomplete from 3.5.0 to 3.5.1 (complytime#371)

Bumps [argcomplete](https://github.com/kislyuk/argcomplete) from 3.5.0 to 3.5.1.
- [Release notes](https://github.com/kislyuk/argcomplete/releases)
- [Changelog](https://github.com/kislyuk/argcomplete/blob/develop/Changes.rst)
- [Commits](kislyuk/argcomplete@v3.5.0...v3.5.1)

---
updated-dependencies:
- dependency-name: argcomplete
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# This is the commit message #7:

build(deps): bump httpcore from 1.0.5 to 1.0.6 (complytime#373)

Bumps [httpcore](https://github.com/encode/httpcore) from 1.0.5 to 1.0.6.
- [Release notes](https://github.com/encode/httpcore/releases)
- [Changelog](https://github.com/encode/httpcore/blob/master/CHANGELOG.md)
- [Commits](encode/httpcore@1.0.5...1.0.6)

---
updated-dependencies:
- dependency-name: httpcore
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# This is the commit message complytime#8:

docs: add authoring tutorial (complytime#375)

* docs: add authoring tutorial

* docs: fix typos and add statement around pull request best practices
# This is the commit message complytime#9:

chore: add openssf scorecard workflow (complytime#359)

Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
# This is the commit message complytime#10:

build(deps): bump compliance-trestle from 3.4.0 to 3.5.0 (complytime#380)

Bumps [compliance-trestle](https://github.com/oscal-compass/compliance-trestle) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/oscal-compass/compliance-trestle/releases)
- [Changelog](https://github.com/oscal-compass/compliance-trestle/blob/develop/CHANGELOG.md)
- [Commits](oscal-compass/compliance-trestle@v3.4.0...v3.5.0)

---
updated-dependencies:
- dependency-name: compliance-trestle
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# This is the commit message complytime#11:

docs: adr-001 cli implementation (complytime#347)

* docs: adding draft of CLI decision record

* docs: adding details around config file

* docs: refactor wording for clarity

* docs: update config example

* expand content for default behaviors around oscal-model
# This is the commit message complytime#12:

feat: 295 monorepo directory structure design proposal (complytime#389)

* initial directory structure organization

* feat: initial work on config and common options

* chore: add openssf scorecard workflow (complytime#359)

Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>

* build(deps): bump compliance-trestle from 3.4.0 to 3.5.0 (complytime#380)

Bumps [compliance-trestle](https://github.com/oscal-compass/compliance-trestle) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/oscal-compass/compliance-trestle/releases)
- [Changelog](https://github.com/oscal-compass/compliance-trestle/blob/develop/CHANGELOG.md)
- [Commits](oscal-compass/compliance-trestle@v3.4.0...v3.5.0)

---
updated-dependencies:
- dependency-name: compliance-trestle
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: adds logic to load yaml config into click context to set defautl values.  improves config error handling.

* feat: adds debug logging statements

* feat: add markdown directory creation and call to compliance trestle init

* feat: simplify directory creation and better error handling for invalid configs

* feat: initial work on autosync

* Initial create command for click cli

* Initial create command for click cli

* adding unit test for config module

* adding unit test for config module

* Update autosync command

* Update autosync command

* feat: add ssp index option

* feat: add ssp index option

* add unit tests for init command

* add unit tests for init command

* feat: root call create and logging replacement

* feat: root call create and logging replacement

* feat: add upstream commands, fix common options decorators, expand config

* feat: add upstream commands, fix common options decorators, expand config

* Update autosync options and add tests

* Update autosync options and add tests

* docs: adr-001 cli implementation (complytime#347)

* docs: adding draft of CLI decision record

* docs: adding details around config file

* docs: refactor wording for clarity

* docs: update config example

* expand content for default behaviors around oscal-model

* feat: add logic to make_config for nested upstream model and update related tests

* feat: add logic to make_config for nested upstream model and update related tests

* feat: create command logic for compdef and ssp

* feat: create command logic for compdef and ssp

* feat: create command updates to prompts and logger messages

* feat: create command updates to prompts and logger messages

* feat: add default git info to init prompts and config

* feat: add default git info to init prompts and config

* fix hidden keep file creation

* fix hidden keep file creation

* Add rule-transform command and unit test

* Add rule-transform command and unit test

* feat: create command logic and adding unit tests

* feat: create command logic and adding unit tests

* Fix AttributeError, some misc updates

AttributeError: 'NoneType' object has no attribute 'encode'

* Fix AttributeError, some misc updates

AttributeError: 'NoneType' object has no attribute 'encode'

* feat: unit tests added for create command

* feat: unit tests added for create command

* refactor sync upstreams and autosync to match existing entrypoint syntax

* refactor sync upstreams and autosync to match existing entrypoint syntax

* Fix AttributeError, some misc updates

AttributeError: 'NoneType' object has no attribute 'encode'

* Fix AttributeError, some misc updates

AttributeError: 'NoneType' object has no attribute 'encode'

* feat: unit tests added for create command

* feat: unit tests added for create command

* fix: docstrings added for create command unit tests

* fix: docstrings added for create command unit tests

* add file pattern filter

* add file pattern filter

* fix: updated headers with license and copyright

* fix: updated headers with license and copyright

* fix: updated logger statements

* fix: updated logger statements

* fix: logger statements shortened

* fix: logger statements shortened

* fix: yaml default deletion

* fix: yaml default deletion

* docs: updates to reference the CLI commands in the README.md

* docs: updates to reference the CLI commands in the README.md

* feat: update for required ssp name

* feat: update for required ssp name

* Update trestlebot/cli/commands/init.py

Co-authored-by: Jennifer Power <barnabei.jennifer@gmail.com>

* Update trestlebot/cli/commands/init.py

Co-authored-by: Jennifer Power <barnabei.jennifer@gmail.com>

* Update trestlebot/cli/commands/init.py

Co-authored-by: Jennifer Power <barnabei.jennifer@gmail.com>

* Update trestlebot/cli/commands/init.py

Co-authored-by: Jennifer Power <barnabei.jennifer@gmail.com>

* fix typo in error msg

* fix typo in error msg

* fix help text for sync upstreams

* fix help text for sync upstreams

* fix: update for help text and testing location errors

* fix: update for help text and testing location errors

* fix: update for clarity on profile name for trestle workspace

* fix: update for clarity on profile name for trestle workspace

* Fix AssertionError, add missing register

* Fix AssertionError, add missing register

* fix: profile name prompting update

* fix: profile name prompting update

* feat: updating compdef list to required

* feat: updating compdef list to required

* docs: change of verbiage for readability

* docs: change of verbiage for readability

* docs: change to indicate trestle-bot as a cli tool

* docs: change to indicate trestle-bot as a cli tool

* feat: change to help description of create command

* feat: change to help description of create command

* docs: added high level folder structure for cli

* docs: added high level folder structure for cli

* fix: default value returned if no key in dictionary

* fix: default value returned if no key in dictionary

* feat: align skip-item option to skip-items

* feat: align skip-item option to skip-items

* fix: add missing git options in create command

* fix: add missing git options in create command

* fix: refactor testt and remove prompts

* fix: refactor testt and remove prompts

* fix: formatting issues and typos

* fix: formatting issues and typos

* chore: update poetry lock with latest dependencies

Signed-off-by: George Vauter <gvauter@redhat.com>

* chore: update poetry lock with latest dependencies

Signed-off-by: George Vauter <gvauter@redhat.com>

* fix: do not overwrite config path if set

Signed-off-by: George Vauter <gvauter@redhat.com>

* fix: do not overwrite config path if set

Signed-off-by: George Vauter <gvauter@redhat.com>

* fix: do not overwrite config path if set

Signed-off-by: George Vauter <gvauter@redhat.com>

* fix: do not overwrite config path if set

Signed-off-by: George Vauter <gvauter@redhat.com>

---------

Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: George Vauter <gvauter@redhat.com>
Co-authored-by: Hannah Braswell <hbraswel@redhat.com>
Co-authored-by: Jennifer Power <barnabei.jennifer@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Qingmin Duanmu <qduanmu@redhat.com>
# This is the commit message complytime#13:

feat: initialize command for cac to oscal transformation

# This is the commit message complytime#14:

chore: update pyproject.toml entrypoints to cli root command

# This is the commit message complytime#15:

chore: update actions with new cli design

# This is the commit message complytime#16:

docs: update CONTRIBUTING.md

chore: update actions for debug and config options

chore: rename rule-transform to rules-transform

fix: update e2e test to use new commands

fix: update create command for e2e testing

Changes made to  use compdef_name reference instead of profile_name for model filter

fix: a typo in autosync command

fix: sys.exit with errorcode when exceptions

fix: fix a typo in cli root

feat: populate cac content product name as component title

Signed-off-by: Sophia Wang <huiwang@redhat.com>

Add unitest for populate cac product nameto component title

Signed-off-by: Sophia Wang <huiwang@redhat.com>

Move the ssg connections from utils to cac transformer

Signed-off-by: Sophia Wang <huiwang@redhat.com>

Add function to only update not recreate component definition if it exists

Signed-off-by: Sophia Wang <huiwang@redhat.com>

Update the component description as the product full name

Signed-off-by: Sophia Wang <huiwang@redhat.com>

add the sync cac content task to push local change to remote

Signed-off-by: Sophia Wang <huiwang@redhat.com>

chore: allow lower case in PR subject (complytime#406)

Signed-off-by: George Vauter <gvauter@redhat.com>

feat: add cac content rules transformation

feat: CPLYTM-421 create validation component from rules

Signed-off-by: Sophia Wang <huiwang@redhat.com>

chore: add notice regarding repo org move (complytime#413)

Signed-off-by: George Vauter <gvauter@redhat.com>

chore: update SyncCacContentTask

feat: add unit test for validation component

Signed-off-by: Sophia Wang <huiwang@redhat.com>

:arrow_up: bump actions/download-artifact from 4.1.7 to 4.1.8

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4.1.7 to 4.1.8.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@65a9edc...fa0a91b)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

build(deps): bump actions/upload-artifact from 4.3.4 to 4.6.0

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.4 to 4.6.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@0b2256b...65c4c4a)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

feat: sync cac content profile task and subcommand

Add create_or_update to AuthoredProfile

Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>

test: adds tests and updates to sync_cac_profile_task

Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>

feat: sync cac content profile task and subcommand

fix: updating the cac_content_root type to pass a string

fix: fixes linting errors for sync_cac_content_profile task

Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>

feat: sync cac content profile task and subcommand

feat: sync cac content profile task and subcommand

feat: testing repo passed before content dir

feat: testing repo passed before content dir

fix: unit tests in pycharm

PyCharm sets the CWD of unit tests to the tests directory by default,
but the unit tests assume a CWD of the repo root. This updates the unit
tests not to rely on the assumption of CWD

Signed-off-by: d10n <d10n@redhat.com>

feat: testing with catalog path extension

feat: testing for metadata checks

feat: testing for oscal profile imports

fix: testing oscal profile populated in correct path

fix: testing oscal profile populated in correct path

fix: testing oscal profile populated in correct path

fix: testing oscal profile populated in correct path

fix: testing oscal profile populated in correct path

fix: testing oscal profile populated in correct path

fix: pinpointing existing error 2

fix: pinpointing error by not including a default for filter_by_level

fix: pinpointing error by not including a default for filter_by_level

fix: pinpointing error by not including a default for filter_by_level

fix: pinpointing error by not including a default for filter_by_level

fix: pinpointing error by not including a default for filter_by_level

fix: pinpointing error by not including a default for filter_by_level

fix: pinpointing error by not including a default for filter_by_level

fix: pinpointing error by not including a default for filter_by_level

fix: adding command to root

fix: adding modelutils handler for getting the correct catalog path

fix: adding modelutils handler for getting the correct catalog path

fix: taking catalog kwargs as part of path for profile data

fix: taking catalog kwargs as part of path for profile data

fix: taking catalog kwargs as part of path for profile data

fix: taking catalog kwargs as part of path for profile data

feat: updates for unit testing for sync_cac_content_profile command

feat: add parameter transformation

feat: update poetry.lock and add jinja macros

fix: improve the validation components with parameters

Signed-off-by: Sophia Wang <huiwang@redhat.com>

fix: fix test failure in validation component

feat: update rule description value with rule title

chore: create a minimalist macro file for unit tests

This file contains only the necessary macros used by rules in the
content_dir directory.

Signed-off-by: Marcus Burghardt <maburgha@redhat.com>

chore: remove macros not relevant for current tests

This keeps the test content simpler and smaller.

Signed-off-by: Marcus Burghardt <maburgha@redhat.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.

1 participant