Skip to content

Commit 20d9eef

Browse files
authored
Merge branch 'main' into fix/stringio-content-length-warning
2 parents 6800a6b + da9113c commit 20d9eef

File tree

8 files changed

+63
-41
lines changed

8 files changed

+63
-41
lines changed

.github/CODEOWNERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Restrict all files related to deploying to
2+
# require lead maintainer approval.
3+
4+
.github/workflows/ @nateprewitt @sigmavirus24
5+
.github/CODEOWNERS @nateprewitt @sigmavirus24
6+
src/requests/__version__.py @nateprewitt @sigmavirus24
7+
HISTORY.md @nateprewitt @sigmavirus24
8+
pyproject.toml @nateprewitt @sigmavirus24

.github/workflows/lock-issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
if: github.repository_owner == 'psf'
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: dessant/lock-threads@d42e5f49803f3c4e14ffee0378e31481265dda22 # v5.0.0
16+
- uses: dessant/lock-threads@7266a7ce5c1df01b1c6db85bf8cd86c737dadbe7 # v6.0.0
1717
with:
1818
issue-lock-inactive-days: 90
1919
pr-lock-inactive-days: 90

.github/workflows/publish.yml

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
push:
55
tags:
66
- "v*"
7+
workflow_dispatch:
8+
inputs:
9+
test-pypi-only:
10+
description: "Publish to Test PyPI only"
11+
type: boolean
12+
default: true
713

814
permissions:
915
contents: read
@@ -12,41 +18,28 @@ jobs:
1218
build:
1319
name: "Build dists"
1420
runs-on: "ubuntu-latest"
15-
environment:
16-
name: "publish"
1721
outputs:
18-
hashes: ${{ steps.hash.outputs.hashes }}
1922
artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }}
2023

2124
steps:
22-
- name: Harden the runner (Audit all outbound calls)
23-
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
24-
with:
25-
egress-policy: audit
26-
2725
- name: "Checkout repository"
28-
uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd"
26+
uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
2927
with:
3028
persist-credentials: false
3129

3230
- name: "Setup Python"
33-
uses: "actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405"
31+
uses: "actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405" # v6.2.0
3432
with:
3533
python-version: "3.x"
3634

3735
- name: "Install dependencies"
38-
run: python -m pip install build==0.8.0
36+
run: python -m pip install build==1.4.0
3937

4038
- name: "Build dists"
4139
run: |
4240
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) \
4341
python -m build
4442
45-
- name: "Generate hashes"
46-
id: hash
47-
run: |
48-
cd dist && echo "::set-output name=hashes::$(sha256sum * | base64 -w0)"
49-
5043
- name: "Upload dists"
5144
uses: "actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f"
5245
id: upload-artifact
@@ -56,38 +49,47 @@ jobs:
5649
if-no-files-found: error
5750
retention-days: 5
5851

59-
provenance:
60-
needs: [build]
61-
permissions:
62-
actions: read
63-
contents: write
64-
id-token: write # Needed to access the workflow's OIDC identity.
65-
uses: "slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.1.0"
66-
with:
67-
base64-subjects: "${{ needs.build.outputs.hashes }}"
68-
upload-assets: true
69-
compile-generator: true # Workaround for https://github.com/slsa-framework/slsa-github-generator/issues/1163
70-
7152
publish:
7253
name: "Publish"
7354
if: startsWith(github.ref, 'refs/tags/')
74-
needs: ["build", "provenance"]
55+
needs: ["build"]
7556
permissions:
76-
contents: write
7757
id-token: write
7858
runs-on: "ubuntu-latest"
59+
environment:
60+
name: "publish"
7961

8062
steps:
81-
- name: Harden the runner (Audit all outbound calls)
82-
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
63+
- name: "Download dists"
64+
uses: "actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131" # v7.0.0
8365
with:
84-
egress-policy: audit
66+
artifact-ids: ${{ needs.build.outputs.artifact-id }}
67+
path: "dist/"
68+
69+
- name: "Publish dists to PyPI"
70+
uses: "pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e" # v1.13.0
71+
with:
72+
attestations: true
73+
74+
publish-test-pypi:
75+
name: "Publish to Test PyPI"
76+
if: github.event_name == 'workflow_dispatch'
77+
needs: ["build"]
78+
permissions:
79+
id-token: write
80+
runs-on: "ubuntu-latest"
81+
environment:
82+
name: "testpypi"
8583

84+
steps:
8685
- name: "Download dists"
8786
uses: "actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131" # v7.0.0
8887
with:
8988
artifact-ids: ${{ needs.build.outputs.artifact-id }}
9089
path: "dist/"
9190

92-
- name: "Publish dists to PyPI"
93-
uses: "pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e"
91+
- name: "Publish dists to Test PyPI"
92+
uses: "pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e" # v1.13.0
93+
with:
94+
repository-url: https://test.pypi.org/legacy/
95+
attestations: true

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ requires-python = ">=3.10"
1818
dependencies = [
1919
"charset_normalizer>=2,<4",
2020
"idna>=2.5,<4",
21-
"urllib3>=1.21.1,<3",
22-
"certifi>=2017.4.17"
21+
"urllib3>=1.26,<3",
22+
"certifi>=2023.5.7"
2323
]
2424
dynamic = ["version"]
2525

src/requests/__version__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
__title__ = "requests"
66
__description__ = "Python HTTP for Humans."
77
__url__ = "https://requests.readthedocs.io"
8-
__version__ = "2.32.5"
9-
__build__ = 0x023205
8+
__version__ = "2.33.0.dev1"
9+
__build__ = 0x023300
1010
__author__ = "Kenneth Reitz"
1111
__author_email__ = "me@kennethreitz.org"
1212
__license__ = "Apache-2.0"

src/requests/sessions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,8 @@ def __init__(self):
422422
#: expired certificates, which will make your application vulnerable to
423423
#: man-in-the-middle (MitM) attacks.
424424
#: Only set this to `False` for testing.
425+
#: If verify is set to a string, it must be the path to a CA bundle file
426+
#: that will be used to verify the TLS certificate.
425427
self.verify = True
426428

427429
#: SSL client certificate default, if String, path to ssl client

src/requests/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def get_netrc_auth(url, raise_errors=False):
248248

249249
try:
250250
_netrc = netrc(netrc_path).authenticators(host)
251-
if _netrc:
251+
if _netrc and any(_netrc):
252252
# Return with login / password
253253
login_i = 0 if _netrc[0] else 1
254254
return (_netrc[login_i], _netrc[2])

tests/test_utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,16 @@ def test_not_vulnerable_to_bad_url_parsing(self, tmp_path, monkeypatch):
194194
auth = get_netrc_auth("http://example.com:@evil.com/&apos;")
195195
assert auth is None
196196

197+
def test_empty_default_credentials_ignored(self, tmp_path, monkeypatch):
198+
"""Empty default credentials should not be returned."""
199+
netrc_path = tmp_path / ".netrc"
200+
monkeypatch.setenv("NETRC", str(netrc_path))
201+
with open(netrc_path, "w") as f:
202+
f.write("machine example.com login user password pass\ndefault\n")
203+
204+
auth = get_netrc_auth("http://httpbin.org/")
205+
assert auth is None
206+
197207

198208
class TestToKeyValList:
199209
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)