Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw an exception in case of access denied #138

Merged
merged 3 commits into from
Oct 18, 2023
Merged

Throw an exception in case of access denied #138

merged 3 commits into from
Oct 18, 2023

Conversation

AdrianVollmer
Copy link
Contributor

I just had to debug an issue which was caused by insufficient permissions.

This line was raising StopIteration because the iterable was empty. It was empty because the WWW-Authenticate header of response2 only contained the string Negotiate. There was no challenge. The status code was 401 and in the body it contained a HTML message saying I had insufficient permission or invalid credentials (which is true).

I'm not an expert in that protocol, but it seems that if there is no challenge in the second response, we can assume that access was denied and throw an exception accordingly.

@AdrianVollmer
Copy link
Contributor Author

Huh, it worked for me earlier. I'll revisit tomorrow.

@jborean93
Copy link
Contributor

I pushed a commit with a test and a minor tweak, please let me know if you have any concerns about it, otherwise I'll merge this in at the end of my day. Thanks for the PR!

@AdrianVollmer
Copy link
Contributor Author

No concerns on my side, appreciate your comments. Thanks!

@jborean93 jborean93 merged commit 1488ba9 into requests:master Oct 18, 2023
6 checks passed
github-merge-queue bot referenced this pull request in chezmoi-sh/atlas Jun 10, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Update | Change | OpenSSF |
|---|---|---|---|
| [requests-ntlm](https://togithub.com/requests/requests-ntlm) | minor |
`==1.2.0` -> `==1.3.0` | [![OpenSSF
Scorecard](https://api.securityscorecards.dev/projects/github.com/requests/requests-ntlm/badge)](https://securityscorecards.dev/viewer/?uri=github.com/requests/requests-ntlm)
|

---

### Release Notes

<details>
<summary>requests/requests-ntlm (requests-ntlm)</summary>

###
[`v1.3.0`](https://togithub.com/requests/requests-ntlm/releases/tag/v1.3.0)

[Compare
Source](https://togithub.com/requests/requests-ntlm/compare/v1.2.0...v1.3.0)

#### What's Changed

- Fix type annotation problem by setting correct pyspnego min version by
[@&#8203;jborean93](https://togithub.com/jborean93) in
[https://github.com/requests/requests-ntlm/pull/135](https://togithub.com/requests/requests-ntlm/pull/135)
- Throw an exception in case of access denied by
[@&#8203;AdrianVollmer](https://togithub.com/AdrianVollmer) in
[https://github.com/requests/requests-ntlm/pull/138](https://togithub.com/requests/requests-ntlm/pull/138)
- Favour pure NTLM provider and fix SPN by
[@&#8203;jborean93](https://togithub.com/jborean93) in
[https://github.com/requests/requests-ntlm/pull/137](https://togithub.com/requests/requests-ntlm/pull/137)
- Add type annotation and black/isort checks by
[@&#8203;jborean93](https://togithub.com/jborean93) in
[https://github.com/requests/requests-ntlm/pull/140](https://togithub.com/requests/requests-ntlm/pull/140)
- Update CI and version and ignore black diff by
[@&#8203;jborean93](https://togithub.com/jborean93) in
[https://github.com/requests/requests-ntlm/pull/141](https://togithub.com/requests/requests-ntlm/pull/141)

#### New Contributors

- [@&#8203;AdrianVollmer](https://togithub.com/AdrianVollmer) made their
first contribution in
[https://github.com/requests/requests-ntlm/pull/138](https://togithub.com/requests/requests-ntlm/pull/138)

**Full Changelog**:
requests/requests-ntlm@v1.2.0...v1.3.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/chezmoi-sh/atlas).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM5My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants