Skip to content

Commit

Permalink
NextcloudApp: polishing API, maintenance update
Browse files Browse the repository at this point in the history
Maintenance update:

applied changes from AppAPI 2.3.0 (renamed vars)
fixed CI for Nextcloud Master with PGSQL(some server bug?)
removed non needed stuff(optional API scopes)
updated Security.md
  • Loading branch information
bigcat88 authored Mar 17, 2024
1 parent 3fcf6b2 commit 1c816be
Show file tree
Hide file tree
Showing 20 changed files with 72 additions and 195 deletions.
30 changes: 6 additions & 24 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,13 @@ Only the latest non beta release version of `nc_py_api` are currently being supp

## Reporting a Vulnerability about nc_py_api

Officially, Nextcloud is not responsible for this project; the project is developed in the community’s free time.
Officially, Nextcloud is not responsible for this project; the project is developing by the community.

Please report security vulnerabilities to bigcat88@icloud.com with `nc-py-api` in the subject line.
If there is no response within 24 hours, then create an Issue,
without technical details, to report on the previously sent mail.
Please use GitHub's Private Vulnerability Reporting feature.

## Reporting a Vulnerability about Nextcloud
If there is no response within 48 hours, then create an Issue,
without technical details, to report on the previously reported vulnerability.

Transparency and Security are vital.
If you have discovered a security issue with Nextcloud,
please read our responsible disclosure guidelines and contact us at [hackerone.com/nextcloud](https://hackerone.com/nextcloud).
Your report should include:
## Conclusion

- Product version
- A vulnerability description
- Reproduction steps

If in the scope of the project, a member of the security team confirms the vulnerability, determines its impact, and develops a fix.
Otherwise, the team will contact the maintainer and make sure the issue gets fixed.
The fix will be applied to the main branch, tested, and packaged in the next security release.
The vulnerability will be publicly announced after the release.

Finally, your name will be added to the [hall of fame](https://hackerone.com/nextcloud/thanks)
as a thank-you from the entire Nextcloud community.

Note our [threat model](https://nextcloud.com/security/threat-model) to know what is expected behavior.

Please visit https://nextcloud.com/security/ for further information about security.
We welcome and appreciate contributions to the security and advancement of open-source projects.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to this project will be documented in this file.

## [0.12.0 - 2024-02-28]

Update with new features only for `NextcloudApp` class. #233

### Added

- `ex_app.get_computation_device` function for retrieving GPU type(only with AppAPI `2.4.0`+).
- `ex_app.integration_fastapi.fetch_models_task` are now public function, added `progress_init_start_value` param.
- Global authentication when used now sets `request.scope["username"]` for easy use.

## [0.11.0 - 2024-02-17]

### Added
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

# General information about the project.
project = "NcPyApi"
copyright = str(now.year) + " Nextcloud GmbH" # noqa
copyright = str(now.year) + f" {project} Authors" # noqa

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
3 changes: 0 additions & 3 deletions docs/reference/ExApp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ External Application
Constants
---------

.. autoclass:: ApiScope
:members:

.. autoclass:: LogLvl
:members:

Expand Down
34 changes: 6 additions & 28 deletions examples/as_app/skeleton/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ help:
@echo " "
@echo " build-push build image and upload to ghcr.io"
@echo " "
@echo " deploy27 deploy Skeleton to registered 'docker_dev' for Nextcloud 27"
@echo " deploy28 deploy Skeleton to registered 'docker_dev' for Nextcloud 28"
@echo " deploy deploy Skeleton to registered 'docker_dev' for Nextcloud Last"
@echo " "
@echo " run27 install Skeleton for Nextcloud 27"
@echo " run28 install Skeleton for Nextcloud 28"
@echo " run install Skeleton for Nextcloud Last"
Expand All @@ -29,59 +25,41 @@ build-push:
docker login ghcr.io
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/skeleton:latest .

.PHONY: deploy27
deploy27:
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:deploy skeleton docker_dev \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml

.PHONY: deploy28
deploy28:
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:deploy skeleton docker_dev \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml

.PHONY: deploy
deploy:
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:deploy skeleton docker_dev \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml

.PHONY: run27
run27:
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register skeleton docker_dev --force-scopes \
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register skeleton --force-scopes \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml

.PHONY: run28
run28:
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:register skeleton docker_dev --force-scopes \
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:register skeleton --force-scopes \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml

.PHONY: run
run:
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register skeleton docker_dev --force-scopes \
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register skeleton --force-scopes \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml

.PHONY: register27
register27:
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register skeleton manual_install --json-info \
"{\"appid\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[],\"system_app\":0}" \
"{\"id\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[],\"system\":0}" \
--force-scopes --wait-finish

.PHONY: register28
register28:
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:register skeleton manual_install --json-info \
"{\"appid\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[],\"system_app\":0}" \
"{\"id\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[],\"system\":0}" \
--force-scopes --wait-finish

.PHONY: register
register:
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register skeleton manual_install --json-info \
"{\"appid\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[],\"system_app\":0}" \
"{\"id\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[],\"system\":0}" \
--force-scopes --wait-finish
2 changes: 1 addition & 1 deletion examples/as_app/skeleton/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nc_py_api[app]>=0.5.0
nc_py_api[app]>=0.10.0
9 changes: 2 additions & 7 deletions examples/as_app/talk_bot/HOW_TO_INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ How To Install

1. [Install AppAPI](https://apps.nextcloud.com/apps/app_api)
2. Create a deployment daemon according to the [instructions](https://cloud-py-api.github.io/app_api/CreationOfDeployDaemon.html#create-deploy-daemon) of the AppPI
3. php occ app_api:app:deploy talk_bot "daemon_deploy_name" \
3. php occ app_api:app:register talk_bot --force-scopes \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot/appinfo/info.xml

to deploy a docker image with Bot to docker.

4. php occ app_api:app:register talk_bot "daemon_deploy_name" --force-scopes \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot/appinfo/info.xml

to call its **enable** handler and accept all required API scopes by default.
to deploy and install this ExApp.
23 changes: 4 additions & 19 deletions examples/as_app/talk_bot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ help:
@echo " "
@echo " build-push build image and upload to ghcr.io"
@echo " "
@echo " deploy deploy example to registered 'docker_dev' for Nextcloud Last"
@echo " deploy27 deploy example to registered 'docker_dev' for Nextcloud 27"
@echo " "
@echo " run install TalkBot for Nextcloud Last"
@echo " run27 install TalkBot for Nextcloud 27"
@echo " "
Expand All @@ -26,40 +23,28 @@ build-push:
docker login ghcr.io
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/talk_bot:latest .

.PHONY: deploy
deploy:
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister talk_bot --silent --force || true
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:deploy talk_bot docker_dev \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot/appinfo/info.xml

.PHONY: deploy27
deploy27:
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister talk_bot --silent --force || true
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:deploy talk_bot docker_dev \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot/appinfo/info.xml

.PHONY: run
run:
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister talk_bot --silent --force || true
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register talk_bot docker_dev --force-scopes \
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register talk_bot --force-scopes \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot/appinfo/info.xml

.PHONY: run27
run27:
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister talk_bot --silent --force || true
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register talk_bot docker_dev --force-scopes \
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register talk_bot --force-scopes \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot/appinfo/info.xml

.PHONY: register
register:
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister talk_bot --silent --force || true
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register talk_bot manual_install --json-info \
"{\"appid\":\"talk_bot\",\"name\":\"TalkBot\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9032,\"scopes\":[\"TALK\", \"TALK_BOT\"],\"system_app\":0}" \
"{\"id\":\"talk_bot\",\"name\":\"TalkBot\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9032,\"scopes\":[\"TALK\", \"TALK_BOT\"],\"system\":0}" \
--force-scopes --wait-finish

.PHONY: register27
register27:
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister talk_bot --force || true
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register talk_bot manual_install --json-info \
"{\"appid\":\"talk_bot\",\"name\":\"TalkBot\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9032,\"scopes\":[\"TALK\", \"TALK_BOT\"],\"system_app\":0}" \
"{\"id\":\"talk_bot\",\"name\":\"TalkBot\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9032,\"scopes\":[\"TALK\", \"TALK_BOT\"],\"system\":0}" \
--force-scopes --wait-finish
23 changes: 4 additions & 19 deletions examples/as_app/talk_bot_ai/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ help:
@echo " "
@echo " build-push build image and upload to ghcr.io"
@echo " "
@echo " deploy deploy example to registered 'docker_dev' for Nextcloud Last"
@echo " deploy27 deploy example to registered 'docker_dev' for Nextcloud 27"
@echo " "
@echo " run install TalkBotAI for Nextcloud Last"
@echo " run27 install TalkBotAI for Nextcloud 27"
@echo " "
Expand All @@ -26,40 +23,28 @@ build-push:
docker login ghcr.io
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/talk_bot_ai:latest .

.PHONY: deploy
deploy:
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister talk_bot_ai --silent --force || true
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:deploy talk_bot_ai docker_dev \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot_ai/appinfo/info.xml

.PHONY: deploy27
deploy27:
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister talk_bot_ai --silent --force || true
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:deploy talk_bot_ai docker_dev \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot_ai/appinfo/info.xml

.PHONY: run
run:
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister talk_bot_ai --silent --force || true
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register talk_bot_ai docker_dev --force-scopes \
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register talk_bot_ai --force-scopes \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot_ai/appinfo/info.xml

.PHONY: run27
run27:
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister talk_bot_ai --silent --force || true
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register talk_bot_ai docker_dev --force-scopes \
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register talk_bot_ai --force-scopes \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot_ai/appinfo/info.xml

.PHONY: register
register:
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister talk_bot_ai --silent --force || true
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register talk_bot_ai manual_install --json-info \
"{\"appid\":\"talk_bot_ai\",\"name\":\"TalkBotAI\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9034,\"scopes\":[\"TALK\", \"TALK_BOT\"],\"system_app\":0}" \
"{\"id\":\"talk_bot_ai\",\"name\":\"TalkBotAI\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9034,\"scopes\":[\"TALK\", \"TALK_BOT\"],\"system\":0}" \
--force-scopes --wait-finish

.PHONY: register27
register27:
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister talk_bot_ai --silent --force || true
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register talk_bot_ai manual_install --json-info \
"{\"appid\":\"talk_bot_ai\",\"name\":\"TalkBotAI\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9034,\"scopes\":[\"TALK\", \"TALK_BOT\"],\"system_app\":0}" \
"{\"id\":\"talk_bot_ai\",\"name\":\"TalkBotAI\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9034,\"scopes\":[\"TALK\", \"TALK_BOT\"],\"system\":0}" \
--force-scopes --wait-finish
Loading

0 comments on commit 1c816be

Please sign in to comment.