question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Integrating rule check into Travis CI

See original GitHub issue

_Issue originally created by user airween on date 2019-10-16 20:07:51. Link to original issue: https://github.com/SpiderLabs/owasp-modsecurity-crs/issues/1599._

Extending the continuous integration tests

We discussed about the more checks before, and now csanders-git asked again, I would like to start to design the implementation.

Description

The main goal is to extend the Travis CI with some more tests, which did not exist before, and helps to keep the well formed text structure of the whole rule set. Ideas have come before, now I try to collect and organize them, and please help me to make the finally plan.

To make the new checks, I’ld like to use msc_pyparser to build the AST, write the abstract structure, and re-generate the rule set. Between these two steps, I’ld like to run the test cases, so the main line:

  1. generate structures
  2. run checks
  3. write the parsed structure

Let’s see the function of each steps!

  1. For a correct work it’s necessary that the rule sets must be syntactically (and of course lexically) correct. Now the secrule_parser from fzipi is a good tool, but any case sensitive differences could break the check. I don’t know that could be changed or not, but I think we can leave it in the CI.

  2. In this step, I got these ideas from you:

  • case-sensitive check for configuration directives, variables, operators, and actions
  • order check for actions - see the related wiki and doc
  • occurrence of mandatory tags, actions:
    • ver
    • paranoia-level
  • collect referred but non-existent tags (ctl:ruleRemoveByTag=TAG but TAG not exists)
  • and many other ideas what you have
  1. Although this may not seems important, but the writer of parser class is very strict. I mean it uses predefined (hard-coded) indentations, leading and trailing spaces (eg. before the trailing \ at the end of lines, and so on…), so with help of the re-generated rule set, we can use a simple diff to detect the hidden (or missing) spaces, tabs and other annoying characters.

There is one more type of checks, which isn’t important and doesn’t have any additional worth. We can check many other things, eg. uniqueness of rule ID’s, mandatory and optional arguments at variables, operators and actions - but (and that’s why I wrote that this isn’t a plus worth) this kind of errors are discoverable, because the Apache inside the Travis loads the rules, and it catches these errors.

I hope that this will helps you to get started the ideas.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
CRS-migration-botcommented, May 13, 2020

User fzipi commented on date 2020-03-04 00:23:31:

We need this one open for a little bit longer.

0reactions
github-actions[bot]commented, Sep 12, 2020

This issue has been open 120 days with no activity. Remove the stale label or comment, or this will be closed in 14 days

Read more comments on GitHub >

github_iconTop Results From Across the Web

Customizing the Build - Travis CI Docs
Builds on Travis CI are configured mostly through the build configuration stored in the file .travis.yml in your repository. This allows your configuration...
Read more >
Continuous Integration part 2: Setting up Travis checks in Github
Setting up TravisCI status checks on a PR is easy. Here are a few steps to set up your Github repository PRs with...
Read more >
fugue/regula-travis-example - GitHub
You commit IaC to a branch. · You push the commits and create a PR, triggering a Travis CI build. · Travis CI...
Read more >
Travis CI Integration | Documentation - Review Board
Review Board can integrate with Travis CI to do test builds of code changes and report the results back as a status update...
Read more >
Android App From Scratch Part 6 — Continuous Integration ...
Android App From Scratch Part 6 — Continuous Integration with Travis-CI. In this tutorial series, I will try to create an RSS Reader...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found