Skip to content

Add optional metadata-only catalog GitHub App reads - #73

Merged
FlyOverCoderKY merged 2 commits into
mainfrom
codex/catalog-read-auth-20261114
Nov 14, 2026
Merged

FlyOverCoderKY merged 2 commits into
mainfrom
codex/catalog-read-auth-20261114

Conversation

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor

Scheduled public release reads currently discard the response hints needed to distinguish upstream throttling from other HTTP refusals. Keep the anonymous default and add bounded numeric 403/429 hints, plus an optional catalog-only GitHub App issuer that cannot reuse engineering credentials.

The issuer requests one immutable repository per metadata-only token, uses WebCrypto RS256 with current configuration/expiry guards and a common ten-second deadline, rejects redirects and retries, and requires fresh public repository/org metadata before any authenticated 200/304/404 advances catalog state. No App, grant, key, enabled configuration, or schedule is created. Metadata-only token access to the public release endpoint still needs explicit activation qualification; a refusal never widens permissions. Also correct the stale Support Desk registry fallback to the deployed public 0.2.12 state.

Validation: Worker types and all 81 focused tests passed on actual Node 22.18.0 and 24.18.0, zero skips (issuer/authentication, reconciliation, finite diagnostics, catalog compiler). Public SDK 339 members, Sessions 7 members, package.json and pnpm-lock.yaml stayed unchanged. Local heavy Native/benchmark/build gates and deployed signing CPU/live access are not claimed by this focused run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-11-14T06:53:06.075795Z 86d8401 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

OpenRouter review posted (clean). #73 (review)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenRouter pull-request review

Verdict: issues
Scope: full-pr (full-pr)
Mode: initial
Commit: 86d840169b428992a436fe9a570517746e9dc1df
Judge: openai/gpt-5.6-luna
Cost: $0.2932 (lanes $0.2878 + judge $0.0054)

Lanes

  • openai/gpt-6.1-sol: ok (4 finding(s), 127.4s, 255791+4084 tokens (201573 cached), 6 tool round(s), via Azure, $0.22)
  • z-ai/glm-5.3-flash: ok (8 finding(s), 318.4s, 1702847+58745 tokens (1550464 cached), 25 tool round(s), via CoreWeave, $0.0716)

Findings

🔴 Issue 1 — Unfenced projection work after authentication expiry or timeout

worker/src/release-reconciliation.ts:394 · bug · identified by openai/gpt-6.1-sol

If a projection's database read stalls past the ten-second deadline, reconciliation reports failure but the abandoned projection can still resume and write or delete the prior catalog state. If configuration or token validity expires during a shorter database wait, the operation can instead finish as a success and advance reconciliation progress using expired authority.

The last assertCurrent() runs before calling the projection helpers. All three helpers—applyAuthoritativeCurrentRelease, touchCurrentReleaseObservedAt, and clearCurrentRelease—call updateSupportFollowupRelease, which awaits two versioned reads, potentially a fingerprint calculation, and a transaction without an authentication fence. Promise.race does not cancel that work, and the Store operations receive no abort signal.

I checked release-projection.ts, support-release-followup-releases.ts, and the reconciliation tests. The existing expiry tests change authority during metadata fetch, before the final assertion; they do not cover these later database waits. Carry a current-authority guard through the projection's awaited preparation and transaction submission, and ensure a timed-out invocation cannot leave an unfenced mutation running.

🔵 Issue 2 — Misclassified shared-deadline failures

worker/src/release-reconciliation.ts:398 · nit · identified by openai/gpt-6.1-sol

When token minting succeeds but release fetching, release-body consumption, repository verification, or projection stalls until the deadline, the summary labels the failure as authentication. This directs operators toward App configuration or signing even though authentication already succeeded.

The catch block unconditionally replaces the tracked phase with authentication whenever timedOut is true. Earlier code already maintains the actual phase, so preserving that phase would distinguish these failures without exposing provider error text.

I checked the diagnostics tests and the new deadline test. The deadline test covers only an issuer that never settles, for which authentication is correct; it does not cover a timeout in a later phase.

🔵 Issue 3 — Undocumented App configuration field types

worker/README.md:359 · nit · identified by openai/gpt-6.1-sol

An operator supplying ordinary numeric GitHub IDs in the configuration JSON, such as "appId": 10 and "installationId": 20, gets an unavailable authentication result without any token request. The runbook names the fields but does not explain that both IDs must be JSON strings.

