a074b645168bba6d6f814b0475d63a0c4372aa0f hiram Tue Oct 25 21:33:16 2022 -0700 need to remove arguments from assemblyRequest.html?args refs #30184 diff --git src/hg/gar/gar.cgi.pl src/hg/gar/gar.cgi.pl index 9bd2769..750fe02 100755 --- src/hg/gar/gar.cgi.pl +++ src/hg/gar/gar.cgi.pl @@ -8,30 +8,31 @@ # use strict; # use warnings; my $httpRefer = "noReference"; my $referDomain = "noDomain"; my $legitimateFrom = 'hclawson@ucsc.edu'; my $httpReferMustBe = "assemblyRequest.html"; my $domainMustBe = "ucsc.edu"; my $sendTo = 'hclawson@ucsc.edu'; my $Cc = 'clayfischer@ucsc.edu'; my $bounceAddr = 'hiram@soe.ucsc.edu'; if (defined($ENV{'HTTP_REFERER'})) { my @a = split('/', $ENV{'HTTP_REFERER'}); $httpRefer = $a[-1]; # should be "assemblyRequest.html" + $httpRefer =~ s/\?.*//; # remove arguments if present my @b = split('\.', $a[-2]); $referDomain = "$b[-2].$b[-1]"; # should be "ucsc.edu" } print "Content-type: text/html\n\n"; print "<html><head><title>GenArk Request assembly build</title></head>\n"; print "<body>\n"; # QUERY_STRING name=some%20name&email=some@email.com&asmId=GCF_000951035.1_Cang.pa_1.0 my %incoming = ( "name" => "noName", "email" => "noEmail", "asmId" => "noAsmId", @@ -46,30 +47,31 @@ my $qString = $ENV{"QUERY_STRING"}; my @idVal = split("&", $qString); foreach $id (@idVal) { my ($tag, $value) = split("=", $id, 2); # only accept known inputs, the five defined above for %incoming defaults if (defined($incoming{$tag}) && defined($value)) { $incoming{$tag} = uri_unescape( $value ); ++$validIncoming; } ++$extraneousArgs if (!defined($incoming{$tag})); } } if ( ($validIncoming != 5) || ($extraneousArgs > 0) || ($referDomain ne $domainMustBe) || ($httpRefer ne $httpReferMustBe) ) { # not a legitimate request from our own business, do nothing. + printf STDERR "# ERROR: cgi-bin/gar invalid something: %d %d %s %s\n", $validIncoming, $extraneousArgs, $referDomain, $httpRefer; print "</body></html>\n"; exit 0; } printf "<ul>\n"; printf "<li> name: '%s'</li>\n", $incoming{"name"}; printf "<li>email: '%s'</li>\n", $incoming{"email"}; printf "<li>asmId: '%s'</li>\n", $incoming{"asmId"}; printf "<li>betterName: '%s'</li>\n", $incoming{"betterName"}; printf "<li>comment: '%s'</li>\n", $incoming{"comment"}; printf "</ul>\n"; my $DS=`date "+%F %T"`; chomp $DS;