Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge master into 7-0-x branch - 2024-02-01 #866

Merged
merged 39 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
eca0666
WW-5352 Introduce StrutsParameter annotation
kusalk Jan 3, 2024
ad576f0
WW-5352 Introduce ThreadAllowlist bean
kusalk Jan 3, 2024
4255da3
WW-5352 First draft implementation
kusalk Jan 3, 2024
bf3f407
WW-5352 Ensure allowlist is cleared if in unexpected state
kusalk Jan 9, 2024
4c5f2b0
WW-5352 Add full unit test coverage
kusalk Jan 9, 2024
e9154b9
Merge branch 'master' into WW-5352-parameter-annotation-3
kusalk Jan 9, 2024
5d79301
WW-5352 Fix missing curved bracket
kusalk Jan 9, 2024
4c60f39
WW-5352 Enable annotations for showcase
kusalk Jan 9, 2024
b2c7542
WW-5352 Dispatcher should up thread allowlist
kusalk Jan 9, 2024
a57c288
WW-5352 Reinstate manual allowlist for generic types
kusalk Jan 9, 2024
0a71e2c
WW-5352 Implement auto-allowlisting for Iterator component
kusalk Jan 9, 2024
770d311
WW-5352 Mild optimisation
kusalk Jan 9, 2024
6df8004
WW-5352 Auto allowlist parameterized types!
kusalk Jan 9, 2024
f106b20
WW-5352 Map-like type support
kusalk Jan 9, 2024
bf7737f
WW-5352 Add unit test coverage for generics
kusalk Jan 9, 2024
56d8361
WW-5352 Implement transition mode
kusalk Jan 9, 2024
49b9c0c
WW-5352 Ensure superclasses and interfaces allowlisted
kusalk Jan 14, 2024
728d695
WW-5352 Add debug logging for parameter rejections
kusalk Jan 17, 2024
b506169
WW-5352 Acceptance test coverage
kusalk Jan 18, 2024
71d77df
WW-5352 Normalise parameter name
kusalk Jan 18, 2024
775febb
Upgrade maven to 3.9.6 and wrapper to 3.2.0
sepe81 Jan 20, 2024
1e56b7c
Merge pull request #853 from sepe81/feature/upgrade-maven-to-3.9.6
lukaszlenart Jan 21, 2024
cde8645
Bump actions/upload-artifact from 4.1.0 to 4.2.0
dependabot[bot] Jan 22, 2024
ec18f0e
Merge pull request #855 from apache/dependabot/github_actions/actions…
lukaszlenart Jan 22, 2024
cf74a44
Fixes excluding Plexus container in OWASP scan
lukaszlenart Jan 22, 2024
9f4b67a
Drops JDK11 build and fixes duplicated steps
lukaszlenart Jan 22, 2024
65c0427
Merge pull request #858 from apache/fix/plexus-exclusion
lukaszlenart Jan 22, 2024
2de30e7
Merge pull request #859 from apache/fix/sped-up-build
lukaszlenart Jan 22, 2024
e7a13b9
Small spelling and MD fixes (IntelliJ assisted)
sepe81 Jan 21, 2024
644bd1f
Mention just the maintenance branches for supported versions
sepe81 Jan 24, 2024
2513fcb
Stops running sonar.yml on forks
lukaszlenart Jan 24, 2024
7843cd5
Merge pull request #854 from sepe81/feature/update-security-policy
lukaszlenart Jan 24, 2024
5057aea
Merge pull request #862 from apache/lukaszlenart-patch-1
lukaszlenart Jan 24, 2024
bd783a0
Merge pull request #832 from apache/WW-5352-parameter-annotation-3
kusalk Jan 26, 2024
a358db5
WW-5360 Introduces additional countStr & indexStr to allow to ignore …
lukaszlenart Jan 21, 2024
b836072
Merge pull request #852 from apache/fix/WW-5360-iterator
lukaszlenart Jan 28, 2024
372aad2
Bump actions/upload-artifact from 4.2.0 to 4.3.0
dependabot[bot] Jan 29, 2024
eb46977
Merge pull request #864 from apache/dependabot/github_actions/actions…
lukaszlenart Jan 29, 2024
11d84a2
Merge remote-tracking branch 'origin/master' into merge-master-to-7xx…
lukaszlenart Feb 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/scorecards-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
publish_results: true

- name: "Upload artifact"
uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595 # 4.1.0
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # 4.3.0
with:
name: SARIF file
path: results.sarif
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
sonarcloud:
name: Scan
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.head.repo.fork }}
steps:
- uses: actions/checkout@v4
with:
Expand Down
10 changes: 5 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pipeline {
MAVEN_OPTS = "-Xmx1024m"
}
stages {
stage('Test') {
stage('Test & Coverage') {
steps {
sh './mvnw -B verify -Pcoverage -DskipAssembly --no-transfer-progress'
}
Expand All @@ -86,7 +86,7 @@ pipeline {
}
steps {
withCredentials([string(credentialsId: 'asf-struts-sonarcloud', variable: 'SONARCLOUD_TOKEN')]) {
sh './mvnw -B -Pcoverage -DskipAssembly -Dsonar.login=${SONARCLOUD_TOKEN} verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar'
sh './mvnw -B -Pcoverage -DskipAssembly -Dsonar.login=${SONARCLOUD_TOKEN} verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --no-transfer-progress'
}
}
}
Expand All @@ -100,7 +100,7 @@ pipeline {
dir("local-snapshots-dir/") {
deleteDir()
}
sh './mvnw -B source:jar javadoc:jar -DskipTests -DskipAssembly'
sh './mvnw -B source:jar javadoc:jar -DskipTests -DskipAssembly --no-transfer-progress'
}
}
stage('Deploy Snapshot') {
Expand All @@ -111,7 +111,7 @@ pipeline {
}
steps {
withCredentials([file(credentialsId: 'lukaszlenart-repository-access-token', variable: 'CUSTOM_SETTINGS')]) {
sh './mvnw -s \${CUSTOM_SETTINGS} deploy -DskipTests -DskipAssembly'
sh './mvnw -s \${CUSTOM_SETTINGS} deploy -DskipTests -DskipAssembly --no-transfer-progress'
}
}
}
Expand All @@ -123,7 +123,7 @@ pipeline {
}
}
steps {
sh './mvnw -B package -DskipTests'
sh './mvnw -B package -DskipTests --no-transfer-progress'
sshPublisher(publishers: [
sshPublisherDesc(
configName: 'Nightlies',
Expand Down
12 changes: 6 additions & 6 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

## Supported Versions

Please vist the [Releases](https://struts.apache.org/releases.html#prior-releases) page to see full information about each version
Please visit the [Releases](https://struts.apache.org/releases.html#prior-releases) page to see full information about each version
and what potential vulnerability it can have:

| Version | Supported |
| ------- | ------------------ |
| 6.0.0 | :white_check_mark: |
| 2.5.30 | :white_check_mark: |
|---------|--------------------|
| 6.x | :white_check_mark: |
| 2.5.x | :white_check_mark: |

## Reporting New Security Issues with thr Apache Struts

Expand All @@ -28,8 +28,8 @@ All mail sent to this address that does not relate to security problems in the A
```

Note that all networked servers are subject to denial of service attacks, and we cannot promise magic
workarounds to generic problems (such as a client streaming lots of data to your server, or re-requesting
the same URL repeatedly). In general our philosophy is to avoid any attacks which can cause the server
workarounds to generic problems (such as a client streaming lots of data to your server, or requesting
the same URL repeatedly). In general, our philosophy is to avoid any attacks that can cause the server
to consume resources in a non-linear relationship to the size of inputs.

The mailing address is: [[email protected]](mailto:[email protected])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@
import com.opensymphony.xwork2.Validateable;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.parameter.StrutsParameter;

import java.io.File;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
*/
Expand Down Expand Up @@ -89,6 +95,7 @@ public List getLeftSideCartoonCharacters() {
return leftSideCartoonCharacters;
}

@StrutsParameter
public void setLeftSideCartoonCharacters(List leftSideCartoonCharacters) {
this.leftSideCartoonCharacters = leftSideCartoonCharacters;
}
Expand All @@ -98,6 +105,7 @@ public List getRightSideCartoonCharacters() {
return rightSideCartoonCharacters;
}

@StrutsParameter
public void setRightSideCartoonCharacters(List rightSideCartoonCharacters) {
this.rightSideCartoonCharacters = rightSideCartoonCharacters;
}
Expand All @@ -107,6 +115,7 @@ public String getFavouriteVehicalType() {
return favouriteVehicalType;
}

@StrutsParameter
public void setFavouriteVehicalType(String favouriteVehicalType) {
this.favouriteVehicalType = favouriteVehicalType;
}
Expand All @@ -115,6 +124,7 @@ public String getFavouriteVehicalSpecific() {
return favouriteVehicalSpecific;
}

@StrutsParameter
public void setFavouriteVehicalSpecific(String favouriteVehicalSpecific) {
this.favouriteVehicalSpecific = favouriteVehicalSpecific;
}
Expand Down Expand Up @@ -145,6 +155,7 @@ public String getName() {
return name;
}

@StrutsParameter
public void setName(String name) {
this.name = name;
}
Expand All @@ -153,6 +164,7 @@ public Date getBirthday() {
return birthday;
}

@StrutsParameter
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
Expand All @@ -161,6 +173,7 @@ public String getBio() {
return bio;
}

@StrutsParameter
public void setBio(String bio) {
this.bio = bio;
}
Expand All @@ -169,6 +182,7 @@ public String getFavouriteColor() {
return favouriteColor;
}

@StrutsParameter
public void setFavouriteColor(String favoriteColor) {
this.favouriteColor = favoriteColor;
}
Expand All @@ -177,6 +191,7 @@ public List getFriends() {
return friends;
}

@StrutsParameter
public void setFriends(List friends) {
this.friends = friends;
}
Expand All @@ -193,6 +208,7 @@ public boolean isLegalAge() {
return legalAge;
}

@StrutsParameter
public void setLegalAge(boolean legalAge) {
this.legalAge = legalAge;
}
Expand All @@ -201,6 +217,7 @@ public String getState() {
return state;
}

@StrutsParameter
public void setState(String state) {
this.state = state;
}
Expand All @@ -209,6 +226,7 @@ public String getRegion() {
return region;
}

@StrutsParameter
public void setRegion(String region) {
this.region = region;
}
Expand All @@ -229,6 +247,7 @@ public void setPictureFileName(String pictureFileName) {
this.pictureFileName = pictureFileName;
}

@StrutsParameter
public void setFavouriteLanguage(String favouriteLanguage) {
this.favouriteLanguage = favouriteLanguage;
}
Expand All @@ -237,7 +256,7 @@ public String getFavouriteLanguage() {
return favouriteLanguage;
}


@StrutsParameter
public void setThoughts(String thoughts) {
this.thoughts = thoughts;
}
Expand All @@ -250,6 +269,7 @@ public Date getWakeup() {
return wakeup;
}

@StrutsParameter
public void setWakeup(Date wakeup) {
this.wakeup = wakeup;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/*
* 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.struts2.showcase.action;

import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import org.apache.struts2.showcase.model.MyDto;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static java.util.Collections.singletonList;
import static java.util.Collections.singletonMap;

/**
* This class supports {@link com.atlassian.confluence.stateless.webdriver.selenium3.security.StrutsParametersTest}
* which prevents critical security regressions. Do NOT modify without understanding the motivation behind the tests and
* the implications of any changes.
*/
public class ParamsAnnotationAction extends ActionSupport {

@StrutsParameter
public String varToPrint;

public String publicField = "no";

@StrutsParameter
public String publicFieldAnnotated = "no";

private String privateField = "no";

public int[] publicArray = new int[]{0};

@StrutsParameter(depth = 1)
public int[] publicArrayAnnotated = new int[]{0};

public List<String> publicList = new ArrayList<>(singletonList("no"));

@StrutsParameter(depth = 1)
public List<String> publicListAnnotated = new ArrayList<>(singletonList("no"));

private List<String> privateList = new ArrayList<>(singletonList("no"));

public Map<String, String> publicMap = new HashMap<>(singletonMap("key", "no"));

@StrutsParameter(depth = 1)
public Map<String, String> publicMapAnnotated = new HashMap<>(singletonMap("key", "no"));

public MyDto publicMyDto = new MyDto();

@StrutsParameter(depth = 2)
public MyDto publicMyDtoAnnotated = new MyDto();

@StrutsParameter(depth = 1)
public MyDto publicMyDtoAnnotatedDepthOne = new MyDto();

private MyDto privateMyDto = new MyDto();

public void setPrivateFieldMethod(String privateField) {
this.privateField = privateField;
}

@StrutsParameter
public void setPrivateFieldMethodAnnotated(String privateField) {
this.privateField = privateField;
}

public List<String> getPrivateListMethod() {
return privateList;
}

@StrutsParameter(depth = 1)
public List<String> getPrivateListMethodAnnotated() {
return privateList;
}

public MyDto getUnsafeMethodMyDto() {
return privateMyDto;
}

@StrutsParameter(depth = 2)
public MyDto getSafeMethodMyDto() {
return privateMyDto;
}

@StrutsParameter(depth = 1)
public MyDto getSafeMethodMyDtoDepthOne() {
return privateMyDto;
}

public String renderVarToPrint() throws ReflectiveOperationException {
if (varToPrint == null) {
return "null";
}
Field field = this.getClass().getDeclaredField(varToPrint);
field.setAccessible(true);
try {
return String.format("%s{%s}", varToPrint,
field.getType().isArray() ? stringifyArray(field.get(this)) : field.get(this));
} finally {
field.setAccessible(false);
}
}

private String stringifyArray(Object array) {
switch (array.getClass().getComponentType().getName()) {
case "int":
return Arrays.toString((int[]) array);
default:
return "TODO";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.opensymphony.xwork2.Preparable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import org.apache.struts2.showcase.dao.Dao;
import org.apache.struts2.showcase.dao.SkillDao;
import org.apache.struts2.showcase.model.Skill;
Expand Down Expand Up @@ -71,6 +72,7 @@ protected Dao getDao() {
return skillDao;
}

@StrutsParameter(depth = 1)
public Skill getCurrentSkill() {
return currentSkill;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.struts2.showcase.async;

import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -34,10 +35,12 @@ public class ChatRoomAction extends ActionSupport {

private static final List<String> messages = new ArrayList<>();

@StrutsParameter
public void setMessage(String message) {
this.message = message;
}

@StrutsParameter
public void setLastIndex(Integer lastIndex) {
this.lastIndex = lastIndex;
}
Expand Down
Loading
Loading