Skip to content

fix(cli): reject prototype agent profile names - #507

Merged
JSONbored merged 1 commit into
mainfrom
codex/fix-agent-profile-prototype-bypass-validation
Jun 10, 2026
Merged

fix(cli): reject prototype agent profile names#507
JSONbored merged 1 commit into
mainfrom
codex/fix-agent-profile-prototype-bypass-validation

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • Fix a CLI validation bug where inherited prototype properties like __proto__ or constructor could be accepted as agent profiles and lead to malformed JSON or runtime TypeError crashes.
  • Ensure agent profile resolution only accepts explicit registry keys to avoid accidental or malicious use of prototype names.

Description

  • Replace plain bracket lookup in resolveAgentProfile with an own-property check using Object.hasOwn(AGENT_PROFILES, id) and then return AGENT_PROFILES[id] in packages/gittensory-mcp/bin/gittensory-mcp.js.
  • Extend the unit test it("rejects unsupported agent profiles") in test/unit/mcp-cli.test.ts to assert that unsupported names including __proto__ and constructor are rejected in both plain and --json output modes.
  • The change preserves existing error behavior and message when an unsupported profile is supplied.

Testing

  • Ran npm run build:mcp which completed successfully.
  • Ran targeted test npx vitest run test/unit/mcp-cli.test.ts -t "rejects unsupported agent profiles" which passed.
  • Ran the full unit test file npx vitest run test/unit/mcp-cli.test.ts and all tests passed (52 passed, 0 failed for the suite run during verification).
  • Manual CLI checks confirmed node packages/gittensory-mcp/bin/gittensory-mcp.js init-client --print codex --agent-profile __proto__ --json and --agent-profile constructor now exit with an error and print Unsupported agent profile: ... as expected.

Codex Task

@ghost

ghost commented Jun 9, 2026

Copy link
Copy Markdown

Note

Gittensory Gate skipped

PR closed before full evaluation. No late first comment was created.

Signal Result Evidence Action
Gate result ⚠️ Skipped #507 is no longer open. No action.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

@ghost ghost added the gittensory:reviewed label Jun 9, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gittensory-ui a91f3c5 Commit Preview URL

Branch Preview URL
Jun 10 2026, 08:07 AM

@JSONbored JSONbored self-assigned this Jun 10, 2026
@JSONbored JSONbored changed the title Reject prototype agent profile names fix(cli): Reject prototype agent profile names Jun 10, 2026
@github-actions github-actions Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jun 10, 2026
@JSONbored
JSONbored force-pushed the codex/fix-agent-profile-prototype-bypass-validation branch from bda0976 to a91f3c5 Compare June 10, 2026 08:06
@JSONbored JSONbored changed the title fix(cli): Reject prototype agent profile names fix(cli): reject prototype agent profile names Jun 10, 2026
@JSONbored
JSONbored merged commit 9a03a9e into main Jun 10, 2026
11 checks passed
@JSONbored
JSONbored deleted the codex/fix-agent-profile-prototype-bypass-validation branch June 10, 2026 08:08
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 10, 2026
@JSONbored JSONbored added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jun 10, 2026
@github-actions github-actions Bot mentioned this pull request Jun 10, 2026
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant