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

Basic implementation of compliance scan command #1940

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Conversation

oxisto
Copy link
Member

@oxisto oxisto commented Jan 16, 2025

This is a basic implementation of the compliance scan command. It will output an example SARIF finding, but will do an actual CPG translation.

The syntax is the following: codyze compliance --project-dir [project-directory] --sources [your-sources]

This will do an actual CPG translation and print a "note" SARIF finding on the console

Copy link

codecov bot commented Jan 16, 2025

Base automatically changed from new-codyze to main January 16, 2025 19:36
@oxisto oxisto added the codyze label Jan 17, 2025
@oxisto oxisto added the publish-to-github-packages If added to a PR, builds from it will be published as a GitHub package label Jan 20, 2025

/** Loads the security goals from the project. */
fun loadSecurityGoals(): List<SecurityGoal> {
return loadSecurityGoals(projectOptions.directory.resolve("security-goals"))
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not the biggest fan of these hardcoded paths and would prefer passing an argument in the CLI

Copy link
Member Author

@oxisto oxisto Jan 21, 2025

Choose a reason for hiding this comment

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

My idea for the future would be to replace the security-goals.yaml with a project.yaml or something similar, which basically describes the whole project structure and has the "authority" to change these paths, I am not sure if they are really suitable for CLI args. My suggestion is to extract these hardcoded paths into a Project structure (which is already prepare) so we can make them dynamic in the future.

* This command assumes that the project contains a folder named `security-goals` that contains YAML
* files with the security goals.
*/
class ListSecurityGoals : ProjectCommand() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wouldn't inherit from ProjectCommand because I currently see no reason to specify a project dir or CPG translation options. We're also not calling analyze().

Should we use use a CliktCommand for now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codyze publish-to-github-packages If added to a PR, builds from it will be published as a GitHub package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants