Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c9f7a178
Commit
c9f7a178
authored
Jul 13, 2021
by
Mathieu Parent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add PyPI package endpoints for project and group path (escaped)
Changelog: added
parent
7dfd9546
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
doc/user/packages/pypi_repository/index.md
doc/user/packages/pypi_repository/index.md
+8
-3
lib/api/pypi_packages.rb
lib/api/pypi_packages.rb
+2
-2
spec/requests/api/pypi_packages_spec.rb
spec/requests/api/pypi_packages_spec.rb
+12
-0
No files found.
doc/user/packages/pypi_repository/index.md
View file @
c9f7a178
...
@@ -181,7 +181,9 @@ username = <your_personal_access_token_name>
...
@@ -181,7 +181,9 @@ username = <your_personal_access_token_name>
password
=
<your_personal_access_token>
password
=
<your_personal_access_token>
```
```
-
Your project ID is on your project's home page.
The
`<project_id>`
is either the project's
[
URL-encoded
](
../../../api/index.md#namespaced-path-encoding
)
path (for example,
`group%2Fproject`
), or the project's ID (for example
`42`
).
### Authenticate with a deploy token
### Authenticate with a deploy token
...
@@ -198,7 +200,9 @@ username = <deploy token username>
...
@@ -198,7 +200,9 @@ username = <deploy token username>
password
=
<deploy token>
password
=
<deploy token>
```
```
Your project ID is on your project's home page.
The
`<project_id>`
is either the project's
[
URL-encoded
](
../../../api/index.md#namespaced-path-encoding
)
path (for example,
`group%2Fproject`
), or the project's ID (for example
`42`
).
### Authenticate with a CI job token
### Authenticate with a CI job token
...
@@ -335,7 +339,8 @@ pip install --index-url https://<personal_access_token_name>:<personal_access_to
...
@@ -335,7 +339,8 @@ pip install --index-url https://<personal_access_token_name>:<personal_access_to
-
`<package_name>`
is the package name.
-
`<package_name>`
is the package name.
-
`<personal_access_token_name>`
is a personal access token name with the
`read_api`
scope.
-
`<personal_access_token_name>`
is a personal access token name with the
`read_api`
scope.
-
`<personal_access_token>`
is a personal access token with the
`read_api`
scope.
-
`<personal_access_token>`
is a personal access token with the
`read_api`
scope.
-
`<project_id>`
is the project ID.
-
`<project_id>`
is either the project's
[
URL-encoded
](
../../../api/index.md#namespaced-path-encoding
)
path (for example,
`group%2Fproject`
), or the project's ID (for example
`42`
).
In these commands, you can use
`--extra-index-url`
instead of
`--index-url`
. However, using
In these commands, you can use
`--extra-index-url`
instead of
`--index-url`
. However, using
`--extra-index-url`
makes you vulnerable to dependency confusion attacks because it checks the PyPi
`--extra-index-url`
makes you vulnerable to dependency confusion attacks because it checks the PyPi
...
...
lib/api/pypi_packages.rb
View file @
c9f7a178
...
@@ -40,7 +40,7 @@ module API
...
@@ -40,7 +40,7 @@ module API
end
end
params
do
params
do
requires
:id
,
type:
Integer
,
desc:
'The ID of a group'
requires
:id
,
type:
String
,
desc:
'The ID of a group'
end
end
resource
:groups
,
requirements:
API
::
NAMESPACE_OR_PROJECT_REQUIREMENTS
do
resource
:groups
,
requirements:
API
::
NAMESPACE_OR_PROJECT_REQUIREMENTS
do
after_validation
do
after_validation
do
...
@@ -96,7 +96,7 @@ module API
...
@@ -96,7 +96,7 @@ module API
end
end
params
do
params
do
requires
:id
,
type:
Integer
,
desc:
'The ID of a project'
requires
:id
,
type:
String
,
desc:
'The ID of a project'
end
end
resource
:projects
,
requirements:
API
::
NAMESPACE_OR_PROJECT_REQUIREMENTS
do
resource
:projects
,
requirements:
API
::
NAMESPACE_OR_PROJECT_REQUIREMENTS
do
...
...
spec/requests/api/pypi_packages_spec.rb
View file @
c9f7a178
...
@@ -38,6 +38,12 @@ RSpec.describe API::PypiPackages do
...
@@ -38,6 +38,12 @@ RSpec.describe API::PypiPackages do
end
end
it_behaves_like
'deploy token for package GET requests'
it_behaves_like
'deploy token for package GET requests'
context
'with group path as id'
do
let
(
:url
)
{
"/groups/
#{
CGI
.
escape
(
group
.
full_path
)
}
/-/packages/pypi/simple/
#{
package
.
name
}
"
}
it_behaves_like
'deploy token for package GET requests'
end
end
end
context
'job token'
do
context
'job token'
do
...
@@ -61,6 +67,12 @@ RSpec.describe API::PypiPackages do
...
@@ -61,6 +67,12 @@ RSpec.describe API::PypiPackages do
it_behaves_like
'rejects PyPI access with unknown project id'
it_behaves_like
'rejects PyPI access with unknown project id'
it_behaves_like
'deploy token for package GET requests'
it_behaves_like
'deploy token for package GET requests'
it_behaves_like
'job token for package GET requests'
it_behaves_like
'job token for package GET requests'
context
'with project path as id'
do
let
(
:url
)
{
"/projects/
#{
CGI
.
escape
(
project
.
full_path
)
}
/packages/pypi/simple/
#{
package
.
name
}
"
}
it_behaves_like
'deploy token for package GET requests'
end
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment