Skip to content

test(coverage): measure bounded credential request helpers - #397

Closed
seonghobae wants to merge 7 commits into
mainfrom
quality/credential-core-coverage-slice
Closed

test(coverage): measure bounded credential request helpers#397
seonghobae wants to merge 7 commits into
mainfrom
quality/credential-core-coverage-slice

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Purpose

Advance #84 from current protected main a634066feb6ace12da2f305fe0e2691a15240997 without pretending the remaining credential/OIDC core is fully covered.

This bounded slice removes validateRepositoryName and parseExchangeRequestBody from the broad Region B V8 exclusion while leaving the cryptographic, GitHub App, replay, and token-minting portions fail-closed and unchanged.

Test-first lineage

  • 2b59db4ec99aa675574d60c4a2b93539d617642c extends the existing exclusion contract so these two owned production helpers may no longer be hidden by a broad v8 ignore region. On its parent source this is RED.
  • 4d8b42ff654ab9a6f28b86bf4e5666d42c74adea narrows only the V8 exclusion boundaries around validateRepositoryName and parseExchangeRequestBody; product behavior is unchanged.
  • After fix(security): harden maintainer readiness token capability reads #395 integrated, 58d4f610c991d11a0078527d6b46953b46386b8e non-destructively restacks the branch on protected main a634066feb6ace12da2f305fe0e2691a15240997. Fresh comparison is ahead-only, zero behind, and contains only src/index.ts plus the exclusion-contract test.

Existing public Worker tests exercise real signed OIDC exchange paths, non-string target repositories, successful target validation, and bounded JSON handling. Exact 100% coverage still must be proven by fresh CI on this exact head; no predecessor or configured-only coverage result is promoted.

Current exact-head evidence

Fresh runs for 58d4f610c991d11a0078527d6b46953b46386b8e are application CI 31950844564, reviewer-ci 31950844570, and central Security Scan 31950844623. They are currently pending/queued and therefore non-passing. This PR remains Draft until exact-head coverage and current findings justify promotion.

Boundaries

This PR does not weaken coverage thresholds, export private helpers merely for testing, change credential authorization, alter replay-before-token-mint ordering, change GitHub App permissions, or claim #84 complete. The remaining broad security-core exclusions require later test-first reduction using exact coverage evidence rather than another broad ignore.

Related: #84.

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 103b3824-299d-4d40-bdf2-0a5137c7565f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do not merge this draft at 3d4f87b. The coverage slice is the right #84 increment — validateRepositoryName and parseExchangeRequestBody are measured, and ContextualWisdomLab/.. is rejected before GitHub App work — but the published contract still tells integrators that owner/.. is valid.

Use #399 instead. That head keeps this slice and adds the missing buyer-facing repair:

  • owner and name . / .. are both 400 ERR_VALIDATION_INPUT before private-key use (.github stays valid)
  • openapi.json, docs/api-spec.md, docs/api-stability-contract.md, and CHANGELOG.md Unreleased match that rule
  • src/index.ts trailing newline is restored
  • realistic cases cover ContextualWisdomLab/., ../noema, and ./noema with zero api.github.com egress

Local Node 24.19.0 on #399: npm run typecheck and npm test — 1515 tests, 100% statements/branches/functions/lines. #84 stays open; remaining credential/OIDC/GitHub App exclusions are still uncounted.

Next action: close or abandon this draft after #399 is the coverage-slice carrier. Send only ContextualWisdomLab/<repository> from callers — never . or .. path segments.

Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

Comment thread src/index.ts
}
const [owner] = repository.split("/", 1);
const [owner, name] = repository.split("/", 2);
if (/^\.{1,2}$/.test(name)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This only rejects a . / .. name. ../noema and ./noema still pass the owner/name regex and fall through to the org allowlist as 403 ERR_REPO_NOT_ALLOWED.

That is fail-closed today, but the published OpenAPI pattern still accepts those strings, and #/repos/${repository}/installation is the path this helper is supposed to keep off GitHub App work.

#399 rejects both segments with the same 400 ERR_VALIDATION_INPUT and publishes ^(?!\.{1,2}/)[A-Za-z0-9_.-]+/(?!\.{1,2}$)[A-Za-z0-9_.-]+$. Keep .github allowed.

Comment thread src/index.ts
}
},
};
}; No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This commit strips the trailing newline (\\ No newline at end of file). Restore it — #399 does. Do not land a security-core file with a missing EOF newline.

"content-type": "application/json",
"cf-connecting-ip": "203.0.113.105",
},
body: JSON.stringify({ target_repository: "ContextualWisdomLab/.." }),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is the only dot-segment case. Add ContextualWisdomLab/., ../noema, and ./noema so the public Worker contract matches both segments and both . / .. values. #399 uses it.each for those four inputs and still asserts zero api.github.com egress.

Copy link
Copy Markdown
Contributor Author

Superseded by #400 through a fully preserved descendant chain. Exact ancestry: #397 head 3d4f87b97d77593df0daae6f1b6f6617a1bdd008#399 8a0abeca906ab91b9bb0c6e86d4139403f2b9bdb (ahead 2 / behind 0) → #400 0caea38148f937dc155a218c909475ac50ddeb31 (ahead 1 / behind 0). #400 carries this coverage slice plus the fail-closed dot-segment behavior and RE2-safe buyer-facing schema contract. No unique #397 delta is discarded.

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