Skip to content
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
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,28 @@ schemas and the `paramify` CLI — not the internal code.
`change_before_approval_field` `true`, and the new
`summary.changes_recorded_before_approval_field` counts these changes.

- **`github_image_signing` 0.1.0 shows whether GitHub Actions signs and
verifies container images with cosign.** It reads the workflow files on
each default branch and records every `cosign sign` step with the kind of
key it uses (a key management service, keyless or other), whether the
command names the image by digest, whether it skips the transparency log,
and whether the step can be skipped or fail without failing the run
(an `if`, `continue-on-error`, or `|| true` in the script). It records
every `cosign verify` step and what it checks against, and lists the
verify steps that cannot fail the run. It lists the workflows that mention
cosign without a cosign command in the file, where signing happens
somewhere the file does not show, and the workflows that call a reusable
workflow, whose signing it does not read. For each workflow that signs, it
reads the runs in the window by outcome and the latest successful run,
leaving out pull request runs, which it counts apart. The summary lists the repositories that sign
without verifying. It needs Contents for the files and Actions for the
runs; with `include_runs: false` it reads the files only and every run
figure is null. It reads workflow files, not the registry, and copies no
script text into the evidence. KSI-SVC-VRI. Not yet run against a live
organization. The workflow file reader and the newest-first run walk moved
from `github_actions_security` and `github_workflow_runs` into the shared
GitHub client so that the three fetchers use one copy; their evidence is
unchanged.
- **`wiz_vulnerability_findings` 0.4.0: SLA columns.** After the 43 legacy
columns (unchanged, so existing intake presets keep mapping), the CSV adds the
Wiz fields Paramify's remediation SLAs depend on: `Is Internet Reachable` and
Expand Down
12 changes: 7 additions & 5 deletions docs/ksi_mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ python tools/gen_ksi_mapping.py

*Controls:* `cm-2.2`, `cm-8.3`, `sc-13`, `sc-23`, `si-7`, `si-7.1`, `sr-10`

*9 fetchers:* [`azure_container_registry_configuration`](../fetchers/azure/container_registry_configuration), [`azure_devops_pipelines`](../fetchers/azure/devops_pipelines), [`azure_vm_hardening_status`](../fetchers/azure/vm_hardening_status), [`gcp_compute_instance_configuration`](../fetchers/gcp/compute_instance_configuration), [`gcp_gke_cluster_configuration`](../fetchers/gcp/gke_cluster_configuration), [`github_branch_protection`](../fetchers/github/branch_protection), [`github_release_integrity`](../fetchers/github/release_integrity), [`oci_compute_instances`](../fetchers/oci/compute_instances), [`wiz_file_integrity_monitoring`](../fetchers/wiz/file_integrity_monitoring)
*10 fetchers:* [`azure_container_registry_configuration`](../fetchers/azure/container_registry_configuration), [`azure_devops_pipelines`](../fetchers/azure/devops_pipelines), [`azure_vm_hardening_status`](../fetchers/azure/vm_hardening_status), [`gcp_compute_instance_configuration`](../fetchers/gcp/compute_instance_configuration), [`gcp_gke_cluster_configuration`](../fetchers/gcp/gke_cluster_configuration), [`github_branch_protection`](../fetchers/github/branch_protection), [`github_image_signing`](../fetchers/github/image_signing), [`github_release_integrity`](../fetchers/github/release_integrity), [`oci_compute_instances`](../fetchers/oci/compute_instances), [`wiz_file_integrity_monitoring`](../fetchers/wiz/file_integrity_monitoring)

### MLA — Monitoring, Logging, and Auditing (5/5)

Expand Down Expand Up @@ -330,7 +330,7 @@ python tools/gen_ksi_mapping.py

*Controls:* `cm-2.2`, `cm-7.5`, `cm-8`, `cm-8.1`, `cm-12`, `cm-12.1`, `cp-2.8`

*19 fetchers:* [`aws_detect_new_aws_resource`](../fetchers/aws/detect_new_aws_resource), [`aws_resource_inventory`](../fetchers/aws/resource_inventory), [`azure_entra_service_principals`](../fetchers/azure/entra_service_principals), [`azure_resource_inventory`](../fetchers/azure/resource_inventory), [`azure_sql_managed_instance_configuration`](../fetchers/azure/sql_managed_instance_configuration), [`azure_storage_encryption_status`](../fetchers/azure/storage_encryption_status), [`crowdstrike_hosts`](../fetchers/crowdstrike/hosts), [`datadog_agent_hosts`](../fetchers/datadog/agent_hosts), [`datadog_apm_services`](../fetchers/datadog/apm_services), [`datadog_containers`](../fetchers/datadog/containers), [`github_repository_inventory`](../fetchers/github/repository_inventory), [`gitlab_project_summary`](../fetchers/gitlab/project_summary), [`k8s_eks_pod_inventory`](../fetchers/k8s/eks_pod_inventory), [`rippling_devices`](../fetchers/rippling/devices), [`sentinelone_agents`](../fetchers/sentinelone/agents), [`sentinelone_xdr_assets`](../fetchers/sentinelone/xdr_assets), [`sophos_endpoint_inventory`](../fetchers/sophos/endpoint_inventory), [`wiz_inventory`](../fetchers/wiz/inventory), [`wiz_scan_coverage`](../fetchers/wiz/scan_coverage)
*20 fetchers:* [`aws_config_inventory`](../fetchers/aws/config_inventory), [`aws_detect_new_aws_resource`](../fetchers/aws/detect_new_aws_resource), [`aws_resource_inventory`](../fetchers/aws/resource_inventory), [`azure_entra_service_principals`](../fetchers/azure/entra_service_principals), [`azure_resource_inventory`](../fetchers/azure/resource_inventory), [`azure_sql_managed_instance_configuration`](../fetchers/azure/sql_managed_instance_configuration), [`azure_storage_encryption_status`](../fetchers/azure/storage_encryption_status), [`crowdstrike_hosts`](../fetchers/crowdstrike/hosts), [`datadog_agent_hosts`](../fetchers/datadog/agent_hosts), [`datadog_apm_services`](../fetchers/datadog/apm_services), [`datadog_containers`](../fetchers/datadog/containers), [`github_repository_inventory`](../fetchers/github/repository_inventory), [`gitlab_project_summary`](../fetchers/gitlab/project_summary), [`k8s_eks_pod_inventory`](../fetchers/k8s/eks_pod_inventory), [`rippling_devices`](../fetchers/rippling/devices), [`sentinelone_agents`](../fetchers/sentinelone/agents), [`sentinelone_xdr_assets`](../fetchers/sentinelone/xdr_assets), [`sophos_endpoint_inventory`](../fetchers/sophos/endpoint_inventory), [`wiz_inventory`](../fetchers/wiz/inventory), [`wiz_scan_coverage`](../fetchers/wiz/scan_coverage)

#### `KSI-PIY-RES` — Reviewing Executive Support

Expand Down Expand Up @@ -418,9 +418,9 @@ python tools/gen_ksi_mapping.py

## By fetcher

330 of 346 fetchers carry a mapping.
332 of 348 fetchers carry a mapping.

### aws (82)
### aws (83)

| Fetcher | Indicators |
|---|---|
Expand All @@ -441,6 +441,7 @@ python tools/gen_ksi_mapping.py
| [`aws_codepipeline_config`](../fetchers/aws/codepipeline_config) | `KSI-CMT-RMV`, `KSI-CMT-VTD` |
| [`aws_component_ssl_enforcement_status`](../fetchers/aws/component_ssl_enforcement_status) | `KSI-SVC-SIN` |
| [`aws_config_conformance_packs`](../fetchers/aws/config_conformance_packs) | `KSI-CNA-IBP`, `KSI-MLA-EVC` |
| [`aws_config_inventory`](../fetchers/aws/config_inventory) | `KSI-PIY-GIV` |
| [`aws_config_monitoring`](../fetchers/aws/config_monitoring) | `KSI-CMT-LMC`, `KSI-MLA-EVC`, `KSI-SVC-ACM` |
| [`aws_database_high_availability`](../fetchers/aws/database_high_availability) | `KSI-CNA-OFA` |
| [`aws_detect_new_aws_resource`](../fetchers/aws/detect_new_aws_resource) | `KSI-CMT-LMC`, `KSI-PIY-GIV` |
Expand Down Expand Up @@ -700,7 +701,7 @@ python tools/gen_ksi_mapping.py
| [`gcp_secret_manager_configuration`](../fetchers/gcp/secret_manager_configuration) | `KSI-SVC-ASM` |
| [`gcp_vpc_network_configuration`](../fetchers/gcp/vpc_network_configuration) | `KSI-CNA-ULN` |

### github (16)
### github (17)

| Fetcher | Indicators |
|---|---|
Expand All @@ -711,6 +712,7 @@ python tools/gen_ksi_mapping.py
| [`github_code_scanning_alerts`](../fetchers/github/code_scanning_alerts) | `KSI-MLA-EVC`, `KSI-SVC-EIS` |
| [`github_dependabot_alerts`](../fetchers/github/dependabot_alerts) | `KSI-SCR-MON`, `KSI-SVC-EIS` |
| [`github_deployment_controls`](../fetchers/github/deployment_controls) | `KSI-CMT-LMC`, `KSI-CMT-RMV`, `KSI-CMT-VTD` |
| [`github_image_signing`](../fetchers/github/image_signing) | `KSI-SVC-VRI` |
| [`github_non_user_credentials`](../fetchers/github/non_user_credentials) | `KSI-IAM-SNU`, `KSI-SVC-ASM` |
| [`github_org_security_settings`](../fetchers/github/org_security_settings) | `KSI-CNA-EIS`, `KSI-IAM-APM`, `KSI-IAM-ELP` |
| [`github_pull_request_checks`](../fetchers/github/pull_request_checks) | `KSI-CMT-LMC`, `KSI-CMT-VTD` |
Expand Down
2 changes: 2 additions & 0 deletions examples/github_run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ run:

- use: github_workflow_runs
targets: [*github_target]
- use: github_image_signing
targets: [*github_target]

- use: github_vulnerability_disclosure
targets: [*github_target]
Expand Down
2 changes: 1 addition & 1 deletion fetchers/_categories/github.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ display_name: GitHub
description: >-
GitHub change-management, supply-chain and code-security evidence: branch
protection, pull request review and CI checks, Actions security, release
integrity, deployment controls and approvals, workflow run history, Dependabot, code scanning and secret
integrity, deployment controls and approvals, workflow run history, image signing, Dependabot, code scanning and secret
scanning alerts, vulnerability disclosure, organization security settings,
access, non-user credentials, the audit log, FedRAMP significant change
notifications, and an inventory of every repository. One organization per target, each with its own token and API
Expand Down
47 changes: 42 additions & 5 deletions fetchers/github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ organization, each with its own token and API host.
| `github_release_integrity` | Build provenance on each release asset (by digest), immutable releases, release tags locked by tag rulesets | SVC-VRI, SCR-MIT |
| `github_deployment_controls` | Environments' reviewers, self-review, wait timers, branch policies and admin bypass; production deployments in a window with commit, creator, whether Actions made them and who approved them | CMT-RMV, CMT-VTD, CMT-LMC |
| `github_workflow_runs` | Every workflow run in a window with its trigger, branch, commit, actor and result, and the artifacts each run kept (metadata only) | CMT-VTD, CMT-RMV |
| `github_image_signing` | The cosign sign and verify steps in each workflow file: the kind of signing key, whether the image is named by digest, whether the step can be skipped; and how each signing workflow ran in a window | SVC-VRI |
| `github_vulnerability_disclosure` | Private vulnerability reporting, security policy, repository security advisories with state and age | PIY-RVD |
| `github_significant_change_notifications` | FedRAMP SCN objects from pull requests flagged as significant changes, schema-validated and checked against SCN-CSO-INF | CMT-LMC |
| `github_audit_log` | Audit log event counts and every access, protection and control change in a window (**Enterprise Cloud only**) | MLA-LET, MLA-OSM, IAM-SUS |
Expand Down Expand Up @@ -61,9 +62,9 @@ a missing grant is reported as e.g. `(needs: administration=read)`.
|---|---|---|
| Metadata (repository) | `metadata` | all |
| Administration (repository) | `administration` | branch_protection (also rule-suite bypasses), pull_request_checks (required checks), dependabot_alerts (security updates), code_scanning_alerts (default setup), secret_scanning (settings), non_user_credentials (deploy keys), actions_security (Actions policy, runners), release_integrity (immutable releases) |
| Contents (repository) | `contents` | pull_request_checks (commits), dependabot_alerts (dependency graph), actions_security (workflow files), branch_protection (CODEOWNERS errors) |
| Contents (repository) | `contents` | pull_request_checks (commits), dependabot_alerts (dependency graph), actions_security (workflow files), branch_protection (CODEOWNERS errors), image_signing (workflow files) |
| Pull requests (repository) | `pull_requests` | pull_request_checks, significant_change_notifications |
| Actions (repository) | `actions` | deployment_controls (environments, run approvals), workflow_runs, actions_security (OIDC subject, only in repositories with a workflow that uses OIDC) |
| Actions (repository) | `actions` | deployment_controls (environments, run approvals), workflow_runs, actions_security (OIDC subject, only in repositories with a workflow that uses OIDC), image_signing (runs of the signing workflows; or set `include_runs: false`) |
| Deployments (repository) | `deployments` | deployment_controls |
| Attestations (repository) | `attestations` | release_integrity |
| Repository security advisories (repository) | `repository_advisories` | vulnerability_disclosure. **Without it GitHub lists published advisories only, with no error**: drafts and private reports disappear and nothing says so |
Expand All @@ -88,7 +89,9 @@ fetchers at version 0.1.0. That measurement does not include
`workflow_runs`, the run approvals in `deployment_controls` 0.2.0, or the
runner groups and OIDC subjects in `actions_security` 0.2.0. Their rows in
the table above are not yet measured with a minimal token. If one is wrong,
the failure names the permission that GitHub wants.
the failure names the permission that GitHub wants. `image_signing` 0.1.0 is
built against GitHub's API description and covered by unit tests; it has not
yet been run against a live organization.

Two settings are visible only to an **organization owner**: the two-factor
requirement and the list of members without two-factor. Collected by a
Expand Down Expand Up @@ -243,6 +246,38 @@ repositories; each returns well-formed, misleading data without an error.

## Not visible to these fetchers

- **Image signing is read from workflow files, not from the registry.**
`image_signing` finds `cosign sign` and `cosign verify` commands in the
`run` scripts of the workflow files on each default branch. It does not
read the registry, so it cannot say which images carry a signature today.
cosign called from a script file, a make target, a composite action or a
reusable workflow in another file is not seen: the file row lists the
reusable workflows it calls, and the summary lists the workflows that
mention cosign (an installer, a make target) without a cosign command in
the file, and every workflow that calls a reusable workflow. A script that writes cosign commands into a file with a
here-document reads as running them. Other signing tools are not
recognized. Each cosign command is one entry: a step that runs two
commands counts twice, and one command in a loop that signs many images
counts once.
- **A signing workflow's run is not its signing step.** `image_signing`
reads each run's result, not each step's. A signing step under an `if`, or
with `continue-on-error`, can be skipped or fail in a run that succeeds,
and so can a command the script follows with `|| true`, `|| :` or a
message; the summary lists those steps so the run figures are read with
that in mind, and lists verify steps of that kind as not enforced. Two
other ways a script hides a failure are not detected: `set +e`, and a
pipe from cosign in a step that does not set `shell: bash` (GitHub's
default shell runs without `pipefail`). Runs on every branch are counted, while the steps are those of the
default branch's file. Pull request runs (`pull_request`,
`pull_request_target`) are counted apart and left out of every other run
figure: a signing workflow often runs on pull requests with its sign step
skipped, and such a run still succeeds.
- **A signing key is classified only from what the file says.** The key is
a key management service only when the `--key` value, written out or set
in the workflow's own `env`, starts with that service's scheme. A value
from a secret, a variable or a shell expression reads as `other`, cosign's
`env://` form reads as `environment_variable`, and no `--key` and no
`--sk` reads as `keyless`.
- **Review or merge gates enforced outside GitHub** (a bot merge queue such as
Prow, or comment-driven approval) do not appear as reviews or rules; such a
repository reads as unreviewed and unprotected. `pull_request_checks`
Expand Down Expand Up @@ -273,8 +308,10 @@ repositories; each returns well-formed, misleading data without an error.
## Free text in the evidence

The evidence holds text that people write: commit subjects, pull request
titles, advisory summaries, change notification sections and deploy key
titles. A web application firewall can refuse an upload that contains text
titles, advisory summaries, change notification sections, deploy key
titles and workflow step names. `image_signing` copies no script text.
From a workflow's `env` it keeps one thing, a signing key's reference, and
only when that is a plain key management service address. A web application firewall can refuse an upload that contains text
such as `../`, `/bin/sh` or `<script`. If an upload fails with a bare 403, look
for this type of text in the file.

Expand Down
48 changes: 48 additions & 0 deletions fetchers/github/_shared/github_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,54 @@ def list_repos(client: GitHubClient, org: dict, allowlist: List[str], include_ar
return sorted(repos, key=lambda r: r["name"].lower())


# --- reads shared by several fetchers -----------------------------------------

WORKFLOW_FILES = ('object(expression: "HEAD:.github/workflows") { ... on Tree { entries { name type '
'object { ... on Blob { text isBinary isTruncated } } } } }')


def workflow_file_texts(client: GitHubClient, org: str, repos: List[dict]) -> Optional[Dict[str, List[Tuple[str, Optional[str]]]]]:
"""{repository: [(file name, text)]} for the workflow files on each default branch, or None on failure.

GitHub runs only .yml and .yaml files directly in .github/workflows. text is None where GraphQL returned no
readable content (a binary or truncated file): its content is unknown, not empty.
"""
found = client.graphql_repos("GraphQL workflow files", org, [r["name"] for r in repos], WORKFLOW_FILES)
if found is None:
return None
out: Dict[str, List[Tuple[str, Optional[str]]]] = {}
for name, data in found.items():
entries = (data.get("object") or {}).get("entries") or []
rows: List[Tuple[str, Optional[str]]] = []
for e in sorted(entries, key=lambda e: e.get("name") or ""):
if e.get("type") != "blob" or not str(e.get("name")).endswith((".yml", ".yaml")):
continue
blob = e.get("object") or {}
unreadable = blob.get("text") is None or blob.get("isTruncated") or blob.get("isBinary")
rows.append((e["name"], None if unreadable else blob["text"]))
out[name] = rows
return out


def newest_since(client: GitHubClient, path: str, key: str, since: float, cap: int, what: str,
env: str) -> Optional[List[dict]]:
"""Items of a newest-first list created since `since`. None on failure or when more than `cap` are in the window.

Walked page by page rather than filtered with `created=`: a filtered list stops at 1,000 results and then reports
an empty page and total_count 0 (measured), which would read as a quiet window.
"""
seen: List[dict] = []
found = client.paginate_required(path, key=key,
until=lambda x: seen.append(x) or (to_epoch(x.get("created_at")) or since) < since
or len(seen) > cap)
if found is None:
return None
if len(seen) > cap and (to_epoch(seen[-1].get("created_at")) or since) >= since:
client.fail(f"GET {path}", "Truncated", f"more than {cap} {what} in the window; raise {env}", "partial_failure")
return None
return found


# --- the entry point ---------------------------------------------------------

def run(name: str, collect: Callable[[GitHubClient, dict, List[dict], Dict[str, Any]], Optional[dict]],
Expand Down
Loading
Loading