Allow default presentation to bypass localhost check

This commit is contained in:
Paul Trudel 2023-06-05 14:32:25 +00:00
parent ae11bd43a3
commit fe43eba452
2 changed files with 8 additions and 1 deletions

View File

@ -40,6 +40,7 @@ public class PresentationUrlDownloadService {
private String presentationBaseURL;
private String presentationDir;
private String BLANK_PRESENTATION;
private String defaultUploadedPresentation;
private List<String> insertDocumentSupportedProtocols;
private List<String> insertDocumentBlockedHosts;
@ -223,6 +224,7 @@ public class PresentationUrlDownloadService {
private boolean isValidRedirectUrl(String redirectUrl) {
log.info("Validating redirect URL [{}]", redirectUrl);
log.info("Default presentation URL [{}]", defaultUploadedPresentation);
URL url;
try {
@ -260,7 +262,7 @@ public class PresentationUrlDownloadService {
return false;
}
if(localhostBlocked && !url.getFile().equalsIgnoreCase("/default.pdf")) {
if(localhostBlocked && !redirectUrl.equalsIgnoreCase(defaultUploadedPresentation)) {
if(address.isAnyLocalAddress()) {
log.error("Address [{}] is a local address", address.getHostAddress());
return false;
@ -347,6 +349,10 @@ public class PresentationUrlDownloadService {
this.BLANK_PRESENTATION = blankPresentation;
}
public void setDefaultUploadedPresentation(String defaultUploadedPresentation) {
this.defaultUploadedPresentation = defaultUploadedPresentation;
}
public void setInsertDocumentSupportedProtocols(String insertDocumentSupportedProtocols) {
this.insertDocumentSupportedProtocols = new ArrayList<>(Arrays.asList(insertDocumentSupportedProtocols.split(",")));
}

View File

@ -93,6 +93,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<property name="pageExtractor" ref="pageExtractor"/>
<property name="documentConversionService" ref="documentConversionService"/>
<property name="blankPresentation" value="${BLANK_PRESENTATION}"/>
<property name="defaultUploadedPresentation" value="${beans.presentationService.defaultUploadedPresentation}"/>
<property name="insertDocumentSupportedProtocols" value="${insertDocumentSupportedProtocols}" />
<property name="insertDocumentBlockedHosts" value="${insertDocumentBlockedHosts}" />
</bean>