Repository navigation
Add GitHub Actions OIDC authentication, lease renewal, and workflow annotations - #127
Open
vishalrajofficial wants to merge 1 commit into
Open
vishalrajofficial wants to merge 1 commit into
vishalrajofficial wants to merge 1 commit into
Conversation
Adds secretless GitHub Actions OIDC credential exchange with automatic single-flight lease renewal, validated event commit context parsing, and injection-safe GitHub workflow annotations for review outcomes. Signed-off-by: Vishal Raj <9031842908.vk@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Who this helps
Teams running Python CI scripts (coverage uploads,
wait_for_reviewchecks, deploy verification, and MCP workflows) inside GitHub Actions can now authenticate without provisioning or rotating a long-livedPROOFLINE_TOKENrepository secret. Workflow jobs withid-token: writeexchange their runner OIDC token for a short-lived Proofline lease, renew it automatically across multi-minute waits, read the reviewed commit accurately fromGITHUB_EVENT_PATH, and emit inline PR workflow annotations fromReviewOutcome.What changed
proofline/github_actions.pyand re-exportedGitHubActionsCredentials,AsyncGitHubActionsCredentials,GitHubActionsEvent,GitHubActionsLease,read_github_actions_event, andformat_github_annotationsfromproofline.ProoflineClient.from_github_actions()andAsyncProoflineClient.from_github_actions()factory constructors (plus.organization_idand.repository_idproperties and support for passing dynamicTokenProvider/AsyncTokenProviderinstances astoken=), registeringfrom_github_actionsinscripts/contracts.py.proofline/_transport.py(BearerAuth,RetryTransport,AsyncRetryTransport,redacted,problem, and single-attempt checked transportsSingleAttemptTransport/AsyncSingleAttemptTransport) so dynamic credentials supply fresh tokens on initial calls and GET 429/503 retries while redacting runner, OIDC, and current/retired session secrets from error messages.README.mdand added sync/async HTTP and security tests intests/test_github_actions.py.openapi.public.json,proofline/_generated/, and workflows untouched.Decisions made
ttl - min(60s, ttl / 2)on a monotonic clock (60s lead on 1-hour leases, half-life on short test leases), guarded per client bythreading.Lock(sync) oranyio.Lock(async). Renewals enforce a constantorganization_id, raisingurn:proofline:sdk:credential-mismatchand failing closed if a renewed lease changes organization or returns HTTP 4xx/5xx.GET ACTIONS_ID_TOKEN_REQUEST_URL) and exchanges (POST /api/v1/ci/github-actions/credentials) use single-attempt non-redirecting transports sharing the SDK'sIO_DEADLINE,DEADLINE,Content-Encoding: identity, and 8 MiB response guards. Query parameters onACTIONS_ID_TOKEN_REQUEST_URL(such as?sig=...) are stripped from error text, and conflictingbase_urlvalues between a credential provider and client are rejected at construction time.read_github_actions_event()readsGITHUB_EVENT_PATHunder a 10 MiB bound and resolvescommit_under_testtopull_request.head.shaorworkflow_run.head_sharather than syntheticGITHUB_SHAmerge refs.format_github_annotations()reusesproofline.outcomescode-lane and withheld-value checks, excludes resolved/dismissed/accepted-risk items, sorts severe/unknown findings first, pins at most one validated repo-relative location per finding matchinghead_commit_sha(excluding companion repositories and path traversal), escapes%, CR, LF,:, and,, strips control/bidi characters, and appends a::warningannotation whenever an outcome is incomplete or has gaps.How it was tested
Ran the full local verification suite on Windows (Python 3.11.1):
python scripts/generate.py --check: passedpython scripts/contracts.py: passedruff check .andruff format --check .: passed (239files formatted)mypy proofline scripts tests/test_github_actions.py: passed (231source files)pytest -q:230 passed(including all 12 new tests intests/test_github_actions.pycovering sync/async OIDC exchange against localtests.http_server.Server, single-flight concurrency, mid-pollwait_for_reviewrenewal, retry-after header refresh, secret/query redaction, org-mismatch failure, redirect/expiry rejections, event parsing, and annotation escaping/gap warnings)proofline_sdk-10.2.2-py3-none-any.whl) and sdist (proofline_sdk-10.2.2.tar.gz) viapython -m build --no-isolationand verified both clean installations passscripts/install_smoke.py