Static demo of the Cloudzilla UI. Sample data, nothing is saved. All screens cloudzilla.dev

cloudzilla Pull requests #341

Add OAuth scopes to access tokens #341

Open Draft Merged

@daisy wants to merge 3 commits into main from daisy/oauth-scopes

@malith merged 3 commits into main from daisy/oauth-scopes

This pull request is still a work in progress. Merge is blocked until it is marked ready for review.

D @daisy opened this pull request Author

Adds OAuth scope support to access tokens (PATs). Closes #298.

What changed:

  • New access_token_scopes table with FK to access_tokens
  • UI checkboxes for scope selection on token creation page
  • Middleware enforces scope on every API request
  • Token list shows scope badges

How to test:

make migrate
make dev
# Create a token at /settings/tokens with scope=repo:read only
curl -H "Authorization: Bearer $TOKEN" /api/repos
# Should 200. Then try POST — should 403.

Reviewers: this is the first time we're enforcing scopes, so the middleware change is the riskiest part.

  1. malith added the label feature

  2. malith assigned daisy

  3. M malith commented

    Nice work. One question on the middleware — if a token has no scopes assigned (legacy tokens), do we treat that as "all scopes" or "no scopes"? Right now internal/middleware/auth.go:88 reads like "all scopes" but I want to be sure.

  4. review-bot bot Changes requested

    internal/middleware/auth.go:88 treats a token with no scopes as having every scope. Tokens created before this change would keep full access without anyone choosing that.
  5. M mkappworks commented

    Good catch. Please fix it with this migration:

    UPDATE access_tokens SET scopes = '*' WHERE scopes = '';
  6. review-bot bot Approved

  7. malith merged this pull request (3 commits)

Reviewed the changes? Approve, request changes or leave a summary.

You can reply to review comments, but not approve your own pull request.

Ready to merge

This branch has no conflicts with the base and can be merged.

  • 3 commits ahead, 2 behind the base branch
  • All 6 required checks passed
  • All 1 required review approved
  • This branch has no conflicts with main
The head branch is behind and lives in another repository: update it there.

Ready, waiting for a maintainer

Nothing blocks this pull request. Someone with write access can merge it.

  • 3 commits ahead, 2 behind the base branch
  • All 6 required checks passed
  • All 1 required review approved
  • This branch has no conflicts with main

Only collaborators with write access can merge or close this pull request.

Review required

1 of 2 required reviews approved.

  • 3 commits ahead, 0 behind the base branch
  • All 6 required checks passed
  • 1 of 2 required reviews approved
  • This branch has no conflicts with main

Only collaborators with write access can merge or close this pull request.

Waiting on checks

4 of 6 required checks passed.

  • 3 commits ahead, 0 behind the base branch
  • 4 of 6 required checks passed
  • All 1 required review approved
  • This branch has no conflicts with main

Only collaborators with write access can merge or close this pull request.

Checks failing

2 required checks failed. Fix them and push before this can merge.

  • 3 commits ahead, 0 behind the base branch
  • 4 of 6 required checks passed
  • All 1 required review approved
  • This branch has no conflicts with main

Only collaborators with write access can merge or close this pull request.

Changes requested

A reviewer asked for changes. Merging is blocked until they approve or the review is dismissed.

  • 3 commits ahead, 0 behind the base branch
  • All 6 required checks passed
  • 0 of 1 required review approved
  • Changes requested by ada-silva
  • This branch has no conflicts with main

Only collaborators with write access can merge or close this pull request.

Merge conflicts

Resolve the conflicts on the head branch before this can merge.

  • 3 commits ahead, 0 behind the base branch
  • All 6 required checks passed
  • All 1 required review approved
  • This branch has conflicts with main

Resolve the conflicts on your machine

Merge main into daisy/oauth-scopes locally, fix the conflicted files and push. If this page doesn't update, check again.

git fetch origin
git switch daisy/oauth-scopes
git merge origin/main
# fix the conflicted files, then
git add <files>
git commit
git push origin daisy/oauth-scopes

Only collaborators with write access can merge or close this pull request.

Review required

1 of 2 required reviews approved.

  • 3 commits ahead, 0 behind the base branch
  • All 6 required checks passed
  • 1 of 2 required reviews approved
  • This branch has no conflicts with main

Auto-merge is on (squash and merge), armed by @malith. It merges once the requirements are met.

Only collaborators with write access can merge or close this pull request.

Draft

Mark this ready for review to notify reviewers and allow merging.

  • 3 commits ahead, 0 behind the base branch
  • All 6 required checks passed
  • All 1 required review approved
  • This branch has no conflicts with main

Only collaborators with write access can merge or close this pull request.

M Add a comment

Markdown supported · drop files to attach

Close this pull request?

Close pull request #341 — Add OAuth scopes to access tokens. You can reopen it later if needed.

Review changes

Line comments you add on the Files tab are posted as you write them. This adds your summary and verdict to #341.

A comment needs a summary.

You opened this pull request, so you can only comment on it.

Dismiss review

Clears the request for changes from ada-silva so it no longer blocks the merge. Your name and reason show on the review and in the audit log.

Confirm merge

Squash and merge into main.