Commit Graph

218 Commits

Author SHA1 Message Date
HDYA-BackFire
b1036a9dc8 [chore][golang] bump golang to 1.23.5 for security patches (#2025) 2025-01-27 12:20:22 -08:00
yueluhuan
ac9e4fa4fe Bump go version to 1.23.4 (#2019) 2025-01-20 08:51:00 +01:00
day253
04e425642e add utf8 charset meta to the proxy home (#2017) 2025-01-07 23:54:42 +01:00
Nicholas Wiersma
e53c524a96 chore: upgrade go to v1.23.2 (#1997)
Upgrades Go to 1.23.2
2024-11-14 05:36:25 +00:00
Jérôme Foray
223a173806 fix arch selection for github-app helper (#2003) 2024-11-13 11:11:06 +02:00
Jérôme Foray
1644083522 fix: use TARGETARCH to select the git-credential-github-app artifact (#2002) 2024-11-12 19:44:15 +02:00
Bradley Kemp
2c2608a3f5 Update Dockerfile (#1995) 2024-10-28 08:01:49 +02:00
Nicholas Wiersma
71119f8fcf feat: support GitHub App authentication (#1988)
Adds support for using GitHub Apps as a form of authentication
2024-10-21 18:14:34 +00:00
Nicholas Wiersma
2712e2ef17 fix: go in docker failing (#1989)
Co-authored-by: Matt <matt.ouille@protonmail.com>
2024-10-07 21:22:53 +02:00
Matt
0092d3a118 Upgrade to Go 1.22 toolchain (#1987)
Upgrades to the Go 1.22 toolchain. Upgrades golangci-lint to 1.61.0 and disables some new linters.

---------

Co-authored-by: Nicholas Wiersma <nick@wiersma.co.za>
2024-09-28 05:51:14 +00:00
Taylor Chen
3856c6feee add timeout to vcsLister.List() (#1986) 2024-09-20 08:19:47 +02:00
Matt
bde4952614 Set correct content type and send once (#1965)
Set correct Content-Type headers on each endpoint rather than on the router. The router would, at times, send two Content-Type headers and other times just send the wrong one.
2024-06-02 19:49:36 +00:00
Derek Buitenhuis
0ef761cc8b gcp/saver: Only return errors.KindAlreadyExists if all three exist (#1957)
* gcp/saver: Only return errors.KindAlreadyExists if all three exist

In #1124, a GCP lock type was added as a singleflight backend. As part of this work, the GCP backend's Save() was made serial, likely because moduploader.Upload requires a call to Exists() before it, rendering the GCP lock less useful, by doubling the calls to GCS.

However, by doing this, the existence check was now only checking the existence of the mod file, and not the info or zip. This meant that if during a Save, the zip or info uploads failed, on subsequent rquests, that when using the GCP singleflight backend, Athens would assume everything had been stashed and saved properly, and then fail to serve up the info or zip that had failed upload, meaning the cache was in an unhealable broklen state, requiring a manual intervention.

To fix this, without breaking the singleflight behavior, introduce a metadata key that is set on the mod file during its initial upload, indicating that a Stash is still in progress on subsequent files, which gets removed once all three files are uploaded successfully, which can be checked if it it is determined that the mod file already exists. That way we can return a errors.KindAlreadyExists if a Stash is in progress, but also properly return it when a Stash is *not* currently in progress if and only if all three files exist on GCS, which prevents the cache from becoming permanently poisoned.

One note is that it is possible the GCS call to remove the metadata key fails, which would mean it is left on the mod object forever. To avoid this, consider it stale after 2 minutes.

---------

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Co-authored-by: Matt <matt.ouille@protonmail.com>
2024-06-02 19:32:54 +00:00
Vanes Angelo
900cb4f7c1 Upgrade to AWS SDK v2 (#1938) (#1950)
Upgrades the AWS SDK to v2. AWS S3 bucket urls will now error if they are not prefixed with a schema (example: https://).
2024-04-28 21:38:42 -07:00
Matt
359c119441 Add an introduction page as the home page (#1945)
A default homepage is baked into the server that uses the request host address, or in HTTP 2 the authority. This includes ports. It also checks for schema. The values are used to indicate to users how to configure their go env

Of course, this won't work on all installations - especially enterprise ones. For that, we've introduced ATHENS_HOME_TEMPLATE_PATH as an environment variable along with HomeTemplatePath in the config. This value defaults to /var/lib/athens/home.html but can be configured to any location that Athens can reliably read from. This is a Go HTML template so it should use Go HTML template formatting and logic.
2024-04-20 00:19:34 -07:00
Matt
08520bf894 Add log formatting settings (#1926)
Adds a log format setting as ATHENS_LOG_FORMAT that can be either plain or JSON when CloudRuntime is none (the default). Does not break or change any existing behavior.
2024-03-21 09:07:39 -07:00
Mike Seplowitz
cffffc024e Send standard logger's output to logrus (#1912) 2024-02-05 10:30:40 +02:00
Mike Seplowitz
7284004d05 Set up and use logrus logger in main (#1819)
* Set up and use logrus logger in main

Also return errors more consistently from other functions.

* Updated wording styles

* Prefer human-readable descriptions to method names
* Wrapped errors use gerund forms, e.g. "doing x: %w"
* Log traces start with a capital letter

* Fix style on standard log failure cases

---------

Co-authored-by: Manu Gupta <manugupt1@gmail.com>
2024-01-04 11:11:29 +01:00
Michel Loiseleur
43d56f07f6 fix: arm64 build (#1911) 2024-01-03 16:16:08 +01:00
Thomas
e248d22892 fix(proxy): don't check TLS file permission (#1880) 2023-09-01 07:44:47 -07:00
Nicholas Wiersma
6be4bebc0c chore: switch from interface{} to any (#1837) 2023-06-23 15:41:27 +02:00
LINKIWI
e5aa5974e1 Support Unix domain sockets for proxy server listener (#1865) 2023-05-06 11:35:06 +02:00
Richard Hillmann
e35007b3a2 feat: Publish multi-arch docker image (amd64 and arm64) (#1862)
* add arm64 to goreleaser
2023-05-04 09:11:47 +02:00
Manu Gupta
4b0169ce38 Update alpine to 3.17 and build smaller binary. (#1850)
This PR updates alpine to 3.17 and builds smaller athens binary.
By using these flags; we are saving around 14M in athens binary
size.
2023-03-13 10:37:00 +02:00
Nicholas Wiersma
4090b0620a feat: update to Go 1.20 (#1838)
Co-authored-by: Manu Gupta <manugupt1@gmail.com>
2023-03-12 22:12:39 -07:00
Nicholas Wiersma
96f7cb8975 feat: add non-root user to docker image (#1843) 2023-03-08 20:13:01 -08:00
Nicholas Wiersma
d932d50232 chore: lint code with golangci-lint (#1828)
* feat: add golangci-lint linting

* chore: fix linter issues

* feat: add linting into the workflow

* docs: update lint docs

* fix: cr suggestions

* fix: remove old formatting and vetting scripts

* fix: add docker make target

* fix: action go caching

* fix: depreciated actions checkout version

* fix: cr suggestion

* fix: cr suggestions

---------

Co-authored-by: Manu Gupta <manugupt1@gmail.com>
2023-02-24 20:39:17 -08:00
Mike Seplowitz
f35a5406a3 Pass Athens's logger to the Redis package (#1817)
Co-authored-by: Ashish Ranjan <ashishranjan2912@gmail.com>
2023-01-30 12:22:49 +08:00
Nicholas Wiersma
ab64133949 feat: replace ioutil with io and os (#1816) 2023-01-27 20:42:47 +05:30
Rob Prentiss
6baf7c9033 Handle SIGTERM on unix-like OS (#1805) 2023-01-24 18:04:56 -08:00
Rob Prentiss
a1553999bb Make shutdown timeout configurable (#1806)
Currently, when shutting down the server (via SIGINT or SIGTERM), the
shutdown closes any open connections after only 10 seconds (via a
context.WithTimeout). This does not provie a lot of time for longer
operations, such as listing versions, or downloading a larger module zip
file.

When running in Kubernetes, and scaling instances or changing config,
this causes a lot of dropped connections and gateway errors. 10 seconds
is arguably much too short, and should be configurable.

This commit increases that default to 60 seconds, and adds a config
variable to allow users to specify their desired timeout.
2023-01-23 22:02:45 -08:00
Ashish Ranjan
b7dd8a85de upgrade go version to 1.19 (#1814)
* upgrade go version to 1.19

* update base image
2023-01-19 22:32:08 -08:00
Ashish Ranjan
cc496afbf1 read redis lock options from config to support custom TTL & timeout (#1791)
* read redis lock options from config to support custom TTL & timeout

* fix test

* fix typo

* downgrade to bsm/redislock@v0.7.2 to prevent usage of beta go-redis version

* revert test changes

* return error for invalid lock config

* update config parsing test

* udpate docs to include redis lock config

* fix test

* set default max retries to 10

* reduce default redis lock timeout to 15s

* update default TTL to 15mins

Co-authored-by: Manu Gupta <manugupt1@gmail.com>
2022-09-28 22:53:06 -07:00
Zhongpeng Lin
e97cb5f5df Passing http client to S3 client (#1786) 2022-08-26 09:03:56 -04:00
Manu Gupta
69f7a1f902 Update to go1.18 (#1768) 2022-03-21 10:47:41 -07:00
Manu Gupta
be203340be Remove deprecated GOPROXY in favor of GoBinaryEnvVars (#1759) 2022-02-18 10:24:44 -08:00
Manu Gupta
898673c600 Deprecate bzr as it is unmaintained. (#1742)
Alpine moved bzr to unmaintained status. See
https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10000
2021-12-04 22:46:27 -05:00
jason-liew
535c26b0e0 Upgrade GOLANG_VERSION to 1.17 (#1741)
* Upgrade GOLANG_VERSION to 1.17

Fixes ##1740

* feat: upgrade to go1.17

Co-authored-by: shangji.liu <shangji.liu@qingteng.cn>
Co-authored-by: Marwan Sulaiman <marwan.sameer@gmail.com>
2021-12-03 00:56:05 -05:00
Shimin Guo
bb0788dd5c Update alpine version to latest (#1732)
3.11 will reach end of support on 2021-11-01
2021-09-30 14:30:00 -04:00
Marwan Sulaiman
151c4922fb Enable Athens to work in offline mode (#1717)
Co-authored-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>
2021-08-18 19:09:14 -04:00
Latchezar Tzvetkoff
6991d6347b Fix permissions for /config/config.toml so Athens can run as non-root (#1699)
Fixes #1695.

Co-authored-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>
2021-03-31 11:20:23 -07:00
Aaron Schlesinger
1acdf17a4a Reverting passthrough auth (#1700)
* Reverting PR 1650

https://github.com/gomods/athens/pull/1650 was a big change to the
authentication/authorization code, which we have decided to pull
out and potentially move into a separate process/project

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* removing commented, unused code

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* removing more commented, unused code

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* removing more unused code

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
2021-03-11 11:28:15 -08:00
Marwan Sulaiman
dfb7887080 Allow Athens to Propagate Authentication to Mod Download (#1650)
* Allow Athens to Propagate Authentication to Mod Download

* update readme

* add pattern matching to auth propagation

* Propagate authentication to pre declared static host

* quote redis test

* fix flaky redis error message

* fix config tests

* fix config tests

* Update config.dev.toml

Co-authored-by: Ted Wexler <ted@stuckinacan.com>

* gofmt

Co-authored-by: Ted Wexler <ted@stuckinacan.com>
2020-07-30 17:06:53 -04:00
Marwan Sulaiman
81906b918f pkg/requestid: add Request ID to Athens requests and logs (#1655)
Co-authored-by: Ted Wexler <ted@stuckinacan.com>
2020-07-27 12:37:36 -04:00
Marwan Sulaiman
408fd74a9c actions: add index handler tests (#1637) 2020-07-03 11:00:24 -04:00
Marwan Sulaiman
ef15c3458b Allow users to specify the module fetcher's temporary directory (#1636) 2020-06-25 17:15:15 -04:00
Marwan Sulaiman
52934cfa46 implement /index endpoint (#1630)
* implement /index endpoint

* rename to Module to Path
2020-06-24 14:29:30 -04:00
Marwan Sulaiman
f01c645305 pkg/middleware: add tracing to ValidationHook (#1627) 2020-06-15 16:34:24 -04:00
Marwan Sulaiman
38a6a6fe0b Add client tracing to external storage requests (#1626) 2020-06-14 11:03:48 -04:00
Elliot Morrison-Reed
c08aa890cb Fix sumdb/* paths when config.PathPrefix is set (#1620)
* Fix sumdb/* paths when config.PathPrefix is set

http.StripPrefix will look at the entire request path when called,
if we do not include config.PathPrefix then the StripPrefix call
will never receive a valid path from the application and the user
will always get a 404 error.

There were no test where I could easily check this regression so
I also added a few endpoint tests, the last test will fail with
a 404 instead of 403 if this change in not applied.

* Update cmd/proxy/actions/app_proxy.go

Co-authored-by: Marwan Sulaiman <marwan-at-work@github.com>

* Update cmd/proxy/actions/app_proxy_test.go

Co-authored-by: Marwan Sulaiman <marwan-at-work@github.com>

* Update cmd/proxy/actions/app_proxy_test.go

Co-authored-by: Marwan Sulaiman <marwan-at-work@github.com>

* Update cmd/proxy/actions/app_proxy_test.go

Co-authored-by: Marwan Sulaiman <marwan-at-work@github.com>

* Removed unneeded import of logrus

Co-authored-by: Marwan Sulaiman <marwan-at-work@github.com>
2020-06-05 12:01:38 -04:00