Граф коммитов

444 Коммитов

Автор SHA1 Сообщение Дата
Gabe Stocco f65bd19c5c
Remove beta flag in version.json (#505)
* Remove beta flag in version.json

* Add the new ruleverifier options to the pack command.

* Typos

* Run formatting - no logic changes.

* Update Dependencies

* Refactor tests a bit

* Fix template issue after reformatting. Add missing integrity flags.
2022-08-30 15:09:42 -07:00
Gabe Stocco 7d93aa8d85
Complete work on Test Case Reporting (#504) 2022-08-29 19:41:26 -07:00
Gabe Stocco 964b2bcd46
Use a bool in the rulestatus object to indicate if each rule contains self-tests (#503) 2022-08-29 15:33:10 -07:00
Gabe Stocco c16ca2a195
Remove dependency on immutable collections (#501) 2022-08-25 19:35:17 -07:00
Gabe Stocco bf9bb5fe6d
Fixes an off by one error in getting location in withinclause (#500)
Hit in particular when the match extends to the end of the file.
2022-08-11 16:53:38 -07:00
Gabe Stocco d7bf96f101
Workaround for namespace based parsing. (#499) 2022-08-10 23:34:54 -07:00
Gabe Stocco 1a083e10a0
Fix Returning Correct Number of Results From Conditions (#498) 2022-08-10 19:45:24 -07:00
Gabe Stocco 5e419fe725
Fixes a CodeQL Finding on a null reference error (#496) 2022-08-10 14:03:36 -07:00
Gabe Stocco dce5493d93
Refactor Conditions (#495)
* wip checkin

Partial refactor. Requires updated OAT just merged.

* wip checkin

Partial refactor. Requires updated OAT just merged.

* Fix issues with refactored within

* WIP

* Fix inversion in conditions

* Fix regex json rule offset

* Fix off by one

* Validate subclause of within clause.
2022-08-10 12:42:41 -07:00
Gabe Stocco 175de2aaef
Fix #493 (#494) 2022-08-08 13:58:12 -07:00
Gabe Stocco 284d34573c
Allows Multiple Paths per Pattern (#491) 2022-08-04 17:38:30 -07:00
Gabe Stocco 41d733abba
Adds Structured Path Based Rules (#489)
* Adds Experimental XML path parsing

* Add JSON support for the Structured queries

* Fixes

* Add logging to textcontainer

* Implement XPath and JsonPath for string matching rules.

* Removed unused.

* Fix potential double return.

* Remove unused imports

* Remove redundant and non-cached regex builder

* Null checking

* Nit: Typos in test data

Also move the String clause tests to the correct file.

* Allow specification of both a JsonPath and an XML Path

A user potentially would want to detect a similar pattern at a location inside both an XML and a JSON file, so they can provide separate path specifications for each rather than having two nearly identical rules.

* Adds test case for a rule that targets both Json and XML

* Adds validation for JsonPath and XPath arguments
2022-08-04 16:25:37 -07:00
Gabe Stocco 76476ba064
Adds a "SuccessCodeOnNoMatches" Option (#487) 2022-08-02 19:31:28 -07:00
Gabe Stocco 7dfcecdd40
Catch and log deserialization errors in StringToRules (#486) 2022-08-01 21:26:12 -07:00
Gabe Stocco 949273cf04
Add Option to Skip Unique ID Checking (#485) 2022-08-01 19:24:41 -07:00
Gabe Stocco eb47b55bd8
Fix #480 (#481)
* Fix #480

Fixes case sensitivity of Enum based arguments
Fixes default Confidence argument not being respected
Fixes severity not being respected
Fixes custom rules not being validated if provided as a directory
Adds new option to skip validation of custom rules
Adds a TextContainer based API for analyze.

* Simplify post validation action
2022-07-28 13:22:46 -07:00
Gabe Stocco 6c40a50fb6
Move RulesVerifier to the RulesEngine namespace (#479) 2022-07-27 11:52:25 -07:00
Gabe Stocco 3790d0a4cb
Adds some better comments in the refactored rulesets. (#478)
* Adds some better comments in the refactored rulesets.

* Rename RulesEngine folder to AppInspector.RulesEngine to match repo

* Fix CodeQL
2022-07-26 20:54:15 -07:00
Gabe Stocco 320e1fd276
Refactor RuleSet (#477)
Refactors the RuleSet class to create AbstractRuleSet and TypedRuleSet. Normal usage is not impacted - the RuleSet class can be used as it was previously. Internally, this provides capability to create TypedRuleSets of Rules that have more properties than the ApplicationInspector rules. These properties don't affect rule logic in the processor.
2022-07-26 15:58:25 -07:00
Gabe Stocco c685856e96
Publish the RulesEngine as a Nuget Package (#476) 2022-07-15 14:42:40 -07:00
Gabe Stocco 62e0917eac
Update OAT (#474) 2022-07-14 16:12:13 -07:00
Gabe Stocco e0bf40565f
Add the ability for Rules to have built in test cases (#472)
* Adds Support for MustMatch and MustNotMatch fields in rules

Allows for providing a set of values which must match the rule or must not match the rule. If these are present the rules verifier will check them and return errors are usual during validation.

Fixes an issue with some tests.

* Style Changes

* Improve language selection logic

Handles a potential edge case with only DoesNotApplyTo set and "csharp" being an excluded language.

* Remove reference to no-op CLI tests.
2022-07-14 15:24:58 -07:00
Gabe Stocco 8da88b290c
Add Support for Some DevSkim rule parameters (#471)
* Adds the "does_not_apply_to" parameter for languages
* Adds other types of conditions supported by devskim

OnlyBefore - Condition matches if it occurs anywhere in the same file before the initial match
OnlyAfter - Condition matches if it occurs anywhere in the same file after the initial match
SameFile - Condition matches if it occurs anywhere in the same file, including the original match
2022-07-13 13:45:08 -07:00
Gabe Stocco b6084dd19d
Explicitly include version of newtonsoft with fix in tests. (#470)
* Explicitly include version of newtonsoft with fix in tests.

* Fix pipeline to run on CLI test changes.
2022-07-13 13:11:30 -07:00
Michael Scovetta 9f33c68fd1
Switch match references to camelCase. (#467) 2022-06-22 12:49:49 -07:00
Gabe Stocco 08a67bb7d5
Fix #461 (#463)
Attempt to create the HTML report regardless of analysis status.

Adds a new string to clarify when the failure is due to having no source files.
2022-06-22 01:50:27 -07:00
Michael Scovetta 41442653b5
Update bug report template. (#462) 2022-06-22 00:52:41 -07:00
Gabe Stocco 0f96c5869d
Bump dependencies. (#460) 2022-06-15 17:23:23 -07:00
Gabe Stocco 01e420881b
Gfs/fix pipeline (#459)
* Fixes Pipeline

* Improve test run time

* A change in the App Code to trigger the release pipeline.

Other changes in this PR are to the Pipeline and Tests so will not automatically trigger a build snap. This change should, but doesn't change functionality.
2022-06-15 16:57:55 -07:00
Gabe Stocco 4ed7b849c4
Attempt Fix Timeout Reliabilty (#458) 2022-06-15 12:39:57 -07:00
Gabe Stocco f0e1d10f92
1.5 Initial Release (#456)
* Update version.json

* Adds Timeout Tests

* Adds Red status for Timeout or failure on progress bar.

* Updates dependencies.

* Fix the processing timeout when progressbar enabled.

* Add backup output of the json object when HTML report is too large.
2022-06-13 13:58:12 -07:00
Gabe Stocco cf65ad352e
Change the enumeration timeout to be an overall timeout. (#453) 2022-06-06 17:20:07 -07:00
Gabe Stocco 0f2decd679
Add option to skip scanning archives (#452)
* Add option for limiting enumeration time per archive and skipping archives

* Better handling for crashes in the HTML writer.

* Fix logging.

* Add test for skipping archives.
2022-05-31 18:36:04 -07:00
Gabe Stocco b670b5e060
Pull in rules using subtree (#448) 2022-04-29 18:14:28 -07:00
Gabe Stocco 052b0e85ed
Make a trivial change to cause the publish trigger to trip. (#446)
* Make a trivial change to cause the publish trigger to trip.

* Fix pipeline trigger paths
2022-04-29 16:23:01 -07:00
Gabe Stocco 8cb19ef134
Fix dotnet-test-job.yml (#445) 2022-04-29 13:29:37 -07:00
Gabe Stocco deef493692
Rewrite logging, tests, add user customizable languages. (#441)
* Fix most of logging in Analyze Command

* ConvertTagDiff command

* Finish conversion of Analyze

* Rewrite logging

* Bump version. These changes change API surfaces and CLI arguments.

* More fixes.

* More test improvements

* More test fixes.

* Fix analyze tests

* Incrementally adding tests for untested parameters.

* Fix tests for everything except timeouts in analyze command.

* Add logger factory to the tests. Start on verify rules cmd.

* Refactor VerifyRules + Fix Tests to cover all cases checked for AI rules.

* Remove RulePacker, just embed all rules directly

* Existing nuget tests fixed.

* More fixes. start implementing custom languages and comments.

* Fix #418

* Remove unused examples

Remove old CLI tests

* Generate and publish code coverage in pipeline

* Clean up unused resources.

* Update dotnet-test-job.yml

* Update dotnet-test-job.yml

* Add SeverityLevel option.

* Add applies to filename test

* Add override test

* Update TestAnalyzeCmd.cs

* Tests and refactoring/renaming.

* More tests for malformed within clauses.

* Rename Test folder

Fix pipeline
More withinclause tests

* Improvements

* Fix option parsing

* More test coverage for Languages.cs.

* Refactor. Removing Newtonsoft dependency.

* Re-add support for netcore3.1 to lib

* Support netstandard2.1 instead.

* Refactor and Cleanup

Allows tests to run on netstandard by moving the logoptions to a separate project.

* Fixes for #442 and #443 (#444)

* Update bug report

Co-authored-by: Michael Scovetta <michael.scovetta@microsoft.com>
2022-04-29 11:50:23 -07:00
Gabe Stocco a697529398
Better output when the overall timeout is hit. (#437)
* Better output when the overall timeout is hit.

* Fix no matches case.
2022-03-14 12:29:34 -07:00
Gabe Stocco 93b262700e
Gfs/fix build (#433) 2022-02-16 00:54:56 -08:00
Gabe Stocco adf4021d02
Update core-pipeline.yml (#432) 2022-02-15 20:54:00 -08:00
Gabe Stocco c150a8faa1
Fix #430 (#431) 2022-02-15 18:48:34 -08:00
Gabe Stocco 210990cc74
Add SBOM Gathering Task (#428)
* Add SBOM Gathering Task

* Separate SBOM for LInux/Mac and windows/netcore
2022-02-01 16:38:49 -08:00
Gabe Stocco 4c95dbd1e2
Fix off by one error. (#426)
* Fix off by one error in the secondary match of a `finding-region` rule.
2022-01-20 21:36:12 -08:00
Gabe Stocco c055aa393b
Clean up the initial matches if some don't pass later conditions. (#423)
* Clean up the initial matches if some don't pass later conditions.

Fix #422

* Bump dependencies

* Update tests to confirm new behavior

* Cleans up a bunch of tests that were passing around exit codes instead of using asserts directly on them.

* Change NBGV pipeline to use update command
2022-01-20 17:37:27 -08:00
Gabe Stocco ccdc2c44b5
Fix Scope Match code (#421)
* Within Operations

They were missing instantiating the code scopes.
2022-01-19 15:50:21 -08:00
Gabe Stocco 80004398e2
Linting recommendations. (#416) 2022-01-10 13:38:17 -08:00
liyuhang 84d2ddffe1
Fixed wiki link in README.md (#415)
* Fixed wiki link in README.md

* Update README.md

Fix reference to .net 6.0 while we are editing readme.

* Update JustRunIt.md

Co-authored-by: Gabe Stocco <98900+gfs@users.noreply.github.com>
2022-01-10 12:50:19 -08:00
Gabe Stocco 811190051e
Allow finding empty files if the regex properly matches. (#413) 2022-01-07 21:33:39 -08:00
Gabe Stocco 1f50c85493
Bump to .NET 6 (#412)
* Update to .NET 6
2022-01-07 11:10:33 -08:00
Gabe Stocco 669dcbdc4d
Still prepare report even if only no non-metric tags have been found (#411) 2022-01-05 23:40:47 -08:00