Giter Site home page Giter Site logo

tenable / terrascan-rego-editor Goto Github PK

View Code? Open in Web Editor NEW
19.0 3.0 10.0 4.83 MB

Visual Studio Code extension for writing Terrascan Rego policies

Home Page: https://runterrascan.io

License: Apache License 2.0

TypeScript 100.00%
rego policy-as-code terrascan accurics policy vs-code-extenstion vs-code cloud-security cloud-security-policies

terrascan-rego-editor's Introduction

Terrascan Rego Editor

Create and test Rego policies for Terrascan in Visual Studio Code.

Features

  • Generates standardized JSON configuration used as input to Terrascan's policy engine.
  • Generates a pre-populated Rego template using parameters from resources in your IaC files as input.
  • Tests Rego policies against IaC files.
  • Ability to sync policies with Tenable.cs.

Terrascan Rego Editor demo

Getting Started

Follow these steps to get started:

  1. Install the extension from the VS code marketplace
  2. Open an IaC template on VS Code.
  3. Highlight an IaC resource, right-click, and select RegoEditor: Generate Config.
  4. Select the IaC engine this template uses (e.g. terraform, cft, k8s, etc.). This generates a normalized JSON file including the highlighted resource and its parameters.
  5. Right-click the normalized JSON file and select RegoEditor: Generate Rego. This creates a rule JSON and a Rego file.
  6. Update relevant fields on the Rule JSON file according to your policy.
  7. Update the Rego file to enforce your policy.
  8. Right-click the Rego file and click on RegoEditor: Scan to test your policy.

This extension supports multiple configuration options. To view the settings, open the command palette (Ctrl + Shift + P for Windows or CMD + Shift + P on Mac OS) and search for RegoEditor: Configuration.

From the configuration menu you should be able to customize:

  • The counter suffixed to policies
  • The default cloud provider
  • Whether to show the helper text on newly created Rego files
  • Credentials for syncing policies with Tenable.cs

Contributing

Contributions are always welcome in the form of documentation, blogs, issues, and pull requests. More details on CONTRIBUTING.md.

terrascan-rego-editor's People

Contributors

bkizer-tenable avatar cesar-rodriguez avatar dependabot[bot] avatar gaurav-gogia avatar kanchwala-yusuf avatar mikalkg avatar nasir-rabbani avatar nirajak avatar patilpankaj212 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

terrascan-rego-editor's Issues

Implement `Generate Config` command

Generate config would deduce the iac type of the file by reading/parsing the contents of the file and generate the standardised json.

The command should also have a keyboard shortcut and should be visible in the context menu for appropriate files.

After the command execution completes without any error, the standardised json file should be opened in a new window.

Implement `Generate Rego` command

The Generate Rego command will read the standardised json and generate rego and its metadata file.

The command should have a keyboard shortcut and should be displayed in the context menu for appropriate files.

After the command execution completes without any error, the metadata and rego files should be opened in a new window.

rego editor generateConfig cmd not working on windows

Steps to reproduce:

  1. Create terraform file for any resource
  2. Right click on terraform file in vscode
  3. Click on RegoEditor: Generate Config
  4. Follow the prompts to select iac type and cloud provider

Expected Output
Extension generates a config json file

Actual Output
Config file was not generated

No errors are generated in the logs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.