Commit Graph

56 Commits

Author SHA1 Message Date
8b08b91840 Bump golang.org/x/image to fix vulnerability
Vulnerability #1: GO-2024-2937
    Panic when parsing invalid palette-color images in golang.org/x/image
  More info: https://pkg.go.dev/vuln/GO-2024-2937
  Module: golang.org/x/image
    Found in: golang.org/x/image@v0.10.0
    Fixed in: golang.org/x/image@v0.18.0
    Example traces found:
      #1: internal/worker/output_uploader.go:144:36: worker.loadAsJPEG calls image.Decode, which calls tiff.Decode
2024-06-27 09:54:33 +02:00
eba340cedc Bump Go version to 1.22.3
Update Go from 1.22.2 to 1.22.3 (released 2024-05-07)

It includes security fixes to the go command and the net package, as
well as bug fixes to the compiler, the runtime, and the net/http
package.
2024-05-28 08:59:59 +02:00
f757deee6a Security: Bump Go version 1.22.2 and golang.org/x/net package
Fix a bunch of security issues by upgrading to Go 1.22.2 and bumping
a few packages to their secure versions.

- [Incorrect forwarding of sensitive headers and cookies on HTTP redirect in net/http](https://pkg.go.dev/vuln/GO-2024-2600)
- [Memory exhaustion in multipart form parsing in net/textproto and net/http](https://pkg.go.dev/vuln/GO-2024-2599)
- [Verify panics on certificates with an unknown public key algorithm in crypto/x509](https://pkg.go.dev/vuln/GO-2024-2600)
- [HTTP/2 CONTINUATION flood in net/http](https://pkg.go.dev/vuln/GO-2024-2687)
2024-04-04 10:44:57 +02:00
63a2bce600 run go mod tidy
No functional changes.
2024-03-04 13:53:24 +01:00
4fe8605744 Manager: Add MQTT client for sending events
Add an MQTT client to send events from the event bus to an MQTT broker.
2024-02-03 23:20:15 +01:00
b16b44b4d6 Run go mod tidy 2024-01-13 13:08:29 +01:00
7c08ec8654 Upgrade dependencies
Go dependency upgrades, most importantly:

- github.com/glebarez/go-sqlite v1.21.1 -> v1.22.0
- github.com/glebarez/sqlite v1.8.0 -> v1.10.0
- gorm.io/gorm v1.25.2 -> v1.25.5
- modernc.org/sqlite v1.26.0 -> v1.28.0
2024-01-11 19:53:07 +01:00
17b664f152 Worker: log copy-pastable commandline invocation
Log any CLI command that's run in a way that can be easily copy-pasted
from the task log. This can help a lot in determining whether an issue
is caused by Flamenco or by the CLI program itself.
2023-12-25 15:07:18 +01:00
a65f234bea Manager: replace GORM database migration with Goose
Replace GORM's auto-migration with Goose. The latter uses hand-written
SQL queries to apply database schema changes, which is safer and easier to
understand than what GORM is doing.
2023-12-14 10:13:40 +01:00
12bc182857 Log more OS info at startup
In addition to logging `GOOS` and `GOARCH`, also log more info about the
system:

- Windows: the Windows version and edition.
- Linux: distribution, distribution version, and kernel version.
- macOS: just "macOS", until we know more about getting info there too.
2023-10-15 14:16:56 +02:00
4f81096840 Fix vulnerability in golang.org/x/net
Vulnerability: GO-2023-2102
    HTTP/2 rapid reset can cause excessive work in net/http
  More info: https://pkg.go.dev/vuln/GO-2023-2102
  Module: golang.org/x/net
    Found in: golang.org/x/net@v0.7.0
    Fixed in: golang.org/x/net@v0.17.0
2023-10-15 11:08:42 +02:00
89a323d079 Fix vulnerability GO-2022-0603, but on code path we don't touch
Fix a vulnerability in the YAML parser library. It's in a part of the
library that Flamenco doesn't touch, which is why this isn't mentioned
in the CHANGELOG.md file.

------------

Found 1 vulnerability in packages that you import, but there are no call
stacks leading to the use of this vulnerability. You may not need to
take any action. See https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck
for details.

Vulnerability #1: GO-2022-0603
    Panic in gopkg.in/yaml.v3
  More info: https://pkg.go.dev/vuln/GO-2022-0603
  Module: gopkg.in/yaml.v3
    Found in: gopkg.in/yaml.v3@v3.0.0-20210107192922-496545a6307b
    Fixed in: gopkg.in/yaml.v3@v3.0.0-20220521103104-8f96da9f5d5e
2023-09-07 12:13:07 +02:00
e0be4f2378 Run go mod tidy 2023-09-07 12:09:19 +02:00
6a9e1239b8 Security fixes
Vulnerability #1: GO-2023-1990
    Excessive CPU consumption when decoding 0-height images in
    golang.org/x/image/tiff
  More info: https://pkg.go.dev/vuln/GO-2023-1990
  Module: golang.org/x/image
    Found in: golang.org/x/image@v0.5.0
    Fixed in: golang.org/x/image@v0.10.0
    Example traces found:
      #1: internal/worker/output_uploader.go:144:36: worker.loadAsJPEG calls image.Decode, which calls tiff.Decode

Vulnerability #2: GO-2023-1989
    Excessive resource consumption in golang.org/x/image/tiff
  More info: https://pkg.go.dev/vuln/GO-2023-1989
  Module: golang.org/x/image
    Found in: golang.org/x/image@v0.5.0
    Fixed in: golang.org/x/image@v0.10.0
    Example traces found:
      #1: internal/worker/output_uploader.go:144:36: worker.loadAsJPEG calls image.Decode, which calls tiff.Decode
2023-09-07 12:07:58 +02:00
60fb20c0ff Fix #104245: Incorrect frame range formatting when crafting blender's cmd
Fix a bug in the translation from 'human' frame ranges ('A-B,C-D') to
'Blender' frame ranges ('A..B,C..D'). It required calling
`string.replaceAll()` instead of `string.replace()` in the job compiler
script, which in turn required an upgrade of the JavaScript engine Goja.
2023-08-23 19:55:49 +02:00
988cdf61ff Upgrade GORM & SQLite
Upgrade:
- `gorm.io/gorm` v1.23.8 → 1.25.2
- `github.com/glebarez/go-sqlite` v1.17.3 → v1.8.0
- `github.com/glebarez/sqlite` v1.4.6 → v1.8.0

and also some indirect dependencies.

This is in the hope that some weird cases at Blender Studio get resolved.
It appears that sometimes, for some unknown reason, when deleting a job,
its tasks get reassigned to another job (instead of also getting deleted).

Since there is no code in Flamenco itself to do this task deletion (it's
all depending on SQLite following the foreign keys and cascading to tasks),
I hope it was a bug in either GORM or SQLite that got fixed at some point.
2023-07-06 16:08:57 +02:00
a386d80765 Bump govulncheck dependencies 2023-03-21 12:20:43 +01:00
46c46455f0 Bump golang.org/x/image and golang.org/x/net for security fixes
Fix these vulnerabilities:

```
Vulnerability #1: GO-2023-1572
  An attacker can craft a malformed TIFF image which will consume
  a significant amount of memory when passed to DecodeConfig. This
  could lead to a denial of service.

  More info: https://pkg.go.dev/vuln/GO-2023-1572

  Module: golang.org/x/image
    Found in: golang.org/x/image@v0.0.0-20191009234506-e7c1f5e7dbb8
    Fixed in: golang.org/x/image@v0.5.0

Vulnerability #2: GO-2023-1571
  A maliciously crafted HTTP/2 stream could cause excessive CPU
  consumption in the HPACK decoder, sufficient to cause a denial
  of service from a small number of small requests.

  More info: https://pkg.go.dev/vuln/GO-2023-1571

  Module: golang.org/x/net
    Found in: golang.org/x/net@v0.5.0
    Fixed in: golang.org/x/net@v0.7.0
```
2023-02-21 11:18:33 +01:00
eca498c98a go.mod: declare Go 1.20 as minimum requirement
Also run `go mod tidy` for good measure.
2023-02-09 15:41:29 +01:00
2aa2f5f75b Upgrade Echo from v4.6.1 to 4.9.1 to address security issue
Upgrade Echo from v4.6.1 to 4.9.1. The security issue was fixed in 4.9.0,
so this upgrade picks the latest 4.9.x to upgrade to.

For more info on the security issue, see
https://pkg.go.dev/vuln/GO-2022-1031
2023-02-09 11:30:06 +01:00
228941b15c Add missing dependencies
Effect of running `go get github.com/golang/mock/mockgen@v1.6.0`
2022-10-18 11:30:56 +02:00
0d2de42ac1 Run go mod tidy
Just running `go mod tidy` to tidy up the dependencies.
2022-10-07 16:55:41 +02:00
2f76df437b T99415: Worker: change default location for writing local files
Change the location where the Worker writes its local files so that it
follows the XDG specification (instead of writing to the current working
directory).

- Linux:   `$HOME/.local/share/flamenco`
- Windows: `C:\Users\UserName\AppData\Local\Flamenco`
- macOS:   `$HOME/Library/Application Support/Flamenco`

NOTE: The old files will not be loaded any more. This means that if
nothing is done and the new worker is run as-is, it will reregister as a
brand new worker. Move `flamenco-worker-credentials.yaml` and
`flamenco-worker.sqlite` to the new location to avoid this.
2022-07-19 12:08:41 +02:00
d425bca5cf Upgrade GORM and SQLite
Upgrade just GORM and SQLite (and their dependencies), in a hope that it
will solve the "interrupted (9)" errors returned on our production Flamenco
Manager.
2022-07-19 10:39:19 +02:00
5fbf44ac30 Revert "Upgraded all Go dependencies"
This reverts commit b04889dd79986eca9547108c60fa61ac0ef4cc71. It caused
some errors that I'm not willing to debug this time of day ;-)
2022-07-18 19:44:24 +02:00
b04889dd79 Upgraded all Go dependencies
Ran `go get -t -u ./...` to get all the main + test dependencies upgraded.
2022-07-18 19:39:43 +02:00
aa9837b5f0 First incarnation of the first-time wizard
This adds a `-wizard` CLI option to the Manager, which opens a webbrowser
and shows the First-Time Wizard to aid in configuration of Flamenco.

This is work in progress. The wizard is just one page, and doesn't save
anything yet to the configuration.
2022-07-14 11:17:03 +02:00
e687c95e5d Manager: add "last rendered image" processing pipeline
Add a handler for the OpenAPI `taskOutputProduced` operation, and an
image thumbnailing goroutine.

The queue of images to process + the function to handle queued images
is managed by `last_rendered.LastRenderedProcessor`. This queue currently
simply allows 3 requests; this should be improved such that it keeps
track of the job IDs as well, as with the current approach a spammy job
can starve the updates from a more calm job.
2022-06-24 16:51:11 +02:00
6e12a2fb25 Manager: keep track of which worker failed which task
When a Worker indicates a task failed, mark it as `soft-failed` until
enough workers have tried & failed at the same task.

This is the first step in a blocklisting system, where tasks of an
often-failing worker will be requeued to be retried by others.

NOTE: currently the failure list of a task is NOT reset whenever it is
requeued! This will be implemented in a future commit, and is tracked in
`FEATURES.md`.
2022-06-13 18:41:38 +02:00
d153db4280 Work in progress on using UPnP/SSDP to make the Worker find its Manager
Due to the way SSDP works, Flamenco Manager needs to know its own URL,
where the Workers can reach it. These URLs are now found, and since there
can be multiple (like IPv6 + IPv4) they are all sent in a SSDP
notification as ;-separated strings.
2022-03-04 17:44:04 +01:00
9b9c6bffff Replace self-hacked SQLite Gorm driver with 3rd party one
The new Gorm driver is made by the creators of the pure-Go SQLite library
we were already using.
2022-03-03 13:48:14 +01:00
e70a44a146 Manager: switch from PostgreSQL to SQLite
This includes a modified copy of the Gorm SQLite backend, adjusted to use
https://modernc.org/sqlite instead.
2022-03-01 18:50:31 +01:00
2a1f5a0df4 Worker: buffer task updates when Manager offline
Queue task updates in an SQLite database when the Manager is
unreachable, periodically checking whether they can be flushed.
2022-02-22 19:05:33 +01:00
32c7a1fd84 Worker: Blender command, parse CLI arguments from 'exe' parameter 2022-02-22 12:52:16 +01:00
Sybren A. Stüvel
6bd1a86337 Start of DB initialisation functions
Not properly working yet
2022-02-21 15:25:56 +01:00
bb53cc1e4a Task log storage service 2022-02-18 18:19:35 +01:00
8424e690ee Bump Go version to 1.18 for generics support 2022-02-18 11:41:31 +01:00
c4df62d5d4 Start of sending task updates to Manager
This includes a mocking framework for unittests.
2022-02-15 15:58:24 +01:00
58619ea6db Cleanup: go mod tidy 2022-02-15 11:20:54 +01:00
96023932da SocketIO based chat client as PoC for backend/frontend communication
The chat client itself is just a throwaway project. The SocketIO system
will be used to send realtime updates about jobs, tasks, and workers to
the web frontend.
2022-02-11 14:47:26 +01:00
7c14b2648d Much more of the Worker life cycle implemented 2022-01-31 15:02:05 +01:00
c501899185 Ported lots of stuff from gitlab.com/dr.sybren/flamenco-worker-go
Much isn't working though.
2022-01-28 17:02:50 +01:00
3b1cb3c187 Remove sqlite library & run go mod tidy 2022-01-28 14:52:46 +01:00
2a4bf1c60f Toying around with GORM and PostgreSQL 2022-01-24 16:59:48 +01:00
0629728ce9 Add frame chunker and make unit test for simple blender render succeed 2022-01-13 16:32:08 +01:00
0c9c99806b Start of database interface
Contains a dummy migration because the migrate package will error out if
it cannot find any migration files.
2022-01-11 18:07:34 +01:00
Sybren A. Stüvel
3e771cb7b7 Basic HTTP auth for workers implemented
Still a dummy, but at least it works with the OpenAPI 3
auth specification.
2022-01-10 17:45:13 +01:00
Sybren A. Stüvel
a8ada28a41 Hook up Zerolog to Echo 2022-01-10 17:45:13 +01:00
Sybren A. Stüvel
949ff08b0e Switch from Gin to Echo framework 2022-01-10 17:45:13 +01:00
Sybren A. Stüvel
38a8943767 Add Flamenco Worker PoC 2022-01-10 17:45:13 +01:00