001/*
002 * Logback: the reliable, generic, fast and flexible logging framework.
003 * Copyright (C) 1999-2023, QOS.ch. All rights reserved.
004 *
005 * This program and the accompanying materials are dual-licensed under
006 * either the terms of the Eclipse Public License v1.0 as published by
007 * the Eclipse Foundation
008 *
009 *   or (per the licensee's choosing)
010 *
011 * under the terms of the GNU Lesser General Public License version 2.1
012 * as published by the Free Software Foundation.
013 */
014
015package ch.qos.logback.classic.joran.serializedModel;
016
017import ch.qos.logback.core.model.Model;
018import ch.qos.logback.core.net.HardenedObjectInputStream;
019
020import java.io.IOException;
021import java.io.InputStream;
022import java.util.ArrayList;
023import java.util.List;
024
025public class HardenedModelInputStream extends HardenedObjectInputStream {
026
027
028    static public List<String> getWhilelist() {
029        List<String> whitelist = new ArrayList<String>();
030        whitelist.add(Model.class.getName());
031        whitelist.add(ch.qos.logback.core.model.Model.class.getName());
032        whitelist.add(ch.qos.logback.core.model.IncludeModel.class.getName());
033        whitelist.add(ch.qos.logback.core.model.InsertFromJNDIModel.class.getName());
034        whitelist.add(ch.qos.logback.classic.model.RootLoggerModel.class.getName());
035        whitelist.add(ch.qos.logback.core.model.ImportModel.class.getName());
036        whitelist.add(ch.qos.logback.core.model.AppenderRefModel.class.getName());
037        whitelist.add(ch.qos.logback.core.model.ComponentModel.class.getName());
038        whitelist.add(ch.qos.logback.core.model.StatusListenerModel.class.getName());
039        whitelist.add(ch.qos.logback.core.model.ShutdownHookModel.class.getName());
040        whitelist.add(ch.qos.logback.core.model.NamedComponentModel.class.getName());
041        whitelist.add(ch.qos.logback.core.model.AppenderModel.class.getName());
042        whitelist.add(ch.qos.logback.core.model.EventEvaluatorModel.class.getName());
043        whitelist.add(ch.qos.logback.core.model.DefineModel.class.getName());
044        whitelist.add(ch.qos.logback.core.model.SequenceNumberGeneratorModel.class.getName());
045        whitelist.add(ch.qos.logback.core.model.ImplicitModel.class.getName());
046        whitelist.add(ch.qos.logback.classic.model.ReceiverModel.class.getName());
047        whitelist.add(ch.qos.logback.classic.model.LoggerContextListenerModel.class.getName());
048        whitelist.add(ch.qos.logback.core.model.conditional.ThenModel.class.getName());
049        whitelist.add(ch.qos.logback.core.model.conditional.IfModel.class.getName());
050        whitelist.add(ch.qos.logback.core.model.NamedModel.class.getName());
051        whitelist.add(ch.qos.logback.classic.model.ContextNameModel.class.getName());
052        whitelist.add(ch.qos.logback.core.model.ParamModel.class.getName());
053        whitelist.add(ch.qos.logback.core.model.TimestampModel.class.getName());
054        whitelist.add(ch.qos.logback.core.model.PropertyModel.class.getName());
055        whitelist.add(ch.qos.logback.core.model.conditional.ElseModel.class.getName());
056        whitelist.add(ch.qos.logback.classic.model.ConfigurationModel.class.getName());
057        whitelist.add(ch.qos.logback.core.model.SiftModel.class.getName());
058        whitelist.add(ch.qos.logback.classic.model.LoggerModel.class.getName());
059        whitelist.add(ch.qos.logback.core.model.SerializeModelModel.class.getName());
060
061
062        return whitelist;
063    }
064    public HardenedModelInputStream(InputStream is) throws IOException {
065        super(is, getWhilelist());
066    }
067}