Skip to content

Commit 5ffe8b1

Browse files
Improved validation for XML parsing and paths (#7422)
1 parent d70970e commit 5ffe8b1

4 files changed

Lines changed: 10 additions & 3 deletions

File tree

api/src/org/labkey/api/reader/ExcelLoader.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import org.labkey.api.util.FileUtil;
4747
import org.labkey.api.util.JunitUtil;
4848
import org.labkey.api.util.StringUtilsLabKey;
49+
import org.labkey.api.util.XmlBeansUtil;
4950
import org.labkey.vfs.FileLike;
5051
import org.labkey.vfs.FileSystemLike;
5152
import org.xml.sax.Attributes;
@@ -540,7 +541,7 @@ private Thread startAsyncParsing() throws IOException, InvalidFormatException
540541
if (sheetMatches(sheetIndex, iter.getSheetName()))
541542
{
542543
InputSource sheetSource = new InputSource(stream);
543-
SAXParserFactory saxFactory = SAXParserFactory.newInstance();
544+
SAXParserFactory saxFactory = XmlBeansUtil.SAX_PARSER_FACTORY;
544545
try
545546
{
546547
SAXParser saxParser = saxFactory.newSAXParser();

core/src/org/labkey/core/attachment/AttachmentServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public synchronized void addAttachments(AttachmentParent parent, List<Attachment
289289
}
290290

291291
Set<String> filesToSkip = new TreeSet<>();
292-
File fileLocation = parent instanceof AttachmentDirectory ? ((AttachmentDirectory) parent).getFileSystemDirectory() : null;
292+
File fileLocation = parent instanceof AttachmentDirectory dir ? dir.getFileSystemDirectory() : null;
293293

294294
for (AttachmentFile file : files)
295295
{

filecontent/src/org/labkey/filecontent/FileSystemAttachmentParent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public void addAttachment(User user, AttachmentFile file) throws IOException
191191
{
192192
Path fileLocation = getFileSystemDirectoryPath();
193193
InputStream is = file.openInputStream();
194-
Path saveFile = fileLocation.resolve(file.getFilename());
194+
Path saveFile = FileUtil.appendName(fileLocation, file.getFilename());
195195
try
196196
{
197197
Files.copy(is, saveFile);

pipeline/src/org/labkey/pipeline/api/PipelineStatusManager.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,12 @@ public static void completeStatus(User user, Collection<Long> rowIds)
694694
PipelineStatusFileImpl sf = PipelineStatusManager.getStatusFile(rowId);
695695
if (sf != null)
696696
{
697+
Container container = sf.lookupContainer();
698+
if (container == null || !container.hasPermission(user, UpdatePermission.class))
699+
{
700+
throw new UnauthorizedException();
701+
}
702+
697703
LOG.info("Job " + sf.getFilePath() + " was marked as complete by " + user);
698704
sf.setStatus(PipelineJob.TaskStatus.complete.toString());
699705
sf.setInfo(null);

0 commit comments

Comments
 (0)