github-advanced-security[bot] commented on code in PR #713: URL: https://github.com/apache/ws-wss4j/pull/713#discussion_r4059735772
########## ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/RequestDataNestingTest.java: ########## @@ -0,0 +1,134 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.wss4j.dom.handler; + +import org.apache.wss4j.common.ext.WSSecurityException; +import org.apache.wss4j.dom.engine.WSSConfig; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + +/** + * A processor that uncovers a token inside the one it is processing hands it to another processor, + * which may do the same again, so how deep a message may nest tokens is how much of the receiver's + * stack the sender gets to spend. RequestData carries that bound for the message. + */ +public class RequestDataNestingTest { + + private static final int LIMIT = RequestData.MAXIMUM_PROCESSOR_NESTING_DEPTH; + + @BeforeAll + public static void setUp() { + // Without this the message bundle is not loaded and every getMessage() returns the + // library's "you must initialize" text instead of the message that was raised. + WSSConfig.init(); + } + + /** + * The bound has to leave room for the deepest nesting a real message performs. An + * EncryptedAssertion reaches 2, and re-encrypting an already encrypted assertion reaches 3. + */ + @Test + public void testLimitAccommodatesRealMessages() { + assertEquals(true, LIMIT >= 3, Review Comment: ## CodeQL / Useless comparison test Test is always true. [Show more details](https://github.com/apache/ws-wss4j/security/code-scanning/424) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