numericId() accepts only strings, and version must also be a string matching a restricted pattern. Add a complete fictional configuration example or document the required types and format so separately approved activation does not fail on otherwise plausible configuration.

I checked the issuer, its fixture, and the operator section. The fixture uses string IDs, but the runbook has no configuration example or type declaration.

🔵 Issue 4 — Unexercised purpose-rejection assertion

worker/src/release-catalog-auth.test.ts:125 · nit · identified by openai/gpt-6.1-sol

Removing the issuer's purpose check would still leave the test named refuses cancellation and an unapproved purpose/repository without a network call passing. Both calls in that test use the approved public_release_catalog_read purpose, so it pins cancellation and repository rejection only.

Add an intentionally unsupported runtime purpose, using an explicit test-only cast if necessary, and assert that it returns null without transport activity. This will make the test fail if the purpose boundary is removed.

I checked the rest of release-catalog-auth.test.ts; no other test supplies an unsupported purpose. The implementation currently has the guard, so this is a regression-coverage defect rather than a present acceptance bug.

🟠 Issue 5 — Authenticated metadata check hardcodes owner login pegma-dev instead of the configured organization authority

worker/src/release-reconciliation.ts:258 · risk · identified by z-ai/glm-5.3-flash

If the GitHub organization is renamed (GitHub preserves the numeric org ID across renames), or the deployment's GITHUB_ORGANIZATION_ID points at an org whose login is not exactly pegma-dev, every authenticated reconciliation cycle fails at the metadata step: the code requires owner.login === 'pegma-dev' in addition to asId(owner.id) === credential.organizationId. The mode then fails closed forever — prior projections are held, lastSuccessfulReconciliationAt stays null, health goes stale — and the log shows only phase: 'repository', failureClass: 'operation_rejected', which does not hint that a hardcoded string is the cause.

The login check is also redundant as a security fence: the request is ID-addressed (/repositories/{id}) and the code already pins value.id === entry.repositoryId and owner.id === credential.organizationId; repository IDs are globally unique, so the login adds no authority that the ID checks lack. Everywhere else in the codebase treats the org ID as the configurable authority (github-release-webhook.ts validates the payload org by ID only; GITHUB_ORGANIZATION_ID is a wrangler var), and the README/plan only promise that the repository "belongs to the configured Pegma organization" — the fixed login is neither configurable nor documented.

Checked: github-release-webhook.ts (ID-only org validation), release-projection.ts (hardcoded URL prefix is display-only), and the test fixture which pins login: 'pegma-dev', confirming the value is baked in rather than derived from configuration.

🔵 Issue 6 — Issuer requires the full 13-ID catalog in GITHUB_ALLOWED_REPOSITORY_IDS, coupling the App mode to the shared webhook/releases allowlist

worker/src/release-catalog-auth.ts:133 · nit · identified by z-ai/glm-5.3-flash

An operator who legitimately narrows GITHUB_ALLOWED_REPOSITORY_IDS (the same var gates webhook acceptance and /api/releases display) and then enables GITHUB_RELEASE_AUTH_MODE=github_app gets a permanent, silent outage of reconciliation: ids.length !== RELEASE_CATALOG.length / !RELEASE_CATALOG.every(...) make resolve return null for every repository, so each shard fails with operation_rejected and no request is made. Restoring the 13 IDs to fix reconciliation simultaneously re-widens the webhook allowlist — the two knobs cannot be set independently.

The README does say "exact 13-ID repository allowlist must be configured", but it does not tell the operator that this var is shared with the webhook and that narrowing it for ingestion scoping breaks the optional auth mode. Checked github-release-webhook.ts (parseAllowedRepositoryIds accepts any non-empty subset) and releases-api.ts (same var) to confirm the shared use.

🔵 Issue 7 — Shared-deadline timer overwrites the real failure phase with authentication

worker/src/release-reconciliation.ts:397 · nit · identified by z-ai/glm-5.3-flash

When the 10-second timer fires, if (timedOut) options.failure.phase = 'authentication' unconditionally rewrites the phase that earlier code had already set. Concrete scenario: the token is minted at 0.3s, the release fetch returns 200 at 1s, and the metadata verification fetch hangs; verifyPublicRepository sets failure.phase = 'repository', the timer fires at 10s, the abort rejects the aborted promise, and the catch overwrites the phase to authentication — the log then blames authentication for a hang that happened after minting, on the second GitHub request. The same misattribution applies to deadline expiry during the body read or the projection write.

