Skip to content

Some endpoints ignore specified account and use auth account instead #26234

Closed
@lonix1

Description

@lonix1

Description

Reproduction:

  • I created an access token at the /api/v1/users/bob/tokens endpoint, using basic auth with my admin account.
  • I expected the access token to be created for bob, but it was actually created for admin.
  • the same is true for other related endpoints

This was very surprising and took a while to debug. Is it a bug or by design?

If it's a bug (I think it is), then this issue will track it.

If it's by design:

  • It's common to use an admin account to interact with an app, even when managing other users' accounts. So this behaviour is very surprising.
  • I specified that I wanted to act on the bob account, not the admin account.
  • If this cannot be fixed/changed, then at least those API endpoints should return errors. If it will ignore the account that I specified and use the authenticating account instead, it must return an error rather than perform an action I didn't request.
  • The docs should reflect this weird behaviour (I looked but couldn't find anything).

Thanks!

Gitea Version

1.20.2

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

n/a

Screenshots

n/a

Git Version

n/a

Operating System

n/a

How are you running Gitea?

docker

Database

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions