All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.juli.logging.ch.qos.logback.classic.net.server.HardenedLoggingEventInputStream Maven / Gradle / Ivy

There is a newer version: 8.5.100.SP1
Show newest version
/**
 * Logback: the reliable, generic, fast and flexible logging framework.
 * Copyright (C) 1999-2022, QOS.ch. All rights reserved.
 *
 * This program and the accompanying materials are dual-licensed under
 * either the terms of the Eclipse Public License v1.0 as published by
 * the Eclipse Foundation
 *
 *   or (per the licensee's choosing)
 *
 * under the terms of the GNU Lesser General Public License version 2.1
 * as published by the Free Software Foundation.
 */
package org.apache.juli.logging.ch.qos.logback.classic.net.server;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

import org.apache.juli.logging.org.slf4j.helpers.BasicMarker;

import org.apache.juli.logging.ch.qos.logback.classic.Level;
import org.apache.juli.logging.ch.qos.logback.classic.Logger;
import org.apache.juli.logging.ch.qos.logback.classic.spi.ClassPackagingData;
import org.apache.juli.logging.ch.qos.logback.classic.spi.IThrowableProxy;
import org.apache.juli.logging.ch.qos.logback.classic.spi.LoggerContextVO;
import org.apache.juli.logging.ch.qos.logback.classic.spi.LoggerRemoteView;
import org.apache.juli.logging.ch.qos.logback.classic.spi.LoggingEventVO;
import org.apache.juli.logging.ch.qos.logback.classic.spi.StackTraceElementProxy;
import org.apache.juli.logging.ch.qos.logback.classic.spi.ThrowableProxy;
import org.apache.juli.logging.ch.qos.logback.classic.spi.ThrowableProxyVO;
import org.apache.juli.logging.ch.qos.logback.core.net.HardenedObjectInputStream;

public class HardenedLoggingEventInputStream extends HardenedObjectInputStream {

    static final String ARRAY_PREFIX = "[L";

    static public List getWhilelist() {
        List whitelist = new ArrayList();
        whitelist.add(LoggingEventVO.class.getName());
        whitelist.add(LoggerContextVO.class.getName());
        whitelist.add(LoggerRemoteView.class.getName());
        whitelist.add(ThrowableProxyVO.class.getName());
        whitelist.add(BasicMarker.class.getName());
        whitelist.add(Level.class.getName());
        whitelist.add(Logger.class.getName());
        whitelist.add(StackTraceElement.class.getName());
        whitelist.add(StackTraceElement[].class.getName());
        whitelist.add(ThrowableProxy.class.getName());
        whitelist.add(ThrowableProxy[].class.getName());
        whitelist.add(IThrowableProxy.class.getName());
        whitelist.add(IThrowableProxy[].class.getName());
        whitelist.add(StackTraceElementProxy.class.getName());
        whitelist.add(StackTraceElementProxy[].class.getName());
        whitelist.add(ClassPackagingData.class.getName());

        return whitelist;
    }

    public HardenedLoggingEventInputStream(InputStream is) throws IOException {
        super(is, getWhilelist());
    }

    public HardenedLoggingEventInputStream(InputStream is, List additionalAuthorizedClasses)
            throws IOException {
        this(is);
        super.addToWhitelist(additionalAuthorizedClasses);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy