mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-02 02:30:43 +01:00
fix(auth): honor responsible-user grants for company skills (#9571)
## Thinking Path > - Paperclip is the open source control plane people use to manage AI-agent companies > - Company skills are governed resources, so board users and agents acting for responsible users must be authorized consistently before mutating skill configuration > - The responsible-user authorization intersection handled several task permissions but did not map company-skill mutation actions to the corresponding `skills:create`, `skills:update`, and `skills:delete` grants > - That gap caused valid skill import and mutation requests to be rejected even when the responsible user held the exact direct permission required by the route > - The branch also introduces the repo-sourced `prepare-paperclip-pr` skill so the standard PR preparation process is versioned and reviewable alongside the code > - This pull request adds the missing authorization mappings, covers board, agent, JWT-route, and denial behavior with regression tests, and adds the renamed PR-preparation skill > - The benefit is that governed company-skill workflows honor explicit grants without weakening the responsible-user permission intersection ## Linked Issues or Issue Description No public issue exists. Bug-report shape: - **Affected area**: company skill authorization and skill import routes - **Observed behavior**: agents acting under a responsible user could receive `403` responses for company-skill mutations even when that user had the matching direct `skills:create`, `skills:update`, or `skills:delete` grant - **Expected behavior**: the responsible-user authorization intersection should accept exact company-skill grants while preserving denials for missing or unrelated grants - **Reproduction**: authenticate as an agent with a responsible user, grant that user the relevant company-skill permission, then import or mutate a company skill - **Additional repository change**: adds the renamed `prepare-paperclip-pr` skill as the versioned source of truth for PR preparation Supersedes #9324, which added the PR-preparation skill under the old `prepare-pr` name. ## What Changed - Added `.agents/skills/prepare-paperclip-pr/SKILL.md` with the standard worktree, commit, rebase, guardrail, review-loop, and handoff procedure - Mapped company `skill_config:create`, `skill_config:update`, and `skill_config:delete` actions to direct `skills:create`, `skills:update`, and `skills:delete` responsible-user grants - Preserved restrictive behavior for unsupported resources, missing grants, and unrelated permissions - Added authorization-service regression coverage for board actors and responsible-user agent intersections - Added route-level JWT regression coverage for company skill imports, including allowed and denied cases ## Verification - `pnpm exec vitest run server/src/__tests__/authorization-service.test.ts server/src/__tests__/company-skills-import-authz-routes.test.ts` — 42 tests passed - `pnpm -r typecheck` — passed - `pnpm build` — passed - `pnpm test:run` — server and UI groups passed; one unrelated CLI doctor assertion failed because the execution environment injects static `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY`, which intentionally changes the result from `pass` to `warn` - `env -u AWS_ACCESS_KEY_ID -u AWS_SECRET_ACCESS_KEY NODE_ENV=development pnpm exec vitest run cli/src/__tests__/secrets.test.ts -t 'passes AWS doctor checks when non-secret provider config is present'` — passed, confirming the full-suite failure is environment-specific - GitHub CI — all required checks passed on head `0758393c`; one unrelated `packages/db/src/client.test.ts` 5-second timing timeout passed on the single allowed failed-job rerun after three consecutive local passes (42/42 tests) ## Risks - Low-to-moderate authorization risk: the change expands accepted responsible-user grants only for company-scoped skill configuration actions and is protected by explicit allow/deny regression cases - No database migrations, workflow changes, lockfile changes, or UI changes - The added skill is documentation consumed by agent tooling and does not alter runtime application behavior > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - OpenAI Codex coding agent; exact runtime model ID and context-window size were not exposed to the session. Used reasoning, terminal execution, Git/GitHub tooling, and test/build execution. - Earlier commits were assisted by Claude Fable 5 (`claude-fable-5`) and an OpenAI Codex coding agent, as recorded in the branch history/task workflow. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and documented the one environment-specific full-suite failure - GitHub CI — all required checks passed on head `0758393c`; one unrelated `packages/db/src/client.test.ts` 5-second timing timeout passed on the single allowed failed-job rerun after three consecutive local passes (42/42 tests) - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
7947308276
commit
ea66ea81e6
4 files changed
+432
-15
No files matched your search
@@ -0,0 +1,85 @@
|
||||
---
|
||||
name: prepare-paperclip-pr
|
||||
description: Prepare a Paperclip branch for PR with commits, template body, and checks.
|
||||
---
|
||||
# Prepare Paperclip PR
|
||||
|
||||
The standard Paperclip procedure for turning branch work into a reviewed,
|
||||
green pull request against `paperclipai/paperclip` master. Apply it once per
|
||||
PR (if a task splits a branch into several PRs, run the whole procedure for
|
||||
each one).
|
||||
|
||||
## 0. Preconditions — worktree safety
|
||||
|
||||
* Do all PR work in a **git worktree** on a dedicated branch. The main
|
||||
`~/paperclip` checkout typically runs the live Paperclip server — never
|
||||
check out branches there. If you are already on a worktree/branch, verify it
|
||||
(`git rev-parse --git-dir`, `git branch --show-current`) and proceed.
|
||||
* If the main checkout is unexpectedly off `master`, fix that first without
|
||||
losing work (usually: move that branch's work into a worktree).
|
||||
* Confirm which remote/ref you are targeting (normally `master` on the
|
||||
`paperclipai/paperclip` repo; the task may name a specific remote such as
|
||||
`origin` or `public-gh`).
|
||||
|
||||
## 1. Commit everything — lose no work
|
||||
|
||||
* Make **logical commits** of all uncommitted changes before anything else.
|
||||
Do not stash and forget; do not leave files behind. If commits are missing,
|
||||
make them.
|
||||
* Commit messages must end with exactly:
|
||||
`Co-Authored-By: Paperclip <noreply@paperclip.ing>`
|
||||
|
||||
## 2. Get changes cleanly on top of master
|
||||
|
||||
* Fetch the target remote and rebase (or otherwise replay) your branch on top
|
||||
of the target master so the PR has no merge conflicts.
|
||||
* Re-verify after rebase: build/tests relevant to the change still pass at
|
||||
whatever depth the task warrants.
|
||||
|
||||
## 3. Guardrails checklist (every PR)
|
||||
|
||||
* **Never commit `pnpm-lock.yaml`** — the repo has actions that manage it.
|
||||
If it is already in a commit, rewrite/drop that change before pushing.
|
||||
* **Never change `.github/workflows/*`** unless the underlying commit was
|
||||
explicitly about that and the task calls it out.
|
||||
* **No design screenshots / wireframe images** committed to the repo unless
|
||||
they are genuinely part of the work product.
|
||||
* **Migrations**: numbered incrementally with no conflicts against master. If
|
||||
master moved and took your number, renumber on top. Make migrations
|
||||
**idempotent** so users who already applied the old number are safe.
|
||||
* **Greptile file limit**: keep each PR under **100 changed files**; if a PR
|
||||
exceeds that, split it into two.
|
||||
|
||||
## 4. Open the PR
|
||||
|
||||
* Follow `CONTRIBUTING.md` (repo root,
|
||||
https://github.com/paperclipai/paperclip/blob/master/CONTRIBUTING.md) for
|
||||
the PR title, message format, and issue description.
|
||||
* Push the branch and open the PR with `gh`.
|
||||
* Record the PR URL immediately — every report must include URLs to every PR.
|
||||
|
||||
## 5. Review loops
|
||||
|
||||
* Run the **/greploop** company skill: trigger Greptile review, address its
|
||||
comments, push, and repeat until Greptile gives **5/5 with zero unresolved
|
||||
comments** (max 20 turns). Do not stop early while turns remain.
|
||||
* Then run the **/prcheckloop** company skill and address any verification /
|
||||
CI failures you can.
|
||||
* RUN GREPTILE UNTIL IT GETS TO 5/5 - DO NOT STOP UNTIL GREPTILE IS 5/5, all
|
||||
tests pass, all verification checks pass, and there are no merge conflicts.
|
||||
|
||||
## 6. Report back and hand off
|
||||
|
||||
* Comment on the driving task: what you did, the PR URL(s), the worktree path
|
||||
(use `~` for home), Greptile score, and check status.
|
||||
* Create a `pull_request` work product for each opened PR (plus `branch` /
|
||||
`commit` work products where the branch or a commit is itself the handoff).
|
||||
* If the task requires follow-up per PR (e.g. sub-issues per PR), create them
|
||||
as the task directs and link them.
|
||||
|
||||
## Hard rules
|
||||
|
||||
* **YOU DO NOT MERGE THE PR YOURSELF. NEVER MERGE THE PR YOURSELF.**
|
||||
* Never lose work: no orphaned stashes, no dropped files, no force-pushes
|
||||
that discard commits.
|
||||
* Always post the URLs to every pull request you created.
|
||||
Reference in new issue
Block a user