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

fix #10963 #10964

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

fix #10963 #10964

wants to merge 9 commits into from

Conversation

NyakudyaA
Copy link
Contributor

Fixes #10963

@cla-bot cla-bot bot added the cla-signed CLA Bot: community license agreement signed label Apr 24, 2023
Copy link
Member

@afabiani afabiani left a comment

Choose a reason for hiding this comment

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

Traceback (most recent call last):
  File "/usr/local/bin/invoke", line 8, in <module>
    sys.exit(program.run())
  File "/usr/local/lib/python3.10/site-packages/invoke/program.py", line 380, in run
    self.execute()
  File "/usr/local/lib/python3.10/site-packages/invoke/program.py", line 565, in execute
    executor.execute(*self.tasks)
  File "/usr/local/lib/python3.10/site-packages/invoke/executor.py", line 127, in execute
    result = call.task(*args, **call.kwargs)
  File "/usr/local/lib/python3.10/site-packages/invoke/tasks.py", line 115, in __call__
    result = self.body(*args, **kwargs)
  File "/usr/src/geonode/tasks.py", line 358, in prepare
    oauth_config = f"{os.environ['GEOSERVER_DATA_DIR']}/security/filter/geonode-oauth2/config.xml"
  File "/usr/local/lib/python3.10/os.py", line 680, in __getitem__
    raise KeyError(key) from None
KeyError: 'GEOSERVER_DATA_DIR'
CircleCI received exit code 0

@codecov
Copy link

codecov bot commented Apr 29, 2023

Codecov Report

Merging #10964 (32b17fb) into master (f3a490a) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #10964   +/-   ##
=======================================
  Coverage   61.26%   61.26%           
=======================================
  Files         839      839           
  Lines       51877    51877           
  Branches     6658     6658           
=======================================
  Hits        31783    31783           
  Misses      18563    18563           
  Partials     1531     1531           

@NyakudyaA
Copy link
Contributor Author

Traceback (most recent call last):
  File "/usr/local/bin/invoke", line 8, in <module>
    sys.exit(program.run())
  File "/usr/local/lib/python3.10/site-packages/invoke/program.py", line 380, in run
    self.execute()
  File "/usr/local/lib/python3.10/site-packages/invoke/program.py", line 565, in execute
    executor.execute(*self.tasks)
  File "/usr/local/lib/python3.10/site-packages/invoke/executor.py", line 127, in execute
    result = call.task(*args, **call.kwargs)
  File "/usr/local/lib/python3.10/site-packages/invoke/tasks.py", line 115, in __call__
    result = self.body(*args, **kwargs)
  File "/usr/src/geonode/tasks.py", line 358, in prepare
    oauth_config = f"{os.environ['GEOSERVER_DATA_DIR']}/security/filter/geonode-oauth2/config.xml"
  File "/usr/local/lib/python3.10/os.py", line 680, in __getitem__
    raise KeyError(key) from None
KeyError: 'GEOSERVER_DATA_DIR'
CircleCI received exit code 0

Resolved

@giohappy giohappy requested a review from afabiani May 9, 2023 21:52
@giohappy
Copy link
Contributor

giohappy commented May 23, 2023

@afabiani I suspect that if a user sets the GEOSERVER_DATA_DIR env var it will break a docker-based deployment, since in that case the hardcoded geoserver_data/data is expected (e.g. volumes mounting) but tasks.py will be executed on a different path.

@afabiani
Copy link
Member

@afabiani I suspect that if a user sets the GEOSERVER_DATA_DIR env var it will break a docker-based deployment, since in that case the hardcoded geoserver_data/data is expected (e.g. volumes mounting) but tasks.py will be executed on a different path.

@giohappy tasks.py always operates on internal volumes. However I agree that the volumes definition should be also paramterized accordingly in order to work correctly in any case.

Copy link
Member

@afabiani afabiani left a comment

Choose a reason for hiding this comment

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

Need to parametrize the docker-compose files too.

@@ -117,10 +117,10 @@ services:
container_name: gsconf4${COMPOSE_PROJECT_NAME}
entrypoint: sleep infinity
volumes:
- geoserver-data-dir:/geoserver_data/data
- geoserver-data-dir:${GEOSERVER_DATA_DIR}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The image geonode/geoserver_data:${VERSION} will need to be adjusted if we intend it to be generic as per the env variable ${GEOSERVER_DATA_DIR}, Currently it also hard codes the path /geoserver_data/data so that's why I was reluctant to change it here unless we fix the upstream image. In my case, I am downloading the data directory as part of the GeoServer entrypoint.sh using download.sh and then mounting it to a specific path defined by ${GEOSERVER_DATA_DIR}

Copy link
Member

Choose a reason for hiding this comment

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

I will take a look and manage to see if the upstream image is customizable too

@gitguardian
Copy link

gitguardian bot commented Oct 16, 2023

⚠️ GitGuardian has uncovered 1 secret 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 secret in your pull request
GitGuardian id Secret Commit Filename
- Django Secret Key 63f1c8d .env.sample 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 secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  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.

Our GitHub checks need improvements? Share your feedbacks!

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.

Do not hard code value of geoserver_data directory in tasks.py
3 participants