Skip to content

Commit

Permalink
Merge pull request #70 from drdrew42/feature/strict-jwt
Browse files Browse the repository at this point in the history
support strict-mode requiring JWT on render req
  • Loading branch information
drdrew42 authored Sep 5, 2021
2 parents 2562afa + 3b7138e commit b777b7e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ If you have non-OPL content, it can be mounted as a volume at `/usr/app/private`
--mount type=bind,source=/pathToYourLocalContentRoot,target=/usr/app/private \
```

A default configuration file is included in the container, but it can be overridden by mounting a replacement at the application root.
A default configuration file is included in the container, but it can be overridden by mounting a replacement at the application root. This is necessary if, for example, you want to run the container in `production` mode.

```
--mount type=bind,source=/pathToYour/configuration_file.conf,target=/usr/app/render_app.conf \
--mount type=bind,source=/pathToYour/render_app.conf,target=/usr/app/render_app.conf \
```

## LOCAL INSTALL ###
Expand Down
2 changes: 1 addition & 1 deletion lib/RenderApp.pm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ sub startup {
$self->plugin('Config');
$self->plugin('TagHelpers');
$self->secrets($self->config('secrets'));
for ( qw(problemJWTsecret webworkJWTsecret baseURL formURL SITE_HOST MOJO_MODE) ) {
for ( qw(problemJWTsecret webworkJWTsecret baseURL formURL SITE_HOST STRICT_JWT) ) {
$ENV{$_} //= $self->config($_);
};

Expand Down
2 changes: 1 addition & 1 deletion lib/RenderApp/Controller/Render.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use WeBWorK::Form;
sub parseRequest {
my $c = shift;
my %params = WeBWorK::Form->new_from_paramable($c->req)->Vars;
if ($c->app->mode eq 'production' && !( defined $params{problemJWT} || defined $params{sessionJWT} )) {
if ($ENV{STRICT_JWT} && !( defined $params{problemJWT} || defined $params{sessionJWT} )) {
$c->exception('Not allowed to request problems with raw data.', 403);
return undef;
}
Expand Down
2 changes: 1 addition & 1 deletion render_app.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
webworkJWTsecret => 'private',
SITE_HOST => 'http://localhost:3000',
CORS_ORIGIN => '*',
MOJO_MODE => 'development',
STRICT_JWT => 0,
hypnotoad => {
listen => ['http://*:3000'],
accepts => 400,
Expand Down

0 comments on commit b777b7e

Please sign in to comment.