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

Tag on upload #41

Merged
merged 5 commits into from
Jun 13, 2024
Merged

Tag on upload #41

merged 5 commits into from
Jun 13, 2024

Conversation

pstadermann
Copy link
Contributor

No description provided.

Philip Stadermann added 5 commits June 12, 2024 13:55
Tag uploaded files with "Unscanned"
Tag uploaded files with scan result
On-upload: If scan fails, tag uploaded file as "Unscanned"
On-upload: If file is too big, tag uploaded file as "Won't scan"

# Test cases

## Small files
Clean -> Clean
Pup -> Pup
Malicious -> blocks upload

## Large files
Any -> Won't scan

## VaaS error (e.g. wrong credentials)
Any -> Unscanned
* Rename EventListener to CacheEntryListener
* Add documentation to VerdictService
Copy link
Member

Choose a reason for hiding this comment

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

still a rather generic name

use OCP\Files\Cache\CacheEntryUpdatedEvent;
use Psr\Log\LoggerInterface;

class EventListener implements IEventListener
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
class EventListener implements IEventListener
class CacheEventsListener implements IEventListener
Suggested change
class EventListener implements IEventListener
class PostUploadEventListener implements IEventListener

| Upgrade Nextcloud via CLI | `docker exec --user www-data {nextcloud_container} php occ upgrade` |
| Watch logs | `docker exec --user www-data {nextcloud_container} php occ log:watch` |
| Set log level to debug | `docker exec --user www-data {nextcloud_container} php occ log:manage --level DEBUG` |
| Watch logs | `docker exec --user www-data nextcloud-container /bin/sh -c "tail -f data/nextcloud.log" \| jq .message` |
Copy link
Member

Choose a reason for hiding this comment

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

there are still multiple Watch logs

the log:tail command seems pretty good

$ docker exec -it --user www-data nextcloud-container php occ log:tail --help
Description:
  Tail the nextcloud logfile

Usage:
  log:tail [options] [--] [<lines>]

Arguments:
  lines                  The number of log entries to print [default: "10"]

Options:
  -f, --follow           Output new log entries as they appear
  -r, --raw              Output raw log json instead of formatted log item
      --output[=OUTPUT]  Output format (plain, json or json_pretty, default is plain) [default: "plain"]
  -h, --help             Display help for the given command. When no command is given display help for the list command
  -q, --quiet            Do not output any message
  -V, --version          Display this application version
      --ansi|--no-ansi   Force (or disable --no-ansi) ANSI output
  -n, --no-interaction   Do not ask any interactive question
      --no-warnings      Skip global warnings, show command output only
  -v|vv|vvv, --verbose   Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

same for the 'logs:watch' command:

$ docker exec -it --user www-data nextcloud-container php occ log:watch --help
Description:
  Watch the nextcloud logfile

Usage:
  log:watch [options]

Options:
  -r, --raw              Output raw log json instead of formatted log item
      --output[=OUTPUT]  Output format (plain, json or json_pretty, default is plain) [default: "plain"]
  -h, --help             Display help for the given command. When no command is given display help for the list command
  -q, --quiet            Do not output any message
  -V, --version          Display this application version
      --ansi|--no-ansi   Force (or disable --no-ansi) ANSI output
  -n, --no-interaction   Do not ask any interactive question
      --no-warnings      Skip global warnings, show command output only
  -v|vv|vvv, --verbose   Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

@pstadermann pstadermann merged commit 14997b7 into main Jun 13, 2024
2 checks passed
@pstadermann pstadermann deleted the tag_on_upload branch June 13, 2024 08:28
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