Cost: operators triaging release_reconciliation.partial_failure cannot distinguish "issuer/mint never settled" from "a post-mint request outlived the shared deadline". Checked the failure-detail contract in release-reconciliation-diagnostics.test.ts (phases are the only per-phase signal operators get) and confirmed no test pins the intended semantics for a late-phase timeout.

🔵 Issue 8 — Authenticated metadata-phase failures lose the per-phase failure classes and mix two responses in one failure detail

worker/src/release-reconciliation.ts:236 · nit · identified by z-ai/glm-5.3-flash

In the authenticated path, errors from the metadata verification bypass the classification used everywhere else, because verifyPublicRepository has no try/catch and everything it throws is funneled into the wrapper's catch as operation_rejected:

  • A network failure on the metadata GET is reported operation_rejected, while the identical failure on the release GET one line earlier is fetch_rejected — alerts/dashboards keyed on failureClass split one failure mode in two depending on which of the two requests failed.
  • A 200 metadata response with a malformed JSON body is reported operation_rejected, never invalid_json (readCatalogAuthenticationJson's JSON.parse SyntaxError is not mapped), unlike the release body which reports invalid_json via readBoundedJson.
  • On the 200 path, readBoundedJson has already recorded bodyBytes/bodyBytesSource describing the release body; a subsequent metadata failure then assigns httpStatus (and hints) from the metadata response into the same detail row, so one row carries bodyBytes from response A and httpStatus from response B. On the 304/404 paths the original httpStatus: 304/404 is likewise overwritten.

Cost is diagnostic only (the fail-closed outcome itself is correct); the log can no longer answer "which request failed and why" without correlating timestamps. Checked release-reconciliation-diagnostics.test.ts, which pins the anonymous-path classifications but has no equivalent pins for the metadata phase.

🔵 Issue 9 — releaseRateHints drops date-valued and >24h Retry-After, contradicting the documented throttle-signal reading

worker/src/release-catalog-auth.ts:30 · nit · identified by z-ai/glm-5.3-flash

worker/README.md tells operators that "Zero remaining or Retry-After is a throttle signal; absent hints ... do not establish permission failure". But integer('retry-after', 86_400) returns null for a perfectly valid RFC 9110 HTTP-date Retry-After (e.g. Wed, 14 Nov 2026 06:01:00 GMT, which the new test explicitly pins to null) and for numeric values above 86400 (e.g. 172800). A 403/429 that explicitly says "retry at time T" is therefore logged with retryAfterSeconds: null, and an operator following the README reads a throttled response as "absent hints" and may misread it as permission-shaped.

The bounded-numeric design is clearly deliberate (the test asserts it), so this is a docs/behavior gap rather than a code bug: either the README should say only numeric-second Retry-After up to one day is retained, or the date form should be converted. Checked the test retains no raw value for Wed, 14 Nov 2026 06:01:00 GMT and the README paragraph in worker/README.md (~line 386).

🔵 Issue 10 — Issuer composition in index.ts does not share the reconciliation's injectable clock/fetch, mixing time sources in the expiry fences

worker/src/index.ts:1262 · nit · identified by z-ai/glm-5.3-flash

runReleaseReconciliation gained clock and fetchImpl injection, but the issuer is composed as releaseCatalogAuthenticationFor(() => env) with no options, so it always binds systemClock and the global fetch. Any composition that passes a custom clock to reconciliation without also passing it to the issuer (the new RunReleaseReconciliationOptions.clock invites exactly this) mixes two time sources: the credential's started/expiresAt are derived from the injected clock while current() re-reads systemClock. With a fixed test/alt-host clock set in the past, current() is false immediately (system now >= expiresAt) and every resolve fails closed; with a skewed forward clock the 10-second fence is meaningless. Today's only caller uses the defaults on both sides, so production is consistent — this is a latent composition hazard, and the new tests only stay green because the fixture threads the same clock into both.

Checked all call sites (runReleaseReconciliation, backfillReleases, maintenance-schedule.test.ts) — index.ts is the sole production composition.

🔵 Issue 11 — Issuer configuration/credential faults are indistinguishable from GitHub refusals in the failure log

worker/src/release-catalog-auth.ts:156 · nit · identified by z-ai/glm-5.3-flash

Every pre-mint rejection path — malformed PEM (return null at the regex), key that fails crypto.subtle.importKey, non-RSA or out-of-range modulus (return null), GITHUB_RELEASE_APP_CONFIGURATION written with numeric appId/installationId (fails numericId), wrong key set, expired validUntil — surfaces identically to a transient issuer outage: resolve returns null or rejects without a response, and the wrapper logs phase: 'authentication', failureClass: 'operation_rejected' with no bounded, secret-free reason code.

Concrete activation cost: during the qualification the README demands, an operator who writes the config JSON with numbers instead of strings sees the same recurring error as a GitHub 5xx storm and cannot tell whether to fix the var or wait; the only remedy is re-reading the deployment. A small closed vocabulary of failure reasons (e.g. invalid_configuration vs issuer_unavailable) would stay within the existing no-secrets logging rule. Checked release-catalog-auth.test.ts (all fault cases assert only null/rejection) and the README's logging paragraph, which promises no key/JWT/token leakage but does not promise cause-free classification.

🔵 Issue 12 — Projection write can complete after the shared deadline expires while the run reports failure

worker/src/release-reconciliation.ts:396 · nit · identified by z-ai/glm-5.3-flash

In the authenticated path the store write is not fenced by the abort signal: assertCurrent() runs before applyAuthoritativeCurrentRelease/clearCurrentRelease, but the write itself is unabortable. If the write straddles the 10-second deadline (e.g. metadata verification passes at 9.98s and the D1 write takes ~50ms), the timer fires, controller.abort() rejects the aborted promise, Promise.race settles as failed, and the catch logs operation_rejected with phase: 'authentication' — while the release row is nevertheless upserted/cleared moments later. The summary, lastSuccessfulReconciliationAt, and the skipped ETag update then contradict the actual store contents until the next six-hour cycle re-fetches and converges.

The anonymous path does not have this race (its AbortSignal.timeout only bounds the fetch, and a write that starts after a completed fetch finishes normally with an upserted outcome), so this is new behavior introduced by the wrapper. Data written is verified-authentic, so this is an audit-trail inconsistency, not corruption. Checked release-projection.ts (applyAuthoritativeCurrentRelease/clearCurrentRelease take no signal) and confirmed no test covers a write that outlives the deadline.

Workflow run

Comment thread worker/src/release-reconciliation.ts Resolved
Comment thread worker/src/release-reconciliation.ts Resolved
Comment thread worker/README.md Resolved
Comment thread worker/src/release-catalog-auth.test.ts Resolved
Comment thread worker/src/release-reconciliation.ts Resolved
Comment thread worker/src/release-reconciliation.ts Resolved
Comment thread worker/src/release-catalog-auth.ts Resolved
Comment thread worker/src/index.ts Resolved
Comment thread worker/src/release-catalog-auth.ts Resolved
Comment thread worker/src/release-reconciliation.ts Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenRouter pull-request review

Verdict: clean
Scope: latest-commit (commit-range)
Mode: verify
Commit: 77b48b8e1e68d482043c76f96d5dca1536c9af99
Judge: openai/gpt-5.6-luna
Cost: $0.1707 (lanes $0.1706 + judge $0.0001)

Lanes

  • openai/gpt-6.1-sol: ok (0 finding(s), 33.9s, 160648+1192 tokens (130376 cached), 6 tool round(s), via Azure, $0.11)
  • z-ai/glm-5.3-flash: ok (0 finding(s), 315.3s, 895863+38168 tokens (779520 cached), 15 tool round(s), via Cohere, $0.0599)

Round 2 resolution

  • ✅ r1-1 fixed correctly — Unfenced projection work after authentication expiry or timeout: All three authenticated projection paths now pass an authority fence into updateSupportFollowupRelease. It checks authority after awaited reads and fingerprint preparation, immediately before transaction submission, and before retrying a rejected transaction. Pre-submission timeouts abort authority, preventing abandoned preparation from resuming into a write. Once a transaction is submitted, rec…
  • ✅ r1-5 fixed correctly — Authenticated metadata check hardcodes owner login pegma-dev instead of the configured organization authority: Repository metadata verification no longer requires owner.login === 'pegma-dev'; it verifies the immutable configured organization ID while retaining the repository-ID, public-visibility, and organization-type checks. A regression test confirms reconciliation succeeds after the organization's display login changes. Metadata failures also now retain their own classification and response facts.
  • 10 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is risk).
  • Open findings after this round: 0 (0 bug-severity).

No structured findings from the successful lane(s).

Workflow run

@FlyOverCoderKY
FlyOverCoderKY merged commit dfdd635 into main Nov 14, 2026
2 checks passed
@FlyOverCoderKY
FlyOverCoderKY deleted the codex/catalog-read-auth-20261114 branch November 14, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant