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

feat(rules): add rules.Store and in-memory implementation #12

Merged
merged 13 commits into from
Dec 5, 2024

Conversation

jpower432
Copy link
Member

@jpower432 jpower432 commented Nov 22, 2024

Description

Creates a way to index and interact with rule set extension data gather from OSCAL Components. Starts with a basic in-memory implementation using maps for efficient searching.

Closes #8

Decisions

These might need feedback

Making the Store interface: It's very likely that other implementations will be needed to scale to larger datasets or to support for concurrent searches. Creating an interface that can be used will allow these implementation to be used easily.
Adding context to the Store Interface - Essentially future proofing the interface. Added so that the interface does not need to be broken or rewritten if implementation include the use of remote calls. This is a medium opinion though and I could probably go either way on including this.

How has this been tested?

Types of changes

  • New feature (non-breaking change which adds functionality)

Quality assurance (all should be covered).

  • 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 tests pass locally with my changes
  • All commits are signed-off.

The Store interface allows rule information to be pulled from
different types of sources while providing a default implementation
for immediate use.

Signed-off-by: Jennifer Power <[email protected]>
Setting this allows validation that go.mod is up to
date in CI

Signed-off-by: Jennifer Power <[email protected]>
Formats the license header to be compliant with Apache 2.0
short variant header

Signed-off-by: Jennifer Power <[email protected]>
The ruleset does not need to be set in the map until
it is populated

Signed-off-by: Jennifer Power <[email protected]>
@jpower432 jpower432 requested a review from yana1205 December 2, 2024 21:23
@jpower432 jpower432 marked this pull request as ready for review December 2, 2024 21:25
@jpower432
Copy link
Member Author

jpower432 commented Dec 2, 2024

@yana1205 Just wanted to add some context, the in-memory implementation should overlap with the functionality of the OSCAL parser in C2P Go, but this implementation does not have the control context.

Copy link

@yana1205 yana1205 left a comment

Choose a reason for hiding this comment

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

Added so that the interface does not need to be broken or rewritten if implementation include the use of remote calls.

If there is a possibility of storing OSCAL objects in external storage in the future, adding context.Context to the interface now is reasonable.
While it's technically possible to embed context.Context in a "struct" that implements the interface without passing through argument, it affects the entire struct's lifecycle, making it less flexible for handling multiple concurrent requests with different contexts.

@jpower432 jpower432 merged commit 9641ae0 into oscal-compass:main Dec 5, 2024
7 checks passed
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.

Feature: Get rule extension data from OSCAL Components
2 participants