Source and current GitHub constraints
GitHub Apps start with no selected permissions, and GitHub recommends choosing the minimum permissions needed. Permission choices control both API access and which webhook events an App can subscribe to. See Choosing permissions for a GitHub App. The Checks API is available to GitHub Apps; writing check runs requireschecks:write. GitHub limits check-run annotations to 50 per update, so a larger set must be sent through additional updates. See Using the REST API to interact with checks and Check run endpoints.
GitHub signs webhook payloads with an HMAC SHA-256 value in X-Hub-Signature-256 when a webhook secret is configured. Verification uses the exact payload bytes and a constant-time comparison. See Validating webhook deliveries.
These external behaviors are verified as of the page update, but the future App manifest and tagged integration tests must pin the GitHub API version and recheck them.
Trust boundary
Keep five identities distinct:
Installing an App is not the same as authorizing it to act as a user. The release-gate path should use installation identity and a narrowly scoped RampSpec service account; it does not need broad user authorization.
Pull-request authors, commit messages, branch names, workflow inputs, check rerun requests, target responses, and report content are untrusted. They cannot select organization, project, target, runner, suite, policy, baseline, credential, or network.
Intended App permissions
The tagged App manifest is authoritative. Its default intended repository permissions are:
If reviewed configuration files are required, prefer the narrowest supported single-file or contents-read permission and publish the exact paths. The App never needs contents write, workflows write, administration, or secrets access for a conformance gate.
A permission increase creates a new App manifest version and requires installation-owner approval. Installations that have not approved it remain on their old compatible feature set; the backend must not assume the new permission exists.
Intended webhook subscriptions
Subscribe only to events required by released trigger modes and their minimum permissions. The planned core set covers installation lifecycle, selected-repository changes, check rerun requests, and optionally trusted deployment or workflow completion events. A pull-request or push event is added only when a corresponding mapping mode is released. Do not subscribe to broad organization, member, secret, issue, or code events. Store delivery ID, App and installation IDs, repository numeric ID, event/action, sender fingerprint, commit or deployment identifier, received time, body digest, signature decision, mapping decision, and processing result. Retain the raw body only under the restricted webhook window.Register the App
The RampSpec service operator registers the App under the controlled RampSpec organization, with a verified public name, support and privacy links, exact callback/setup URLs when user authorization is truly needed, active webhook URL, strong generated secret, and the reviewed permission/event manifest. The App’s private key belongs in an approved KMS or secret manager and is accessible only to the token-minting component. Record key ID, fingerprint, creation, activation, retirement, and revocation. Never store it in a repository, CI secret, image, environment file, support bundle, or frontend. Before public installation, verify App ownership, requested permissions, webhook TLS, signature test vectors, key rotation, rate limits, suspension behavior, data retention, deletion, and incident contact. A private development App remains distinct from the production App.Install for selected repositories
An organization owner should:- open the verified App listing from the RampSpec integration page;
- compare owner, App ID, manifest version, requested permissions, and callback host;
- select only the repositories that need a RampSpec gate, not all repositories by default;
- complete GitHub installation and return through a state- and nonce-bound setup flow;
- verify installation account, numeric ID, selected repository IDs, permissions, events, actor, and time in RampSpec;
- map repositories and environments before enabling any trigger;
- run a read-only installation check and one controlled check-run test;
- review the GitHub and RampSpec audit events.
Repository and environment mapping
Map by immutable GitHub account and repository numeric IDs plus an explicit environment key. Names and URLs are display data because repositories can be renamed or transferred.
One repository can map different protected environments to different targets, but every event must resolve exactly one mapping. Ambiguous, missing, disabled, expired, or incompatible mappings create a non-success check without starting a target run.
Mapping changes require Maintainer or Owner authority, show a complete diff, revoke queued old work when needed, invalidate incompatible baselines, and create an audit event. The CI service account and GitHub App cannot approve their own mapping.
Trigger safety
Supported trigger designs are:- explicit dispatch from a trusted protected workflow;
- selected protected-branch or tag update;
- approved pull request using read-only or non-destructive scenarios;
- deployment or deployment-status event for a named environment;
- trusted workflow completion correlated to an immutable commit.
pull_request_target or workflow_run with checkout of untrusted pull-request code can expose a repository; see Secure use reference. RampSpec mappings must never take protected configuration or commands from that code.
Stateful, browser, customer, signing, payment, fault-injection, private-runner, or pubnet work runs only from a trusted protected workflow or deployment context after mapping and policy approval.
CI workflow skeleton
The stored planned workflow demonstrates read-only repository permission, immutable action placeholders, protected mapping variables, secret isolation, report verification, artifact retention, and concurrency. It is intentionally named.planned.yml, contains no real action commit or CLI release, and cannot run.
The release workflow must pin every action by full commit, limit job permissions, disable persistence of checkout credentials where possible, use an ephemeral runner, prevent caches from containing credentials or reports, and validate all downloaded artifacts before gate evaluation.
Service accounts and token flow
The GitHub App backend authenticates as the App with a short-lived signed assertion, requests an installation token scoped to the exact installation, repositories, and required permissions, performs the check operation, and discards the token. It does not return installation tokens to the browser or workflow. The CI workflow authenticates separately to RampSpec through a short-lived workload identity or expiring service-account exchange released by the backend. Scope it to read one mapping, start the selected safe suite, observe that run, download its evidence, and evaluate the named policy. Deny member, secret, target, suite, baseline, exception, pubnet, publication, and runner-administration scopes. Token audiences, repository/branch/environment claims, workflow identity, issue/expiry time, and replay nonce are validated before exchange. A self-hosted runner does not gain a broader token because it sits inside a private network.Secret handling
Repository or environment secrets contain only the minimum bootstrap material when workload federation is unavailable. Use environment protection for stateful contexts and expose the secret to one gate job. Mask it, disable shell tracing, never pass it as a command argument, and revoke it on workflow, mapping, repository, or ownership changes. App private keys and webhook secrets remain backend-managed. Target credentials and local-runner secrets stay in RampSpec secret providers; they never enter GitHub. Reports and artifacts must already be redacted and access-scoped before upload. Pull requests cannot print protected configuration, infer secret presence through branching, upload environment dumps, or choose an artifact destination. Automatic masking is not sufficient evidence that transformed secrets cannot leak.Webhook verification
At the edge, retain exact request bytes under a strict size limit. Require the configuredX-Hub-Signature-256 form, compute HMAC SHA-256 with the active webhook secret over those bytes, and compare in constant time before JSON parsing or event dispatch.
After signature success, validate media type, JSON without duplicate keys, event name/action, App and installation IDs, repository ID, sender class, delivery ID, and schema. Atomically reserve the delivery ID to prevent replay. Unknown or unsubscribed events are acknowledged without action and retained only as a safe audit digest.
During rotation, accept current and one explicitly overlapping previous secret for a bounded interval, test a delivery, then retire the old one. Missing, malformed, wrong-secret, modified-body, replayed, oversized, or schema-invalid requests cause no check or run. Proxies must not change body bytes before verification.
Check-run lifecycle
Create one check run per suite and commit using an installation token. Its external identity binds RampSpec run ID, mapping version, suite lock, and report destination. Planned states are queued, in progress, and completed; every update is idempotent and scoped to the same repository and commit. Completion mapping must preserve meaning:
Exact GitHub conclusion strings come from the released integration mapping. Branch protection should require stable check names tied to a compatibility line; renaming a required check needs coordinated migration so it cannot bypass protection.
The check summary includes target/environment display identity, network, suite and standards snapshot, gate policy, baseline, counts, coverage/skips, terminal state, cleanup, report digest, and disclaimer. It contains no secret, raw traffic, private target address, customer data, or unverified report link.
Finding annotations
Annotate only when a verified finding maps to a real file path and line in the exact checked commit, such as a reviewed RampSpec configuration file. Protocol endpoint, remote response, ledger, security-boundary, or report-only findings belong in the check summary and report, not on an invented source line. Normalize and validate paths inside the repository; reject absolute paths, traversal, symlinks that escape the checkout, binary files, mismatched commit content, or line ranges outside the blob. Titles and messages use stable finding code, severity, concise observed behavior, remediation, and report reference without untrusted Markdown or secrets. Send at most 50 annotations per check-run update as required by GitHub, paginate further updates deterministically, cap total annotations, and summarize omitted items by severity. Delivery retries cannot append duplicate annotations.Baselines and regressions
Approve a baseline only from a verified canonical report for the same organization, project, target, environment, network, compatible suite line, standards snapshot policy, and runner/evidence class. Record report and lock digests, approver, reason, time, and expiry or replacement rule. The App and CI service account can read but cannot create, approve, replace, or delete baselines. A target, network, suite major, mapping, ownership, or evidence-integrity change makes the baseline ineligible until a human reviews a replacement. Regression output distinguishes new, resolved, unchanged, reclassified, skipped, and indeterminate rules. A high score or fewer total findings cannot hide one new blocking finding or missing required coverage.JUnit export
JUnit is a derived CI view. Map one selected rule or scenario assertion to one stable test case, suite to a stable group, elapsed time to measured duration, skipped only to an explicit documented skip, and blocking/non-blocking findings to the released failure/error policy. Include report digest, rule ID, classification, severity, source pointer, and safe remediation in properties or messages within size limits. Do not embed raw exchanges, customer fields, tokens, private URLs, or binary evidence. The canonical JSON report remains authoritative when JUnit consumers collapse result categories. Validate XML, cap cases and message sizes, use deterministic ordering, and compare counts with the canonical report. An indeterminate required run cannot be emitted as a passing test suite.SARIF export
SARIF is also derived and is useful only for findings with a valid repository location and rule metadata. Use stable rule IDs, help text tied to the pinned standard, severity mapping, exact commit paths/regions, safe fingerprints for de-duplication, and a report-digest property. Remote protocol findings without source locations remain in checks/report rather than using a fake file. Validate SARIF schema and limits and strip secrets or private evidence. If uploading SARIF requires additional code-scanning permission, make that a separate reviewed opt-in; the core App does not request it by default. Derived JUnit and SARIF digests appear in the artifact inventory. Neither can be used to verify the canonical report signature.Reference repository strategy
Maintain separate controlled repositories for integration acceptance:
Pin each repository commit, workflow/action commits, mapping, report/baseline digests, App manifest, backend/CLI releases, and cleanup evidence. The repositories contain synthetic public test data only.
Failure and indeterminate handling
Webhook loss, GitHub API outage, rate limit, runner failure, target reachability, report upload failure, signature failure, missing artifact, event-stream gap, or mapping ambiguity cannot produce a success check. Reconcile delivery, run, report, and check identities idempotently before retry. A target conformance failure requires a valid report and evidence. Infrastructure and integration faults are labeled indeterminate. If GitHub is unavailable after a report completes, retain the pending check update and deliver it later without creating another RampSpec run. Rate-limit handling honors GitHub response metadata and bounded backoff. A required gate remains pending or non-success until the update is confirmed; it never bypasses protection because the integration could not post.Disable and remove
To disable one mapping, stop new triggers, cancel or let approved active runs finish under policy, preserve cleanup, complete pending check updates, revoke its RampSpec CI credential, remove schedules and webhook routing, expire cached installation tokens, and record the mapping audit event. Historical reports and checks follow retention policy. To uninstall completely:- inventory installations, selected repositories, mappings, baselines, active runs, schedules, service accounts, keys, secrets, and retained artifacts;
- drain triggers and resolve active runs and cleanup;
- revoke RampSpec service accounts and environment secrets;
- uninstall the GitHub App from the account or selected repositories;
- invalidate installation tokens, webhook secret versions, and mapping state;
- remove App private-key access when no installation remains, following key-retention policy;
- delete GitHub-derived data and artifacts at the documented deadline while retaining required audit digests;
- send test redeliveries and API attempts and prove no new run/check is accepted;
- record actor, time, reason, affected resources, deletion result, and exceptions.