0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-10 14:01:54 +02:00
This commit is contained in:
Excellencedev 2025-12-24 06:26:31 +01:00
parent 43279bfb8b
commit ebf7e2ea8c

View File

@ -384,11 +384,11 @@ func TestActionsCrossRepoAccess(t *testing.T) {
assert.Equal(t, content, resp.Body.Bytes(), "Should be able to read package from other repo in same org")
// Try to upload a package to org with task token from repo-A (cross-repo write)
// Cross-repo access should be read-only, so this should fail
// Cross-repo access should be read-only, write attempts return 401 Unauthorized
writePackageURL := fmt.Sprintf("/api/packages/%s/generic/%s/%s/write-test.bin", orgName, packageName, packageVersion)
writeReq := NewRequestWithBody(t, "PUT", writePackageURL, bytes.NewReader(content))
writeReq.Header.Set("Authorization", "Bearer "+task.Token)
MakeRequest(t, writeReq, http.StatusForbidden)
MakeRequest(t, writeReq, http.StatusUnauthorized)
})
})
}