yearn / yearn/cms

Restrict /api/pr file paths to packages/cdn/**

Open
#161 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
0
Forks
3
Avg merge
7h 28m
Merged PRs (30d)
5

Description

Summary

POST /api/pr will create a GitHub PR for any path the caller sends. The only real control is whether that GitHub token can push yearn/cms.

What happens

packages/app/src/server/pr.ts takes path / changes[].path from the JSON body and writes blobs + a tree with those paths. There is no allowlist. A token with write access could therefore propose changes under .github/** or other non-CDN paths, not only vault/strategy JSON.

Unauthenticated requests fail before any GitHub ref is created (token required). Random public_repo users still cannot push yearn/cms. This is defense in depth for stolen or overly-broad collaborator tokens (see the OAuth token-in-URL issue).

Suggested fix

  • Accept only paths under packages/cdn/.
  • Reject .github/**, workflow files, and anything outside the metadata trees.
  • After the OAuth session moves into a cookie, add CSRF protection (SameSite + a CSRF token) on this route.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/app/src/server/pr.ts and trace how path and changes[].path from POST /api/pr are used to build GitHub blobs and trees. Restrict accepted paths to packages/cdn/**, reject .github and other paths, and verify requests outside the metadata trees fail; treat the later cookie-based CSRF protection as separate follow-up work.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, typescript
Domain
api, backend, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.