25 Commits

Author SHA1 Message Date
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
f01c645305 pkg/middleware: add tracing to ValidationHook (#1627) 2020-06-15 16:34:24 -04:00
Marwan Sulaiman
34f55365a2 always use request logging middleware (#1522)
* always use request logging middleware

* reads better

* rm http-url as it is redundant

* gopls being redundant

* add color name
2020-01-20 18:25:48 -05:00
Mark Dodgson
f76ca00665 Display warning log message if validation fails (#1517)
* Display a warning log message if the validation response fails with a valid reason

* provide a reason and description for failed validation

* added unknown to description

* Allow a successful response to carry a message

* tidy up

* formatting

* Simplified the message response

* updated based on latest comments

* no need to export struct

* suggested method rename

Co-authored-by: Marwan Sulaiman <marwan.sameer@gmail.com>
2020-01-20 13:26:17 -05:00
Chad Kunde
7811524c22 Version filtering (#1050)
* extend filtering logic and configuration to include version lists

Module filtering is very useful, but many deployments will need to
satisfy even more granular constrainsts.  Enterprises may need
approved lists specific down to the minor (or patch) version element.

Version filtering logic is similar to the module filtering, in that
it's a prefix match of the version requested against each entry in the
version filter list.

Closes #1045

* include version filtering in documentation with example

* allow filtering when version is missing

Endpoints that do not specify a version, such as "@v/list", only need
to be filtered by module rules.
2019-02-05 09:04:09 +01:00
Marwan Sulaiman
5870aeee8d Remove Buffalo (#1010)
* Remove Buffalo

* gofmt

* pr fixes

* fix subrouter

* bring back secure middleware + pr fixes

* better place for subrouter

* vendor
2018-12-22 20:24:25 -05:00
Nafis Faysal
dd801d86b1 Refactoring code to improve HTTP status code (#1005)
* refactoring code to improve HTTP status code

* refactoring code to improve HTTP status code

* refactoring code to improve HTTP status code

* refactoring code to improve HTTP status code
2018-12-20 22:15:03 +01:00
Manu Gupta
5eba6f2e47 File permissions on config files allow more restrictive setting (#966)
* File permissions on config files allow more restrictive setting

* Make the tests a bit more readable

* Bring back the tests dude

* Update error message

* remove else

* Add more test cases

* Change Lstat to Stat

* Add note for umask

* Make sure the permissions are 0600 or lower

* Update config file

* Do not check for windows

* Fix CI errors

* Fix CI test
2018-12-18 16:26:04 +01:00
Yorman
b92a642f1a Add error checks in a few test files and fix misspelled words (#919)
* Remove inefficient assignment of variable cxt in pkg/storage/fs

* Remove inefficient assignment of variable cxt in pkg/storage/minio

* Remove inefficient assignment of variable cxt in pkg/storage/mongo

* Fix commonly misspelled English words successfully and accessible

* Remove inefficient assignment of variable cxt in pkg/download

* Remove inefficient assignment of variable cxt in pkg/module

* Add missing error checks in a few unit-test files

* Revert removal of inefficient assignment of variable cxt

The variable, although is not being used, it maintains the readability
in the functions where it’s being assigned. The removal of `cxt` in
these files may introduce errors when a new function taking these
values is called. Two other contributors agree that it’s easy to miss
this detail when passing the variable to other functions and the traces
are not being recorded.

* Modify unit-test error reporting for the config package

* Modify config test to exit when ioutil.TempFile or os.Chmod fail
2018-11-21 20:16:05 +01:00
Manu Gupta
24b84addc9 Add httptest (#897)
* Add httptest

* Update tests

* remove willie
2018-11-16 16:14:48 -05:00
Brent Pendergraft
3c223dcfca add new log context middleware to store log entries in the context (#844)
* add new log context middleware to store log entries in the context

* replace LogEntryMiddleware and add NoOpLogger

* fix failing test

* move middleware to top level

* actually move middleware to top level
2018-11-06 08:46:51 -05:00
Michal Pristas
f53ab92503 Filter: fixing after refactoring (#867)
* added some clarity

* no need to handle pseudo versions

* gofmt

* tests ok

* reshuffled again
2018-11-06 00:18:18 -05:00
Marwan Sulaiman
21dcd5a388 config: flatten Proxy struct (#846)
* config: flatten Proxy struct

* fix mw_test

* gofmt

* add line
2018-11-01 17:21:42 -04:00
Manu Gupta
657c9d04a3 If a filter file is not found and is in config, throw an error (#788)
* When the filter file is missing throw a fatal

* Ignore path when file is not specified

* Fix build failure on ci

* Remove logs

* Fix propagate and handle errors

* Fix build error

* Actually check filter file

* Check for errors in the test suite as well

* Improve test coverage

* Add more tests

* Simplify NewFilter function

* Address review comments
2018-10-31 10:08:15 -07:00
Henry Jenkins
d26b99d41c Upgrade Buffalo (#789)
* Upgrade buffalo

* Switch to go modules everywhere

* Fixes from buffalo fix

* Add missing modules from module list

* Update vendored modules in /vendor

* Stop using vendor directory for tests

* Check go.mod and go.sum files on verify

* Upgrade Buffalo from v0.13.0 to v0.13.1

* Fix test for new Buffalo

Allow for new Buffalo code

* Add test for endpoint with trailing slash
2018-10-23 16:49:32 -07:00
Henry Jenkins
532e93e119 Remove Olympus code (#779)
* Remove nolonger used moniker package

Usage was removed in 97d8013

* Remove reference to Zeus

Use name Proxy for now.

* Remove Olympus code

See github issue #777

* Remove Olympus related vendor modules

* Mention Olympus removal in docs

* Add note about no registries existing

* Remove eventlog

* Update docs for Olympus removal
2018-10-22 11:52:02 -07:00
Zachary Romero
e5b307354c Patch points of test flag leakage (#667) 2018-09-29 19:26:19 +02:00
marpio
bcc896f226 rename example to dev and rm test config (#691) 2018-09-20 16:38:08 -04:00
Don McNamara
3db7a667f0 Clean up error operation names to match function names. (#614) 2018-09-19 23:43:09 -04:00
Manu Gupta
89d7b35ccd remove opentracing stuff from the code (#652) 2018-09-13 13:24:04 -04:00
Rohan Chakravarthy
0e470d0294 Plumb config - Latest (#627)
* switch proxy to config file

pull in single flight changes

* changes for single-flight

* intermediate stage. All tests passing. pkg still has env refs

* remove all env references

* delete config/env entirely

* fix failing tests

* create the config.toml file as part of dev setup

* create config file only if it doesn't exist

* update Dockerfiles to use config file

* move composing elements to the top

* verbose parameter naming

* newline

* add flag for config file path

* update docs with config file flag

* remove unnecessary nil check

* use filepath.join

* rename redis port to address

* fix path.join

* fix issues after merge

* add vendor dir
2018-09-11 15:04:20 -07:00
Manu Gupta
bb250437da Instrumenting observability with opencensus (#604)
* Initial chanages for observability

* Fix some panics to start testing

* Export tracing properly

* First example of child spans using opencensus

* Add spans to download protocol

* Add url to traces

* Remove opentracing

* Remove gopkg.* files

* Start deprecating opentracing

* Resolve stupid build errors

* Use observability package

* Fix test errors

* Convert buffalo spans to observercontext

* change package name

* defer flush to the end of the app execution

* Change op names to the correct package

* Rename pkg/observability to pkg/observ

* Show traces for the package

* Keep tracing in the earlier way

* Add info from request headers

* Remove whitespace

* Move exporter url to env var

* Add to env file for documentation

* Remove opentracing stuff

* Use stdlib

* Shorten service name

* Add a service name to olympus as well

* Add test to test if there is a recursion or not

* Add Ops Suite

* Move around code

* Make sure the service is not instantiated if the exporter is not found
2018-09-11 10:31:20 -07:00
Marwan Sulaiman
a1b5060ead Proxy: add cache-control middleware (#553)
* Proxy: add cache-control middleware

* fix improt cycle + use MDN no-cache example

* remove import lines

* actually use MDN example

* remove .idea from gitignore in unrelated pr
2018-08-22 09:52:16 -04:00
Federico Paolinelli
c8b64fd258 Proxy 'admission controller' (#492)
* The proxy middleware calls an hook if set to check if the module needs
to be filtered

* Fixed error handling

* Added a middleware func that passes the log entry down to other
middlewares

* Split the filter middleware in two

* Moved validation middleware in its own file

* Renamed filter to middleware, all the middleware stuff in a single file

* Moved default hook to empty string

* Split tests of filter middleware from validation middleware

* Installed the validation middleware only if the hook is set

* Moved filter test to middleware test

* Fixed gofmt issue caused by manual merge

* Fixed wrong logrus import

* Removed logger from filter middleware

* Moved middleware functions to own package

* Removed unused argument, fixed errors

* Fixed gofmt errors

* Made middleware func private

* Changed debuglevel from string to enum

* Added comments to now public functions

* Changed module alias to a shorter one

* Removed white space

* Split middleware in separate files, injected the hook as param

* Removed commented code
2018-08-21 22:51:26 +02:00