Skip to content

rename to tirith #76

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

Merged
merged 4 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 7 additions & 36 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,19 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased] - Unreleased
### Fixed

- Terraform binary not required for using OPA provider

## [1.0.0-alpha.1] - 2022-10-04


## [v1.0-beta.2] - 2021-01-12
### Added

- CHANGELOG, CODE_OF_CONDUCT, CONTRIBUTING
- Initial realease of Tirith (StackGuardian Policy Framework)
- Adopted Covenant Code of Conduct
- cli wrapper for calling sg_policy
- Summarized evaluation output and provides brief output formatting

### Fixed
- cli wrapper for calling tirith

- License content


## [v1.0-beta.1] - 2021-07-10

- Initial release of SG Policy Framework.
- New schema for policy declaration in JSON - V1.BETA
- Tested for scanning terraform plans >= 0.14.6
- Added Support for for evaluations using Rego:
> - str_equals_str
> - str_contains_str
> - str_contains_str
> - equals_null
> - str_matches_regex
> - bool_equals_bool
> - cidr_contains_cidr_or_ip


-------------
## Types of changes

**Added**: for new features.

**Changed**: for changes in existing functionality.
Expand All @@ -53,7 +26,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

**Security**: in case of vulnerabilities.


[Unreleased]: https://github.com/StackGuardian/policy-framework/compare/v1.0-beta.2...HEAD
[v1.0-beta.1]: https://github.com/StackGuardian/policy-framework/compare/v1.0-beta.1
[v1.0-beta.2]: https://github.com/StackGuardian/policy-framework/compare/v1.0-beta.2
[unreleased]: https://github.com/StackGuardian/tirith/compare/1.0.0-alpha.1...HEAD
[1.0.0-alpha.1]: https://github.com/StackGuardian/tirith/compare/1.0.0-alpha.1
23 changes: 11 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
# Contributing to StackGuardian Policy Framework
# Contributing to Tirith (StackGuardian Policy Framework)

Thank you for taking the time to contribute! 🎉
Contributions are welcome, and they are greatly appreciated! Every
little bit helps, and credit will always be given.

The following is a set of guidelines for contributing to StackGuardian Policy Framework on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
The following is a set of guidelines for contributing to Tirith on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.

## Contribution types

### Report Bugs

We use GitHub issues to track bugs at [https://github.com/stackguardian/policy-framework/issues](https://github.com/stackguardian/policy-framework/issues). Please use Bug report issue template.
We use GitHub issues to track bugs at [https://github.com/stackguardian/tirith/issues](https://github.com/stackguardian/tirith/issues). Please use Bug report issue template.

### Fix Bugs and implement features

All contributions to solve GitHub issues tagged with "bug", "enhancement" and "help wanted" are most welcome and greatly appreciated.

### Documentation

StackGuardian Policy Framework could always use more documentation, whether as part of the
official StackGuardian Policy Framework docs, in docstrings, or even on the web in blog posts,
Trith could always use more documentation, whether as part of the
official Tirith docs, in docstrings, or even on the web in blog posts,
articles, and such.

### Submit Feedback

Please use GitHub Discussions to submit feedback and engage with community [https://github.com/StackGuardian/feedback/discussions/8](https://github.com/StackGuardian/feedback/discussions/8).


## Basic guidelines

For all changes you commit or submit by pull-request please follow these simple guidelines:

### Advice on pull requests:

* Raise Pull Request as soon as you start working on a feature, bug, test or hotfix and label it with `work-in-progress`, while it is not ready to be merged.
* Commits or squashed commits in your pull-requests should have a useful description.
* Always update CHANGELOG.md before merging Pull Requests.
- Raise Pull Request as soon as you start working on a feature, bug, test or hotfix and label it with `work-in-progress`, while it is not ready to be merged.
- Commits or squashed commits in your pull-requests should have a useful description.
- Always update CHANGELOG.md before merging Pull Requests.

### If you have commit access:

* Do NOT use git push --force.
* Do NOT commit to other contributor's branches without their consent.
* Use Pull Requests if you are unsure and to suggest changes to other maintainers.
- Do NOT use git push --force.
- Do NOT commit to other contributor's branches without their consent.
- Use Pull Requests if you are unsure and to suggest changes to other maintainers.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@

END OF TERMS AND CONDITIONS

Copyright 2021 StackGuardian
Copyright 2022 StackGuardian

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
12 changes: 6 additions & 6 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 35 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=StackGuardian_policy-framework&metric=alert_status&token=4a4d06e73940505edb7fc9d27a7f03b35fbbf23d)](https://sonarcloud.io/summary/new_code?id=StackGuardian_policy-framework)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=StackGuardian_policy-framework&metric=sqale_rating&token=4a4d06e73940505edb7fc9d27a7f03b35fbbf23d)](https://sonarcloud.io/summary/new_code?id=StackGuardian_policy-framework)

# StackGuardian Policy Framework
# Tirith (StackGuardian Policy Framework)

## A call for contributors

We are calling for contributors to help build out new features, review pull requests, fix bugs, and maintain overall code quality. If you're interested, please email us at team[at]stackguardian.io or get started by reading the [contributing.md](./CONTRIBUTING.md).

StackGuardian Policy Framework scans declarative Infrastructure as Code (IaC) configurations like Terraform against policies defined using JSON.
Tirith scans declarative Infrastructure as Code (IaC) configurations like Terraform against policies defined using JSON.

## Content

- [Features](#features)
- [Feature Road-Map](#feature-road-map)
<!-- - [Feature Road-Map](#feature-road-map) -->
- [How to use it?](#how-to-use-it)
- [Local Development Environment](#local-development-environment)
<!-- - [Local Development Environment](#local-development-environment) -->
- [Want to contribute?](#want-to-contribute)
- [Getting an issue assigned](#getting-an-issue-assigned)
- [A bug report](#a-bug-report)
Expand All @@ -27,30 +27,38 @@ StackGuardian Policy Framework scans declarative Infrastructure as Code (IaC) co

## Features

- A simple interface to define compliance policies as declarative config, which can be enforced proactively on Infrastructure as Code to detect breaches.
- Pluggable architecture allows to integrate into policy engines like OPA for policy evaluation.
- Summarizes evaluation output and provides brief output formatting.
- Cli support with data and input as arguments.
- Very easy to use.
- Works on Mac, Linux and Windows.
- An easy to read and simple way to define policy as code against structured formats.
- Use providers to define policies for terraform plan, infracost or any abstract JSON.
- Easily evaluate inputs against policy using pre-defined evaluators like ContainedIn, Equals, RegexMatch etc.
- Write your own provider (plugin) by leveraging a highly extensible and pluggable architecture to support any input formats.

## Feature Road-map
<!-- ## Feature Road-map

This is only a list of approved features that will be included in the StackGuardian Policy Framework over the next few months.
This is only a list of approved features that will be included in Tirith over the next iterations.

- Support for CloudFormation config scanning
- Support for ARM config scanning
- Extended library of evaluator functions
- Extended support for Terraform Plan
- Support for Cloudformation and ARM
- Extended library of evaluator functions -->

## How to use it?
```
usage: tirith [-h] [-policy-path PATH] [-input-path SOURCE-TYPE] [--json] [--verbose] [--version]

## Local Development Environment
Tirith (StackGuardian Policy Framework)

- Any operating system is supported(Windows, Mac, or Linux).
- [Python 3.6 or higher](https://www.python.org/downloads/) is required.
- [pip](https://pip.pypa.io/en/stable/) is required.
optional arguments:
-h, --help show this help message and exit
-policy-path PATH Path containing Tirith policy as code
-input-path SOURCE-TYPE Input file path
--json Only print the result in JSON form (useful for passing output to other programs)
--verbose Show detailed logs of from the run
--version show program's version number and exit
```

<!-- ## Local Development Environment

And leave the rest to us!!!
- [Python 3.6 or higher](https://www.python.org/downloads/) is required.
- [pip](https://pip.pypa.io/en/stable/) is required. -->

<!-- ## Publish Package on test.pypi.org
* Use the following command to install the latest version of the setuptools package.
Expand All @@ -74,26 +82,28 @@ And leave the rest to us!!!

## Want to contribute?

If you're interested, please email us at team[at]stackguardian.io or get started by reading the [contributing.md](./CONTRIBUTING.md).

### Getting an issue assigned

Go to the <a href="https://github.com/StackGuardian/policy-framework">StackGuardian Policy Framework Repository</a> and in the <a href="https://github.com/stackguardian/policy-framework/issues">issues</a> tab describe any bug or feature you want to add. If found relevant, the maintainers will assign the issue to you and you may start working on it as mentioned in the next section.
Go to the <a href="https://github.com/StackGuardian/tirith">Tirith Repository</a> and in the <a href="https://github.com/stackguardian/tirith/issues">issues</a> tab describe any bug or feature you want to add. If found relevant, the maintainers will assign the issue to you and you may start working on it as mentioned in the next section.

<p>The kinds of issues a contributor can open:</p>
<ul>
<li>Report Bugs</li>
<li>Feature Enhancement</li>
<li>If any "help" is needed with the policy framework</li>
<li>If any "help" is needed with using Tirith</li>
</ul>

### A bug report

Head over to the <a href="https://github.com/StackGuardian/policy-framework">StackGuardian Policy Framework Repository</a> and in the <a href="https://github.com/stackguardian/policy-framework/issues">issues</a> tab describe the bug you encountered and we will be happy to take a look into it.
Head over to the <a href="https://github.com/StackGuardian/tirith">Tirith repository</a> and in the <a href="https://github.com/stackguardian/tirith/issues">issues</a> tab describe the bug you encountered and we will be happy to take a look into it.

### Opening a Pull Request and getting it merged?

1. Go to the <a href ="https://github.com/StackGuardian/policy-framework">repository</a> and fork it.
1. Go to the <a href ="https://github.com/StackGuardian/tirith">repository</a> and fork it.
2. Clone the repository in your local machine.
3. Open your terminal and `cd policy-framework`
3. Open your terminal and `cd tirith`
4. Create your own branch to work on the changes you intend to perform. For e.g. if you want some changes or bug fix to any function in the evaluators, name your branch with something relevant like, `git branch bug-fix-equals-evaluator`
5. After necessary changes, `git push --set-upstream origin bug-fix-equals-evaluator`, `git checkout main` and `git merge bug-fix-equals-evaluator` or use the GUI to create a "Pull Request" after pushing it in the respective branch.
6. A review request will be sent to the repository maintainers and your changes will be merged if found relevant.
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ def read(*names, **kwargs):


setup(
name="sg_policy",
name="tirith",
version="1.0.0-alpha.1",
license="Apache",
description="StackGuardian Policy Framework simplifies defining Policy as Code.",
description="Tirith simplifies defining Policy as Code.",
long_description_content_type="text/markdown",
long_description="%s\n%s"
% (
Expand All @@ -33,7 +33,7 @@ def read(*names, **kwargs):
),
author="StackGuardian",
author_email="team@stackguardian.io",
url="https://github.com/stackguardian/policy-framework",
url="https://github.com/stackguardian/tirith",
packages=find_packages("src"),
package_dir={"": "src"},
py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")],
Expand Down Expand Up @@ -64,8 +64,8 @@ def read(*names, **kwargs):
"Topic :: System",
],
project_urls={
"Changelog": "https://github.com/stackguardian/policy-framework/blob/main/CHANGELOG.md",
"Issue Tracker": "https://github.com/stackguardian/policy-framework/issues",
"Changelog": "https://github.com/stackguardian/tirith/blob/main/CHANGELOG.md",
"Issue Tracker": "https://github.com/stackguardian/tirith/issues",
},
keywords=["iac", "policy", "terraform", "policy as code"],
python_requires=">=3.8.*",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we also need to renew the install_requires to match Pipfile content, e.g. if people were to install this using pip install tirith (assumming we will use the name tirith in pypi) it will only install the deps listed in install_requires in this setup.py, not from the pipfile. Good way to test this is to create a new venv and do pip install . to see what it installs

A good tool to automate this is pypa/pipenv#1263 (comment)

Otherwise just writing it down manually is OK as well because our Pipfile currently only has 2 deps

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can also be done in a separate PR though

Expand All @@ -80,7 +80,7 @@ def read(*names, **kwargs):
],
entry_points={
"console_scripts": [
"sg_policy=sg_policy.__main__:main",
"tirith=tirith.__main__:main",
]
},
)
35 changes: 0 additions & 35 deletions src/sg_policy/utils.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/sg_policy/__init__.py → src/tirith/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
sg_policy: Execute policies defined using StackGuardian Policy Framework
tirith: Execute policies defined using Tirith (StackGuardian Policy Framework)
"""

__version__ = "1.0.0-alpha.1"
Expand Down
4 changes: 2 additions & 2 deletions src/sg_policy/__main__.py → src/tirith/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
"""
Entrypoint module when invoked like `python -m sg_policy`.
Entrypoint module when invoked like `python -m tirith`.
"""
import sys

Expand All @@ -11,7 +11,7 @@ def main():

exit_status = main()
except KeyboardInterrupt:
from sg_policy.status import ExitStatus
from tirith.status import ExitStatus

exit_status = ExitStatus.ERROR_CTRL_C

Expand Down
Loading