Skip to content

Commit

Permalink
support strict-mode requiring JWT on render req
Browse files Browse the repository at this point in the history
  • Loading branch information
drdrew42 committed Sep 1, 2021
1 parent 8072c07 commit a16ab00
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
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 MOJO_MODE 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
1 change: 1 addition & 0 deletions render_app.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
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 a16ab00

Please sign in to comment.