Skip to content

Commit

Permalink
Merge pull request #3 from advanced-security/docs
Browse files Browse the repository at this point in the history
Added supporting docs, minor README and typo changes
  • Loading branch information
theztefan committed Jan 26, 2024
2 parents 06bfdc7 + 9dac5cd commit 73222e1
Show file tree
Hide file tree
Showing 9 changed files with 191 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# CHANGELOG

## 1.0.0 - 2024-01-26

* Initial open source release
* Added supporting documentation
2 changes: 2 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This project is maintained by:
* @theztefan
74 changes: 74 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at opensource@github.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Contributing

## Security

For security issues, see [SECURITY](SECURITY.md).

## Bugs and issues

Please raise non-security bugs and suggestions in the Issues on the GitHub-hosted repository.

## Developing

Please test your changes before submitting a PR.

## Submitting changes

Please fork the repository, and raise a Pull Request (PR) for review.

Remember to update the [README](README.md) and [CHANGELOG](CHANGELOG.md).

Your changes must be acceptable under the [LICENSE](LICENSE.md) of the project.

## Code of conduct

Follow the [Code of Conduct](CODE_OF_CONDUCT.md).
3 changes: 3 additions & 0 deletions PRIVACY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Privacy Policy

Please see the [GitHub Privacy Statement](https://docs.github.com/en/site-policy/privacy-policies/github-privacy-statement) for GitHub's overall GitHub privacy policy.
48 changes: 35 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# GHAS Activation and Coverage Optimization

The purpose of this project is to optimize the utilization of GHAS (GitHub Advanced Security) licenses within your organization. GHAS operates on a licensing model based on active committers. Each active committer consumes one GHAS license, meaning GHAS can be enabled for any repository to which this committer contributes.
> [!NOTE]
> This repository is not officially supported by GitHub.
This project aims to optimize the use of GitHub Advanced Security (GHAS) licenses within your organization. [GHAS has a billing and licensing model](https://docs.github.com/en/enterprise-cloud@latest/billing/managing-billing-for-github-advanced-security/about-billing-for-github-advanced-security) based on unique active committers. Each unique active committer consumes one GHAS license, so GHAS can be enabled for any extra repositories that are contributed to only by the committers to the existing set of GHAS-enabled repositories.

**Example:**

- Developer A contributes to 3 repositories - `Repo1`, `Repo2`, `Repo5`.
- Developer A contributes to 3 repositories - `Repo1`, `Repo2`, `Repo5`.
- Developer B contributes to 2 repositories - `Repo2`, `Repo5`.
- GHAS is enabled on `Repo1` and `Repo2`.
- Both Developer A and B are active committers to `Repo5`.
- Enabling GHAS on `Repo5` does not require additional GHAS licenses.
- Enabling GHAS on `Repo5` does not require any additional GHAS licenses.

## Use Cases

Expand All @@ -28,11 +31,11 @@ This tool assists in three primary practical scenarios:
The Python script processes the following inputs:

- Active committers:
1. Parsing a CSV report on maximum active committers in your enterprise, or [preferably]
1. Parsing a CSV report on maximum active committers in your enterprise (preferred, but requires GitHub staff assistance) or
2. Finding active committers via the GraphQL API (experimental and slower).
- GitHub Enterprise slug.
- GitHub Organization slug.
- GitHub Personal Access Token.
- GitHub Personal Access Token (PAT)
- Number of available GHAS licenses.
- Output file name.
- Output file format (Text or JSON).
Expand All @@ -51,7 +54,7 @@ Finally, it outputs the results in the chosen file format.

### Active Committers

The script uses the `Max active committers` report or the GraphQL API to obtain the list of active committers for each repository. The maximum active committers report is preferred way as it runs the script faster and is more reliable. The GraphQL API is experimental and slower but can be used if the `Max active committers` report is not available.
The script uses the `Max active committers` report or the [GraphQL API](https://docs.github.com/en/enterprise-cloud@latest/graphql) to obtain the list of active committers for each repository. The maximum active committers report is preferred way as it runs the script faster and is more reliable. The GraphQL API is experimental and slower but can be used if the `Max active committers` report is not available.

```csv
User login,Organization / repository,Last pushed date
Expand All @@ -62,7 +65,7 @@ theztefan,thez-org/repo_name2,2023-08-06

### GHAS Status

The GHAS status for each repository in an organization is obtained by calling the GET /orgs/{org}/repos API endpoint.
The GHAS status for each repository in an organization is obtained by calling the [`GET /orgs/{org}/repos`](https://docs.github.com/en/enterprise-cloud@latest/rest/repos/repos?apiVersion=2022-11-28) API endpoint.

## Output Report

Expand Down Expand Up @@ -150,9 +153,7 @@ or `JSON` for machine-parseable output to plug in your GHAS enablement automatio
"name": "empty-one",
"org": "thez-org",
"ghas_status": false,
"pushed_at": "2023-10-25T12:

47:33Z",
"pushed_at": "2023-10-25T12:47:33Z",
"active_committers": [
"theztefan"
]
Expand Down Expand Up @@ -242,15 +243,18 @@ options:
--output OUTPUT Path to the output file (default: 'report.md')
--output-format OUTPUT_FORMAT
Output format - text or json (default: 'text')
--token TOKEN GitHub Personal Access Token (if not set in GITHUB_TOKEN envrionment variable)
--token TOKEN GitHub Personal Access Token (if not set in GITHUB_TOKEN environment variable)
--licenses LICENSES Number of (still) available GHAS licenses (default: 0)
```

You would need to provide:
You must provide:

- `--ac-report` with the path to the Max Active Committers report. If left empty, the script will gather the data from the GraphQL API.
- `--organization` and/or `--enterprise` parameters to specify the scope of the script.

Other parameters are optional, but note:

- `--ac-report` with the path to the Max Active Committers report. If left empty, the script will gather the data from the GraphQL API.

### Prerequisites

- Python 3.9 or later.
Expand Down Expand Up @@ -298,3 +302,21 @@ You would need to provide:
# Gather Active Commiters from API
python3 main.py --org thez-org --licenses 600 --output-format json --output report.json
```

## License

This project is licensed under the terms of the MIT open source license. Please refer to the [LICENSE](LICENSE) for the full terms.

## Maintainers

See [CODEOWNERS](CODEOWNERS) for the list of maintainers.

## Support

> ℹ️ This is an _unofficial_ tool created by GitHub staff, and is not officially supported by GitHub.
See the [SUPPORT](SUPPORT.md) file.

## Background

See the [CHANGELOG](CHANGELOG.md), [CONTRIBUTING](CONTRIBUTING.md), [SECURITY](SECURITY.md), [SUPPORT](SUPPORT.md), [CODE OF CONDUCT](CODE_OF_CONDUCT.md) and [PRIVACY](PRIVACY.md) files for more information.
31 changes: 31 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Security

Thanks for helping make GitHub safe for everyone.

GitHub takes the security of our software products and services seriously, including all of the open source code repositories managed through our GitHub organizations, such as [GitHub](https://github.com/GitHub).

Even though [open source repositories are outside of the scope of our bug bounty program](https://bounty.github.com/index.html#scope) and therefore not eligible for bounty rewards, we will ensure that your finding gets passed along to the appropriate maintainers for remediation.

## Reporting Security Issues

If you believe you have found a security vulnerability in any GitHub-owned repository, please report it to us through coordinated disclosure.

**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**

Instead, please send an email to opensource-security[@]github.com.

Please include as much of the information listed below as you can to help us better understand and resolve the issue:

* The type of issue (e.g., buffer overflow, SQL injection, or cross-site scripting)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue

This information will help us triage your report more quickly.

## Policy

See [GitHub's Safe Harbor Policy](https://docs.github.com/en/github/site-policy/github-bug-bounty-program-legal-safe-harbor#1-safe-harbor-terms)
14 changes: 14 additions & 0 deletions SUPPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Support

## How to file issues and get help

This project uses GitHub issues to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates. For new issues, file your bug or feature request as a new issue.

For help or questions about using this project, please open a discussion.

> [!NOTE]
> This repo is maintained unofficially by GitHub staff. We will do our best to respond to support, feature requests, and community questions in a timely manner.
## GitHub Support Policy

Support for this project is limited to the resources listed above.
2 changes: 1 addition & 1 deletion helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def parse_arguments():
parser.add_argument(
"--token",
type=str,
help="GitHub Personal Access Token (if not set in GITHUB_TOKEN envrionment variable)",
help="GitHub Personal Access Token (if not set in GITHUB_TOKEN environment variable)",
required=False,
)
parser.add_argument(
Expand Down

0 comments on commit 73222e1

Please sign in to comment.