Skip to content

Commit

Permalink
Add a flag to skip all authorization checks
Browse files Browse the repository at this point in the history
This change adds a flag (`-insecure-skip-authorization`) that allows all
users to do all actions. This should only be used in the omegaUp
frontend unit tests.
  • Loading branch information
lhchavez committed Aug 7, 2019
1 parent 988607f commit dd74d94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/omegaup-gitserver/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func (a *omegaupAuthorization) authorize(
}

requestContext := request.FromContext(ctx)
if username == "omegaup:system" {
if username == "omegaup:system" || *insecureSkipAuthorization {
// This is the frontend, and we trust it completely.
requestContext.IsAdmin = true
requestContext.CanView = true
Expand Down
5 changes: 5 additions & 0 deletions cmd/omegaup-gitserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ var (
"/etc/omegaup/gitserver/config.json",
"gitserver configuration file",
)
insecureSkipAuthorization = flag.Bool(
"insecure-skip-authorization",
false,
"grant all privileges to all users",
)
version = flag.Bool("version", false, "Print the version and exit")
log log15.Logger

Expand Down

0 comments on commit dd74d94

Please sign in to comment.