mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Require repo scope for PATs for private repos and basic authentication (#24362)
> The scoped token PR just checked all API routes but in fact, some web routes like `LFS`, git `HTTP`, container, and attachments supports basic auth. This PR added scoped token check for them. --------- Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
		@@ -16,6 +16,7 @@ import (
 | 
			
		||||
	"testing"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	auth_model "code.gitea.io/gitea/models/auth"
 | 
			
		||||
	"code.gitea.io/gitea/models/db"
 | 
			
		||||
	"code.gitea.io/gitea/models/packages"
 | 
			
		||||
	"code.gitea.io/gitea/models/unittest"
 | 
			
		||||
@@ -74,7 +75,7 @@ func TestPackageNuGet(t *testing.T) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
 | 
			
		||||
	token := getUserToken(t, user.Name)
 | 
			
		||||
	token := getUserToken(t, user.Name, auth_model.AccessTokenScopePackage)
 | 
			
		||||
 | 
			
		||||
	packageName := "test.package"
 | 
			
		||||
	packageVersion := "1.0.3"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user