
GitHub App to set and enforce security policies
[!IMPORTANT] The OpenSSF-hosted Allstar GitHub App has been retired. Allstar, the OpenSSF Scorecard subproject, itself continues to be maintained — you must now run it yourself, either as a GitHub Action or as a service daemon.
See ossf/allstar#881 for more details.
If your organization was relying on the hosted app, see Migrating off the hosted app.
Allstar is a GitHub App that continuously monitors GitHub organizations or repositories for adherence to security best practices. If Allstar detects a security policy violation, it creates an issue to alert the repository or organization owner. For some security policies, Allstar can also automatically change the project setting that caused the violation, reverting it to the expected state.
Allstar’s goal is to give you finely tuned control over the files and settings that affect the security of your projects. You can choose which security policies to monitor at both the organization and repository level, and how to handle policy violations. You can also develop or contribute new policies.
Allstar is developed as a part of the OpenSSF Scorecard project.
If you're getting unwanted issues created by Allstar, follow these directions to opt out.
Allstar is highly configurable. There are three main levels of controls:
These configurations are done in the organization's .allstar repository.
Repo level: Repository maintainers in an organization that uses
Allstar can choose to opt their repository in or out of organization-level
enforcements. Note: these repo-level controls are only functional when "repo
override" is allowed in the org-level settings. These configurations are
done in the repository's .allstar directory.
Policy level: Administrators or maintainers can choose which policies
are enabled on specific repos and which actions Allstar takes when a policy
is violated. These configurations are done in a policy yaml file in either
the organization's .allstar repository (admins), or the repository's
.allstar directory (maintainers).
Before installing Allstar at the org level, you should decide approximately how many repositories you want Allstar to run on. This will help you choose between the Opt-In and Opt-Out strategies.
The Opt In strategy allows you to manually add the repositories you'd like Allstar to run on. If you do not specify any repositories, Allstar will not run despite being installed. Choose the Opt In strategy if you want to enforce policies on only a small number of your total repositories, or want to try out Allstar on a single repository before enabling it on more. Since the v4.3 release, globs are supported to easily add multiple repositories with a similar name.
The Opt Out strategy (recommended) enables Allstar on all repositories and allows you to manually select the repositories to opt out of Allstar enforcements. You can also choose to opt out all public repos, or all private repos. Choose this option if you want to run Allstar on all repositories in an organization, or want to opt out only a small number of repositories or specific type (i.e., public vs. private) of repository. Since the v4.3 release, globs are supported to easily add multiple repositories with a similar name.
Allstar acts on your organization as a GitHub App: you create the app, and you run the process that authenticates as it. Setup is therefore two steps that are common to every deployment — create the app and create the control repository — and then a choice of how to run it:
The Action is the lower-overhead of the two and is where most organizations should start; you can move to a daemon later without changing any policy configuration.
An App is a user-like identity with a set of permissions in your organization.
Allstar needs read access to most settings and file contents in order to detect
compliance, and write access to issues and checks in order to file issues and
support the block action.
Follow Operator instructions - Create a GitHub App, and record the App ID and private key. Both run modes need them.
.allstar control repositoryAllstar reads its configuration from a repository named .allstar in your
organization.
The fastest way to create one is from the sample:
.allstarThis enables all current Allstar policies on all repositories
using the Opt Out strategy, with the issue action. You can change any of it
later.
For granular control from the start — choosing the Opt In or Opt Out strategy and writing individual policy files yourself — follow the manual installation directions instead.
This option runs Allstar as a scheduled job using GitHub Actions, so there is no infrastructure to operate beyond GitHub itself.
Follow the GitHub Actions installation
directions to set up a recurring Action in your
.allstar repository, harden it, and monitor its results.
This option runs Allstar as a persistent process, which detects and resolves violations continuously rather than on a schedule.
See Operator instructions for running the process, managing secrets, sizing, and the available environment variables.
If your organization used the OpenSSF-hosted app, your configuration carries
over as-is. The .allstar control repository, allstar.yaml, and every
policy file keep working unchanged; what you are replacing is only the process
that reads them.
To migrate:
.allstar repository exactly as it is.allstar-app from your organization, if it still appears under
Settings -> GitHub Apps.Issues previously filed by the hosted app remain in your repositories. Your own
instance identifies its issues by the same allstar label (or your configured
issueLabel), so it will adopt and close them as violations are resolved,
rather than filing duplicates.
Each policy can be configured with an action that Allstar will take when it detects a repository to be out of compliance.
log: This is the default action, and actually takes place for all
actions. All policy run results and details are logged. Logs are currently
only visible to the app operator, plans to expose these are under discussion.issue: This action creates a GitHub issue. Only one issue is created per
policy, and the text describes the details of the policy violation. If the
issue is already open, it is pinged with a comment every 24 hours without updates
(not currently user configurable). If the policy result changes, a new comment
will be left on the issue and linked in the issue body. Once the violation is
addressed, the issue will be automatically closed by Allstar within 5-10 minutes.fix: This action is policy specific. The policy will make the changes to the
GitHub settings to correct the policy violation. Not all policies will be able
to support this (see below).Proposed, but not yet implemented actions. Definitions will be added in the future.
block: Allstar can set a GitHub Status
Check
and block any PR in the repository from being merged if the check fails.email: Allstar would send an email to the repository administrator(s).rpc: Allstar would send an rpc to some organization-specific system.Two settings are available to configure the issue action:
issueLabel is available at the organization and repository level. Setting it
will override the default allstar label used by Allstar to identify its
issues.
issueRepo is available at the organization level. Setting it will force all
issues created in the organization to be created in the repository specified.
Similar to the Allstar app enable configuration, all policies are enabled and
configured with a yaml file in either the organization's .allstar repository,
or the repository's .allstar directory. As with the app, policies are opt-in
by default, also the default log action won't produce visible results. A
simple way to enable all policies is to create a yaml file for each policy with
the contents:
optConfig:
optOutStrategy: true
action: issue
The details of how the fix action works for each policy is detailed below. If omitted below, the fix action is not applicable.
This policy's config file is named branch_protection.yaml, and the config
definitions are
here.
The branch protection policy checks that GitHub's branch protection settings are setup correctly according to the specified configuration. The issue text will describe which setting is incorrect. See GitHub's documentation for correcting settings.
The fix action will change the branch protection settings to be in compliance with the specified policy configuration.
This policy's config file is named binary_artifacts.yaml, and the config
definitions are
here.
This policy incorporates the check from scorecard. Remove the binary artifact from the repository to achieve compliance. As the scorecard results can be verbose, you may need to run scorecard itself to see all the detailed information.
This policy's config file is named codeowners.yaml, and the config
definitions are
here.
This policy checks for the presence of a CODEOWNERS file on your repositories.
This policy's config file is named outside.yaml, and the config definitions
are
here.
This policy checks if any Outside Collaborators have either administrator(default) or push(optional) access to the repository. Only organization members should have this access, as otherwise untrusted members can change admin level settings and commit malicious code.
This policy's config file is named security.yaml, and the config definitions
are
here.
This policy checks that the repository has a security policy file in
SECURITY.md and that it is not empty. The created issue will have a link to
the GitHub
tab
that helps you commit a security policy to your repository.
This policy's config file is named dangerous_workflow.yaml, and the config
definitions are
here.
This policy will run against all branches, see rationale here.
This policy checks the GitHub Actions workflow configuration files
(.github/workflows), for any patterns that match known dangerous
behavior. See the OpenSSF Scorecard
documentation
for more information on this check.
This policy's config file is named scorecard.yaml, and the config definitions
are
here.
This policy runs any scorecard check listed in the checks configuration. All
checks run must have a score equal or above the threshold setting. Please see
the OpenSSF Scorecard
documentation
for more information on each check.
The Scorecard policy can optionally upload results as SARIF to each repository's Security > Code Scanning tab. This gives organization administrators visibility into Scorecard findings alongside other security tools (CodeQL, Dependabot, etc.) without requiring per-repository workflow setup.
To enable SARIF upload, add the upload field to your scorecard.yaml:
optConfig:
optOutStrategy: true
action: issue
checks:
- Binary-Artifacts
- Signed-Releases
threshold: 8
upload:
sarif: true
Requirements:
security_events). This is
not among the permissions Allstar otherwise needs, so add it to your app
before enabling SARIF upload.SARIF upload works with both ways of running Allstar: as a service daemon or as a GitHub Action.
This policy's config file is named actions.yaml, and the config definitions
are
here.
This policy checks the GitHub Actions workflow configuration files
(.github/workflows) (and workflow runs in some cases) in each repo to ensure
they are in line with rules (eg. require, deny) defined in the
organization-level config for the policy.
This policy's config file is named admin.yaml, and the config definitions
are
here.
This policy checks that by default all repositories must have a user or group assigned as an Administrator. It allows you to optionally configure if users are allowed to be administrators (as opposed to teams).
See this repo as an example of Allstar config being used. As the organization administrator, consider a README.md with some information on how Allstar is being used in your organization.
By default, org-level configuration files, such as the allstar.yaml file
above, are expected to be in a .allstar repository. If this repository does
not exist, then the .github repository allstar directory is used as a
secondary location. To clarify, for allstar.yaml:
| Precedence | Repository | Path |
|---|---|---|
| Primary | .allstar | allstar.yaml |
| Secondary | .github | allstar/allstar.yaml |
This is also true for the org-level configuration files for the individual policies, as described below.
Allstar will also look for repo-level policy configurations in the
organization's .allstar repository, under the directory with the same name as
the repository. This configuration is used regardless of whether "repo override"
is disabled.
For example, Allstar will lookup the policy configuration for a given repo
myapp in the following order:
For org-level Allstar and policy configuration files, you may specify the field
baseConfig to specify another repository that contains base Allstar
configuration. This is best explained with an example.
Suppose you have multiple GitHub organizations, but want to maintain a single
Allstar configuration. Your main organization is "acme", and the repository
acme/.allstar contains allstar.yaml:
optConfig:
optOutStrategy: true
issueLabel: allstar-acme
issueFooter: Issue created by Acme security team.
You also have a satellite GitHub organization named "acme-sat". You want to
re-use the main config, but apply some changes on top by disabling Allstar on
certain repositories. The repository acme-sat/.allstar contains
allstar.yaml:
baseConfig: acme/.allstar
optConfig:
optOutRepos:
- acmesat-one
- acmesat-two
This will use all the config from acme/.allstar as the base config, but then
apply any changes in the current file on top of the base configuration. The
method this is applied is described as a JSON Merge
Patch. The baseConfig must be
a GitHub <org>/<repository>.
See CONTRIBUTING.md
| Opt Out (Recommended) optOutStrategy = true | Opt In optOutStrategy = false |
|---|
| Default behavior | All repos are enabled | No repos are enabled |
| Manually adding repositories | Manually adding repos disables Allstar on those repos | Manually adding repos enables Allstar on those repos |
| Additional configurations | optOutRepos: Allstar will be disabled on the listed repos optOutPrivateRepos: if true, Allstar will be disabled on all private repos optOutPublicRepos: if true, Allstar will be disabled on all public repos (optInRepos: this setting will be ignored) | optInRepos: Allstar will be enabled on the listed repos (optOutRepos: this setting will be ignored) |
| Repo Override | If true: Repos can opt out of their organization's Allstar enforcements
using the settings in their own repo file. Org level opt-in settings that
apply to that repository are ignored. If false: repos cannot opt out of Allstar enforcements as configured at the org level. | If true: Repos can opt in to their organization's Allstar enforcements even
if they are not configured for the repo at the org level. Org level opt-out
settings that apply to that repository are ignored. If false: Repos cannot opt into Allstar enforcements if they are not configured at the org level. |
| GitHub Action | Service daemon |
|---|
| How it runs | Scheduled job in your .allstar repo | Persistent process you host |
| You provide | Nothing beyond GitHub | A server or container orchestrator |
| Cadence | Whatever you set the cron to | Continuous, with results in 5-10 minutes |
| Setup effort | Moderate | High |
| Best when | You want the lowest-infrastructure option | You want the most control, or already run services |
| Repository | Path | Condition |
|---|
myapp | .allstar/branch_protection.yaml | When "repo override" is allowed. |
.allstar | myapp/branch_protection.yaml | All times. |
.allstar | branch_protection.yaml | All times. |
.github | allstar/myapp/branch_protection.yaml | If .allstar repo does not exist. |
.github | allstar/branch_protection.yaml | If .allstar repo does not exist. |