-
Notifications
You must be signed in to change notification settings - Fork 0
Codex-generated pull request #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
GsCommand
merged 2 commits into
main
from
codex/review-and-rewrite-readme-for-documentation-5tftkj
Feb 15, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| checks: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: npm | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Syntax check | ||
| run: npm run check | ||
|
|
||
| - name: Smoke tests | ||
| run: npm test |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| import assert from 'node:assert/strict'; | ||
| import { spawn } from 'node:child_process'; | ||
| import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'; | ||
| import { tmpdir } from 'node:os'; | ||
| import { join } from 'node:path'; | ||
| import { randomBytes } from 'node:crypto'; | ||
| import { execFileSync } from 'node:child_process'; | ||
|
|
||
| const PORT = 19080; | ||
| const base = `http://127.0.0.1:${PORT}`; | ||
|
|
||
| function b64File(path) { | ||
| return readFileSync(path).toString('base64'); | ||
| } | ||
|
|
||
| function sleep(ms) { | ||
| return new Promise((resolve) => setTimeout(resolve, ms)); | ||
| } | ||
|
|
||
| async function waitForHealth(timeoutMs = 7000) { | ||
| const start = Date.now(); | ||
| while (Date.now() - start < timeoutMs) { | ||
| try { | ||
| const r = await fetch(`${base}/health`); | ||
| if (r.ok) return; | ||
| } catch {} | ||
| await sleep(120); | ||
| } | ||
| throw new Error('server did not become healthy in time'); | ||
| } | ||
|
|
||
| const tmp = mkdtempSync(join(tmpdir(), 'runtime-test-')); | ||
| const priv = join(tmp, 'private.pem'); | ||
| const pub = join(tmp, 'public.pem'); | ||
|
|
||
| try { | ||
| execFileSync('openssl', ['genpkey', '-algorithm', 'Ed25519', '-out', priv], { stdio: 'ignore' }); | ||
| execFileSync('openssl', ['pkey', '-in', priv, '-pubout', '-out', pub], { stdio: 'ignore' }); | ||
|
|
||
| const env = { | ||
| ...process.env, | ||
| PORT: String(PORT), | ||
| RECEIPT_SIGNING_PRIVATE_KEY_PEM_B64: b64File(priv), | ||
| RECEIPT_SIGNING_PUBLIC_KEY_PEM_B64: b64File(pub), | ||
| RECEIPT_SIGNER_ID: 'runtime.test', | ||
| DEBUG_ROUTES_ENABLED: '1', | ||
| DEBUG_BEARER_TOKEN: 'secret-token', | ||
| REQUEST_SCHEMA_VALIDATION: '0', | ||
| CORS_ALLOW_ORIGINS: 'http://allowed.local', | ||
| }; | ||
|
|
||
| const server = spawn('node', ['server.mjs'], { | ||
| env, | ||
| stdio: ['ignore', 'pipe', 'pipe'], | ||
| }); | ||
|
|
||
| let logs = ''; | ||
| server.stdout.on('data', (d) => (logs += d.toString())); | ||
| server.stderr.on('data', (d) => (logs += d.toString())); | ||
|
|
||
| try { | ||
| await waitForHealth(); | ||
|
|
||
| // signer readiness | ||
| const healthResp = await fetch(`${base}/health`); | ||
| assert.equal(healthResp.ok, true); | ||
| const health = await healthResp.json(); | ||
| assert.equal(health.ok, true); | ||
| assert.equal(health.signer_ok, true); | ||
|
|
||
| // verb execution | ||
| const verbResp = await fetch(`${base}/describe/v1.0.0`, { | ||
| method: 'POST', | ||
| headers: { 'content-type': 'application/json' }, | ||
| body: JSON.stringify({ | ||
| x402: { entry: 'x402://describeagent.eth/describe/v1.0.0', verb: 'describe', version: '1.0.0' }, | ||
| input: { subject: 'CommandLayer', detail_level: 'short' }, | ||
| }), | ||
| }); | ||
| assert.equal(verbResp.ok, true); | ||
| const receipt = await verbResp.json(); | ||
| assert.equal(receipt.status, 'success'); | ||
| assert.ok(receipt.metadata?.proof?.signature_b64); | ||
|
|
||
| // verify pass path | ||
| const verifyResp = await fetch(`${base}/verify`, { | ||
| method: 'POST', | ||
| headers: { 'content-type': 'application/json' }, | ||
| body: JSON.stringify(receipt), | ||
| }); | ||
| assert.equal(verifyResp.ok, true); | ||
| const verify = await verifyResp.json(); | ||
| assert.equal(verify.ok, true); | ||
| assert.equal(verify.checks.signature_valid, true); | ||
| assert.equal(verify.checks.hash_matches, true); | ||
|
|
||
| // verify fail path (tamper hash) | ||
| const tampered = structuredClone(receipt); | ||
| tampered.metadata.proof.hash_sha256 = randomBytes(32).toString('hex'); | ||
| const badVerifyResp = await fetch(`${base}/verify`, { | ||
| method: 'POST', | ||
| headers: { 'content-type': 'application/json' }, | ||
| body: JSON.stringify(tampered), | ||
| }); | ||
| assert.equal(badVerifyResp.ok, true); | ||
| const badVerify = await badVerifyResp.json(); | ||
| assert.equal(badVerify.ok, false); | ||
| assert.equal(badVerify.checks.hash_matches, false); | ||
|
|
||
| // debug route auth | ||
| const debugNoToken = await fetch(`${base}/debug/env`); | ||
| assert.equal(debugNoToken.status, 401); | ||
|
|
||
| const debugWithToken = await fetch(`${base}/debug/env`, { | ||
| headers: { authorization: 'Bearer secret-token' }, | ||
| }); | ||
| assert.equal(debugWithToken.ok, true); | ||
| const debug = await debugWithToken.json(); | ||
| assert.equal(debug.debug_routes_enabled, true); | ||
| assert.equal(debug.cors.allow_origins.includes('http://allowed.local'), true); | ||
| } finally { | ||
| server.kill('SIGTERM'); | ||
| await sleep(150); | ||
| if (!server.killed) server.kill('SIGKILL'); | ||
| } | ||
| } catch (err) { | ||
| writeFileSync('/tmp/runtime-smoke-failure.log', String(err?.stack || err)); | ||
| throw err; | ||
| } finally { | ||
| rmSync(tmp, { recursive: true, force: true }); | ||
| } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
originAllowedonly accepts requests with noOriginheader or an explicit allowlist match, so with the default emptyCORS_ALLOW_ORIGINSany request that includesOriginis rejected at middleware with 403. This breaks legitimate same-origin browser calls that still sendOrigin(commonly non-GET fetch/XHR), so a default deployment can fail browser traffic even when frontend and API share the same host.Useful? React with 👍 / 👎.