Skip to content

[Fixes #14177] Implement storage and handling of authentications for external resources#14192

Open
sijandh35 wants to merge 6 commits intomasterfrom
ISSUE_14177
Open

[Fixes #14177] Implement storage and handling of authentications for external resources#14192
sijandh35 wants to merge 6 commits intomasterfrom
ISSUE_14177

Conversation

@sijandh35
Copy link
Copy Markdown
Contributor

Fixes #14177

Checklist

Reviewing is a process done by project maintainers, mostly on a volunteer basis. We try to keep the overhead as small as possible and appreciate if you help us to do so by completing the following items. Feel free to ask in a comment if you have troubles with any of them.

For all pull requests:

  • Confirm you have read the contribution guidelines
  • You have sent a Contribution Licence Agreement (CLA) as necessary (not required for small changes, e.g., fixing typos in the documentation)
  • Make sure the first PR targets the master branch, eventual backports will be managed later. This can be ignored if the PR is fixing an issue that only happens in a specific branch, but not in newer ones.

The following are required only for core and extension modules (they are welcomed, but not required, for contrib modules):

  • There is a ticket in https://github.com/GeoNode/geonode/issues describing the issue/improvement/feature (a notable exemption is, changes not visible to end-users)
  • The issue connected to the PR must have Labels and Milestone assigned
  • PR for bug fixes and small new features are presented as a single commit
  • PR title must be in the form "[Fixes #<issue_number>] Title of the PR"
  • New unit tests have been added covering the changes, unless there is an explanation on why the tests are not necessary/implemented

Submitting the PR does not require you to check all items, but by the time it gets merged, they should be either satisfied or inapplicable.

@cla-bot cla-bot Bot added the cla-signed CLA Bot: community license agreement signed label May 4, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

Gemini is experiencing higher than usual traffic and was unable to create the review. Please try again in a few hours by commenting /gemini review.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

❌ Patch coverage is 79.84293% with 77 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.70%. Comparing base (0343f6f) to head (5647fd0).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #14192      +/-   ##
==========================================
+ Coverage   64.87%   74.70%   +9.83%     
==========================================
  Files         960      967       +7     
  Lines       58866    59201     +335     
  Branches     8070     8106      +36     
==========================================
+ Hits        38188    44228    +6040     
+ Misses      19054    13167    -5887     
- Partials     1624     1806     +182     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sijandh35 sijandh35 marked this pull request as draft May 4, 2026 16:07
@sijandh35 sijandh35 marked this pull request as ready for review May 4, 2026 16:14
@sijandh35 sijandh35 requested a review from Gpetrak May 5, 2026 05:56
@sijandh35 sijandh35 assigned sijandh35 and unassigned sijandh35 May 5, 2026
Comment thread geonode/services/utils.py Outdated
@sijandh35 sijandh35 requested a review from giohappy May 5, 2026 11:03
Comment thread geonode/security/admin.py Outdated
Comment thread geonode/security/admin.py Outdated
Comment thread geonode/security/auth_registry.py Outdated
Comment thread geonode/security/utils.py Outdated
return (auth_handler.username, auth_handler.password)


def create_basic_auth_config(username, password):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a class method on the AuthBasicHandler

Comment thread geonode/security/utils.py Outdated
Comment thread geonode/services/serviceprocessors/wms.py Outdated
@gitguardian
Copy link
Copy Markdown

gitguardian Bot commented May 7, 2026

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
32555648 Triggered Authentication Tuple eebd47c geonode/security/tests.py View secret
32555648 Triggered Authentication Tuple eebd47c geonode/services/tests.py View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@sijandh35 sijandh35 requested a review from giohappy May 7, 2026 14:41
auth = self.kwargs.get("auth")
auth_config = self.kwargs.get("auth_config")
if auth is None and auth_config is not None:
auth = BasicAuthHandler(auth_config).get_request_auth()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be tied to the Basic auth handler. Any auth type could be used for a service. We must retrieve the correct auth handler from the registry, based on the config.

Comment thread geonode/services/forms.py Outdated
auth_config = None
if username is not None or password is not None:
payload = {"username": username, "password": password}
BasicAuthHandler.validate(payload)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here @sijandh35 . We create the config from username/passowrd (we only suport basic auth when creating a new service for the moment), but the auth handler can be obtained from the config instead of hardcodign the basichandler

Comment thread geonode/thumbs/thumbnails.py
@sijandh35 sijandh35 requested a review from giohappy May 8, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed CLA Bot: community license agreement signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement storage and handling of authentications for external resources

3 participants