Skip to content

Commit 39d6b33

Browse files
authored
Merge pull request #179 from advanced-security/project-update
Project Update
2 parents 5d028d0 + 923d8da commit 39d6b33

File tree

4 files changed

+145
-10
lines changed

4 files changed

+145
-10
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ updates:
1010
schedule:
1111
interval: "weekly"
1212
reviewers:
13-
- "geekmasher"
13+
- "advanced-security/oss-maintainers"
1414
target-branch: "main"
1515
commit-message:
1616
prefix: deps
@@ -28,7 +28,7 @@ updates:
2828
schedule:
2929
interval: "weekly"
3030
reviewers:
31-
- "geekmasher"
31+
- "advanced-security/oss-maintainers"
3232
target-branch: "main"
3333
commit-message:
3434
prefix: deps
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
applyTo: "**/*.py"
3+
---
4+
5+
This project is a Python CLI and GitHub Action policy-as-code engine and toolkit.
6+
It uses Python 3.10+ and Pipenv for dependency management, Black for code formatting, and unittest for testing.
7+
8+
## Coding Guidelines
9+
10+
- Follow [PEP 8](https://peps.python.org/pep-0008/) style guidelines.
11+
- Use type hints for all function signatures.
12+
- Write clear, concise docstrings for all public functions and classes.
13+
- Use `os.path.join()` for all path concatenations.
14+
- Prefer f-strings for string interpolation.
15+
- Ensure cross-platform compatibility (Linux, macOS, Windows).
16+
- Avoid hardcoding paths or platform-specific logic.
17+
- Keep functions small and focused; prefer composition over inheritance.
18+
19+
## Testing & Quality
20+
21+
- Write unit tests for all new features and bug fixes.
22+
- Ensure all tests pass before committing code.
23+
- Maintain good test coverage; aim for 90%+ where practical.
24+
- Use descriptive test names and keep tests isolated.
25+
26+
**Run tests with:**
27+
28+
```bash
29+
pipenv run test
30+
```
31+
32+
**Format code before committing:**
33+
34+
```bash
35+
pipenv run fmt
36+
```
37+
38+
## Documentation
39+
40+
- Document all public APIs and modules with docstrings.
41+
- Update Sphinx documentation in `docs/` for new features or changes.

CONTRIBUTING.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Contributing Guide
2+
3+
Thank you for your interest in contributing to Policy as Code!
4+
5+
## Getting Started
6+
7+
- Ensure you have Python 3.9+ and [Pipenv](https://pipenv.pypa.io/en/latest/) installed.
8+
9+
**Install dependencies:**
10+
11+
```bash
12+
pipenv install --dev
13+
```
14+
15+
**Run the CLI:**
16+
17+
```bash
18+
pipenv run main --help
19+
```
20+
21+
## Code Style
22+
23+
- Follow [PEP 8](https://peps.python.org/pep-0008/) guidelines.
24+
- Use type hints and docstrings for all functions.
25+
- Use `os.path.join()` for paths and f-strings for formatting.
26+
27+
**Format code with Black:**
28+
29+
```bash
30+
pipenv run fmt
31+
```
32+
33+
## Testing
34+
35+
- Write unit tests for all new features and bug fixes.
36+
- Ensure all tests pass before submitting a pull request:
37+
38+
```bash
39+
pipenv run test
40+
```
41+
42+
## Markdown Linting
43+
44+
- Markdown files should adhere to standard conventions.
45+
- Use a Markdown linter `markdownlint`
46+
47+
Use the following comments to run the linter:
48+
49+
```bash
50+
markdownlint '**.md' --disable MD013
51+
```
52+
53+
## Vendoring Dependencies
54+
55+
- Dependencies are vendored in the `vendor/` directory for reliability and security. See [vendor/README.md](./vendor/README.md).
56+
- To update or add dependencies:
57+
1. Add or update the dependency using Pipenv.
58+
59+
```bash
60+
pipenv run vendor
61+
```
62+
63+
## Submitting Changes
64+
65+
1. Fork the repository and create a feature branch.
66+
2. Make your changes, following the guidelines above.
67+
3. Run tests and ensure code is formatted.
68+
4. Submit a pull request with a clear description of your changes.
69+
70+
## Community & Support
71+
72+
- Please follow our [Code of Conduct](./CODE_OF_CONDUCT.md).
73+
- For help, see [SUPPORT.md](./SUPPORT.md) or open a GitHub Issue.

README.md

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313

1414
## Overview
1515

16-
[GitHub's Policy as Code][github] project is designed to allow users and organizations to configure their Risk
17-
threshold for security issues reported by GitHub Advanced Security Platform.
18-
The main goal is to help make sure that before publishing your application to productions, development, etc.
19-
you can validate if the application has any security issues that need to be addressed.
16+
[GitHub's Policy as Code][github] project is designed to allow users and organizations to configure their Risk threshold for security issues reported by GitHub Advanced Security Platform.
17+
The main goal is to help make sure that before publishing your application to productions, development, etc. you can validate if the application has any security issues that need to be addressed.
18+
19+
Policy as Code lets you define compliance and risk rules for your repositories using YAML configuration files.
20+
It supports code scanning, secret scanning, dependency checks, licensing, and more.
21+
You can run it as a GitHub Action or locally via CLI.
2022

2123
## ✨ Features
2224

@@ -29,9 +31,26 @@ you can validate if the application has any security issues that need to be addr
2931
- Supports GitHub Enterprise Cloud or Server ([see supported features list](#supported-features))
3032
- Pull Request Summary
3133

34+
## 💡 Key Features
35+
36+
- **Highly Configurable:** Write custom rules for your organization or repository.
37+
- **Multi-Platform:** Works with GitHub.com and GitHub Enterprise Server.
38+
- **Comprehensive Security:** Supports code scanning, secret scanning, dependency and license checks.
39+
- **Pull Request Summaries:** Adds compliance results to PRs.
40+
- **Vendored Dependencies:** All Python dependencies are included for reliability.
41+
- **Extensive Examples:** See [`examples/policies/`](./examples/policies/) and [`examples/workflows/`](./examples/workflows/).
42+
3243
## ⚡️ Requirements
3344

34-
- Python +3.9
45+
- Python >= 3.9
46+
47+
## 📦 Project Structure
48+
49+
- `ghascompliance/` — Main Python source code
50+
- `examples/` — Example policies, workflows, and scripts
51+
- `tests/` — Unit tests
52+
- `docs/` — Sphinx documentation
53+
- `vendor/` — Vendored Python dependencies
3554

3655
## Usage
3756

@@ -294,6 +313,11 @@ Some things to consider when using imports:
294313
- `Cloned Repository Directory`
295314
- Imports are only allowed from a number of predefined paths to prevent loading data on the system (AKA, path traversal).
296315

316+
## 🛠️ Development & Contributing
317+
318+
We welcome contributions from the community!
319+
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines on setting up your environment, code style, testing, and submitting changes.
320+
297321
## Maintainers / Contributors
298322

299323
- [@GeekMasher](https://github.com/GeekMasher) - Author / Core Maintainer
@@ -315,17 +339,14 @@ Please refer to [MIT][license] for the full terms.
315339
[github]: https://github.com/advanced-security/policy-as-code
316340
[github-issues]: https://github.com/advanced-security/policy-as-code/issues
317341
[github-actions]: https://github.com/advanced-security/policy-as-code/actions
318-
319342
[advanced-security]: https://github.com/features/security
320343
[github-codescanning]: https://docs.github.com/en/code-security/code-scanning/introduction-to-code-scanning/about-code-scanning
321344
[github-secretscanning]: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning
322345
[github-supplychain]: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-supply-chain-security
323-
324346
[python-setup]: https://github.com/actions/setup-python
325347
[vendored]: https://github.com/advanced-security/policy-as-code/tree/main/vendor/README.md
326348
[examples-actions]: https://github.com/advanced-security/policy-as-code/tree/main/examples/workflows
327349
[examples-cli]: https://github.com/advanced-security/policy-as-code/tree/main/examples/scripts
328-
329350
[permissions]: https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs#overview
330351
[permissions-codescanning]: https://docs.github.com/en/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-a-repository
331352
[permissions-secretscanning]: https://docs.github.com/en/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-a-repository

0 commit comments

Comments
 (0)