-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add documentation for Code Security configuration file #35307
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
Open
jasonforal
wants to merge
1
commit into
master
Choose a base branch
from
jason.foral/K9VULN-11777
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+270
−293
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -99,17 +99,20 @@ function visit(query, filename, code) { | |||||
| ## Step 3: Use the rule | ||||||
|
|
||||||
| To use the rule, do one of the following: | ||||||
| - Create a `static-analysis.datadog.yaml` file at the root of your repository with the ruleset. | ||||||
| - Create a `code-security.datadog.yaml` file at the root of your repository with the ruleset. | ||||||
| - Add the rule in [your settings][3], either for the org-wide or repo-level configuration. | ||||||
|
|
||||||
| A valid configuration for using this ruleset (and no other ruleset) look like this: | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ```yaml | ||||||
| rulesets: | ||||||
| - tutorial | ||||||
| schema-version: v1.0 | ||||||
| sast: | ||||||
| use-default-rulesets: false | ||||||
| use-rulesets: | ||||||
| - tutorial | ||||||
| ``` | ||||||
| {{< img src="/security/code_security/custom_rule_tutorial_configuration.png" alt="Configuration with Custom Rule" style="width:100%;" >}} | ||||||
| {{< img src="/security/code_security/custom_rule_tutorial_configuration2.png" alt="Configuration with Custom Rule" style="width:100%;" >}} | ||||||
| [1]: https://app.datadoghq.com/ci/code-analysis/static-analysis/custom-rulesets | ||||||
| [2]: https://tree-sitter.github.io/tree-sitter/using-parsers/queries/index.html | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -69,12 +69,15 @@ You can set the following parameters for Static Code Analysis. | |||||
| By default, [Datadog Static Analyzer][8] detects the languages of your codebase and uses the default rulesets to analyze | ||||||
| your codebase. | ||||||
|
|
||||||
| To specify and customize the rulesets, add a `static-analysis.datadog.yml` file to your repository's root directory to define which rulesets to use. | ||||||
| To specify and customize the rulesets, add a `code-security.datadog.yaml` file to your repository's root directory to define which rulesets to use. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First phrase is redundant with "to define which rulesets to use"
Suggested change
|
||||||
|
|
||||||
| ```yaml | ||||||
| rulesets: | ||||||
| - <ruleset-name> | ||||||
| - <ruleset-name> | ||||||
| schema-version: v1.0 | ||||||
| sast: | ||||||
| use-default-rulesets: false | ||||||
| use-rulesets: | ||||||
| - <ruleset-name> | ||||||
| - <ruleset-name> | ||||||
| ``` | ||||||
|
|
||||||
| Refer to the [Datadog documentation][6] for a complete list of rulesets. | ||||||
|
|
@@ -84,10 +87,13 @@ Refer to the [Datadog documentation][6] for a complete list of rulesets. | |||||
| Here is an example for Python-based repositories: | ||||||
|
|
||||||
| ```yaml | ||||||
| rulesets: | ||||||
| - python-code-style | ||||||
| - python-best-practices | ||||||
| - python-inclusive | ||||||
| schema-version: v1.0 | ||||||
| sast: | ||||||
| use-default-rulesets: false | ||||||
| use-rulesets: | ||||||
| - python-code-style | ||||||
| - python-best-practices | ||||||
| - python-inclusive | ||||||
| ``` | ||||||
|
|
||||||
|
|
||||||
|
|
||||||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This link isn't working for me.
Also, this link is used on line 175:
When you start editing a source file, the extension checks for [static-analysis.datadog.yml][10] at your source repository's root. It prompts you to create it if necessary.I want to confirm that what we're linking to is still indeed a
static-analysis.datadog.yamlfile