Git DataSource requires authentication for HTTP #8405

Closed
opened 2025-12-29 20:36:18 +01:00 by adam · 5 comments
Owner

Originally created by @alehaa on GitHub (Aug 3, 2023).

Originally assigned to: @alehaa on GitHub.

NetBox version

v3.5.7

Python version

3.8

Steps to Reproduce

  1. Create public Git Repository at GitLab.com or choose an existing one
  2. Add git DataSource with HTTP / HTTPS URL
  3. Sync DataSource

Expected Behavior

Sync job finishes status 'Completed'.

Observed Behavior

Sync job finishes status 'Error'. Log states:

ERROR:root:Fetching remote data failed (HTTPUnauthorized): No valid credentials provided

Originally created by @alehaa on GitHub (Aug 3, 2023). Originally assigned to: @alehaa on GitHub. ### NetBox version v3.5.7 ### Python version 3.8 ### Steps to Reproduce 1. Create public Git Repository at GitLab.com or [choose an existing one](https://gitlab.com/explore) 2. Add git DataSource with HTTP / HTTPS URL 3. Sync DataSource ### Expected Behavior Sync job finishes status 'Completed'. ### Observed Behavior Sync job finishes status 'Error'. Log states: > ERROR:root:Fetching remote data failed (HTTPUnauthorized): No valid credentials provided
adam added the type: bugstatus: accepted labels 2025-12-29 20:36:18 +01:00
adam closed this issue 2025-12-29 20:36:18 +01:00
Author
Owner

@alehaa commented on GitHub (Aug 3, 2023):

To resolve this issue, a simple check in data_backends.py is required, to only set username and password, if arguments passed are not empty. Tested this and seems to work. I can supply a patch / PR for this.

@alehaa commented on GitHub (Aug 3, 2023): To resolve this issue, a simple check in `data_backends.py` is required, to only set username and password, if arguments passed are not empty. Tested this and seems to work. I can supply a patch / PR for this.
Author
Owner

@abhi1693 commented on GitHub (Aug 3, 2023):

Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.5.7. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.

@abhi1693 commented on GitHub (Aug 3, 2023): Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.5.7. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.
Author
Owner

@alehaa commented on GitHub (Aug 3, 2023):

Indeed I can't reproduce this with GitHub repositories. However, when using GitLab as source, jobs fail. I used v3.5.7 and a public GitLab repository for testing.

Seems like GitLab won't ignore empty HTTP Basic authentication.

@alehaa commented on GitHub (Aug 3, 2023): Indeed I can't reproduce this with GitHub repositories. However, when using GitLab as source, jobs fail. I used v3.5.7 and a [public GitLab repository](https://gitlab.com/explore) for testing. Seems like GitLab won't ignore empty HTTP Basic authentication.
Author
Owner

@alehaa commented on GitHub (Aug 15, 2023):

@abhi1693 did you already have a chance to confirm this bug report? Would love to contribute a patch to only set authentication headers when user input is provided. If I understand contribution policy correctly, I'm not allowed to file a PR before this issue is assigned to me.

@alehaa commented on GitHub (Aug 15, 2023): @abhi1693 did you already have a chance to confirm this bug report? Would love to contribute a patch to only set authentication headers when user input is provided. If I understand contribution policy correctly, I'm not allowed to file a PR before this issue is assigned to me.
Author
Owner

@abhi1693 commented on GitHub (Aug 15, 2023):

@alehaa I was able to reproduce your issue. You can go ahead and submit a PR

@abhi1693 commented on GitHub (Aug 15, 2023): @alehaa I was able to reproduce your issue. You can go ahead and submit a PR
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8405