Skip to content

coreruleset/crslang

Repository files navigation

🛡️ CRSLang

Transform OWASP CRS rules into a modern, abstract representation 🚀

The code in this repository aims to generate a new representation for the OWASP CRS rules, making them more accessible and maintainable.

🤔 Why CRSLang?

The goal is to abstract OWASP CRS from the specifics of the Seclang language in which it is currently written. This abstraction provides:

  • 🔄 Better maintainability - Easier to understand and modify rules
  • 🎯 Language independence - Not tied to Seclang syntax
  • 🚀 Enhanced tooling - Better support for analysis and transformation
  • 📊 Improved readability - Cleaner representation of security rules

✨ Features

  • 🔧 Extended ANTLR Listener - Extends the listener generated by the ANTLR Seclang parser
  • 📝 Complete Rule Loading - Loads Seclang rule information stored in the CRS files, including comments
  • 🎨 New Representation - Defines a new representation for the rules and translates them into it
  • 🔄 Bidirectional Conversion - Convert between Seclang and CRSLang formats

🚀 Quick Start

📥 Installation

Initialize the repo:

git clone https://github.com/coreruleset/crslang.git
cd crslang

🔨 Build

Generate the ANTLR parser code and build the project:

go build

💻 Usage

🔄 Convert Seclang to CRSLang

Load and translate the Seclang OWASP CRS files to the new representation:

./crslang -o crs seclang_parser/testdata/crs

🔄 Convert CRSLang back to Seclang

Load and translate the CRSLang back to Seclang:

./crslang -s crs.yaml

🧪 Testing

Run the tests to ensure everything works correctly:

go test -v

📚 Documentation

For more detailed information about the project structure and API, check out the source code and test files.

🤝 Contributing

We welcome contributions! Please feel free to submit issues and pull requests.

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

About

The next generation CRS language

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages