Skip to content

Commit a67480b

Browse files
committed
Merge branch '7.10'
2 parents a51d52a + 3501994 commit a67480b

File tree

83 files changed

+2562
-1482
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+2562
-1482
lines changed

.sdkmanrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Enable auto-env through the sdkman_auto_env config
22
# Add key=value pairs of SDKs to use below
3-
java=21.0.7-tem
3+
java=21.0.8-tem
44

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,34 @@ DO NOT ADD CHANGES HERE - ADD THEM USING log_change.sh
1313
~~~
1414

1515

16+
* Issue **#5135** : Fix proxy multi part gzip handling.
17+
18+
* Uplift JDK to 21.0.8_9 in docker images and sdkmanrc.
19+
20+
* Issue **#5130** : Fix raw size meta bug.
21+
22+
* Issue **#5132** : Fix missing session when AWS ALB does the code flow.
23+
24+
* Fix the OpenID code flow to stop the session being lost after redirection back to the initiating URL.
25+
26+
* Issue **#5101** : Fix select-all filtering when doing a reprocess of everything in a folder. It no longer tries to re-process deleted items streams.
27+
28+
* Issue **#5086** : Improve stream error handling.
29+
30+
* Change the resource store to not rely on sessions. Resources are now linked to a user.
31+
32+
* Issue **#5114** : Improve handling of loss of connection to IDP.
33+
34+
* Change the way security filter decides whether to authenticate or not, e.g. how it determines what is a static resource that does not need authentication.
35+
36+
* Issue **#5115** : Use correct header during proxy forward requests.
37+
38+
* Issue **#5121** : Proxy aggregation now keeps only common headers in aggregated data.
39+
40+
* Fix exception handling of DistributedTaskFetcher so it will restart after failure.
41+
42+
* Issue **#5127** : Maintain case for proxy meta attributes when logging.
43+
1644
* Issue **#5091** : Stop reference data loads failing if there are no entries in the stream.
1745

1846
* Add `ReceiptId` to the INFO message on data receipt.

scripts/export_content.sh

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
#!/usr/bin/env bash
2+
3+
set -e -o pipefail
4+
5+
showUsage() {
6+
echo -e "Usage: ${BLUE}$0 [OPTION]... [UUID]...${NC}"
7+
echo -e "OPTIONs:"
8+
echo -e " ${GREEN}-d${NC} - The data file to read from (or '-' for stdin)"
9+
echo -e " ${GREEN}-u${NC} - The base URL to use. If not set, uses http://localhost:8080"
10+
echo -e " ${GREEN}-o${NC} - The file path to export to. If not set it will be written to the current directory with the resource name"
11+
echo -e "UUID:"
12+
echo -e " Each UUID is of the form '<UUID>,<Type>', e.g. '18d92d74-a5aa-4a81-83be-46fb6d84a60e,Pipeline'"
13+
echo -e "e.g.: ${BLUE}$0 -d - ${NC} - Exports all UUIDs in std into a file in this directory"
14+
echo
15+
}
16+
17+
setup_echo_colours() {
18+
# Exit the script on any error
19+
set -e
20+
21+
# shellcheck disable=SC2034
22+
if [ "${MONOCHROME}" = true ]; then
23+
RED=''
24+
GREEN=''
25+
YELLOW=''
26+
BLUE=''
27+
BLUE2=''
28+
DGREY=''
29+
NC='' # No Colour
30+
else
31+
RED='\033[1;31m'
32+
GREEN='\033[1;32m'
33+
YELLOW='\033[1;33m'
34+
BLUE='\033[1;34m'
35+
BLUE2='\033[1;34m'
36+
DGREY='\e[90m'
37+
NC='\033[0m' # No Colour
38+
fi
39+
}
40+
41+
debug_value() {
42+
local name="$1"; shift
43+
local value="$1"; shift
44+
45+
if [ "${IS_DEBUG}" = true ]; then
46+
echo -e "${DGREY}DEBUG ${name}: ${value}${NC}"
47+
fi
48+
}
49+
50+
debug() {
51+
local str="$1"; shift
52+
53+
if [ "${IS_DEBUG}" = true ]; then
54+
echo -e "${DGREY}DEBUG ${str}${NC}"
55+
fi
56+
}
57+
58+
main() {
59+
IS_DEBUG=false
60+
#SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
61+
62+
setup_echo_colours
63+
64+
local uuids_arr=()
65+
local url_base
66+
local data_filename
67+
local output_filename
68+
69+
if [[ -z "${TOKEN}" ]]; then
70+
echo -e "${RED}Environment variable TOKEN must be set with an API key or an OAuth token${NC}" >&2
71+
exit 1
72+
fi
73+
74+
while [ ${OPTIND} -le "$#" ]; do
75+
if getopts d:ho:u: option
76+
then
77+
case ${option} in
78+
h)
79+
showUsage
80+
;;
81+
u)
82+
if [[ -z "${OPTARG}" ]]; then
83+
echo -e "${RED}-u argument requires a base URL to be specified${NC}" >&2
84+
echo
85+
showUsage
86+
exit 1
87+
fi
88+
url_base="${OPTARG}"
89+
;;
90+
d)
91+
if [[ -z "${OPTARG}" ]]; then
92+
echo -e "${RED}-d argument requires a filename or '-' to read from stdin${NC}" >&2
93+
echo
94+
showUsage
95+
exit 1
96+
fi
97+
data_filename="${OPTARG}"
98+
;;
99+
o)
100+
if [[ -z "${OPTARG}" ]]; then
101+
echo -e "${RED}-o argument requires a file path to output to${NC}" >&2
102+
echo
103+
showUsage
104+
exit 1
105+
fi
106+
output_filename="${OPTARG}"
107+
;;
108+
esac
109+
else
110+
uuids_arr+=("${!OPTIND}")
111+
((OPTIND++))
112+
fi
113+
done
114+
115+
# Add all the uuids from file/stdin
116+
if [[ -n "${data_filename}" ]]; then
117+
if [[ "${data_filename}" = "-" ]]; then
118+
data_filename="/dev/stdin"
119+
fi
120+
121+
while read -r line; do
122+
uuids_arr+=( "${line}" )
123+
done < "${data_filename}"
124+
fi
125+
126+
if [[ "${#uuids_arr[@]}" -eq 0 ]]; then
127+
echo "No UUIDs to export" >&2
128+
exit 1
129+
fi
130+
131+
132+
local uuids_str
133+
uuids_str=$( printf "%s\n" "${uuids_arr[@]}" )
134+
local req_json
135+
req_json=$( \
136+
jq -R -s '{
137+
docRefs: [
138+
split("\n")[]
139+
| select(length > 0)
140+
| split(",")
141+
| {uuid: .[0], type: .[1]}
142+
]
143+
}' <<< "${uuids_str}" )
144+
145+
#echo -e "${req_json}"
146+
147+
if [[ -z "${url_base}" ]]; then
148+
url_base="http://localhost:8080"
149+
fi
150+
151+
local export_url="${url_base}/api/content/v1/export"
152+
local resource_url="${url_base}/resourcestore/"
153+
154+
local resource_key_json
155+
resource_key_json=$( \
156+
echo -e "${req_json}" | curl \
157+
-s \
158+
--request POST \
159+
-H "Content-Type:application/json" \
160+
-H "Authorization:Bearer ${TOKEN}" \
161+
-d @- \
162+
"${export_url}" )
163+
164+
#echo -e "${resource_key_json}"
165+
166+
local key
167+
local name
168+
key=$( jq -r '.resourceKey.key' <<< "${resource_key_json}" )
169+
name=$( jq -r '.resourceKey.name' <<< "${resource_key_json}" )
170+
if [[ -z "${output_filename}" ]]; then
171+
output_filename="${name}"
172+
fi
173+
174+
echo -e "${GREEN}Downloading resource ${YELLOW}${key}${GREEN} to file ${BLUE}${output_filename}${NC}"
175+
resource_url="${resource_url}?uuid=${key}"
176+
#echo -e "${resource_url}"
177+
178+
curl \
179+
-s \
180+
--output "${name}" \
181+
-H "Authorization: Bearer $TOKEN" \
182+
"${resource_url}"
183+
184+
185+
#http POST http://localhost:8080/api/content/v1/export "Authorization:Bearer ${TOKEN}"
186+
#| jq -r '.resourceKey.key') && curl --output content.zip -H "Authorization: Bearer $TOKEN" http://localhost:8080/resourcestore/\?uuid\=$key
187+
188+
}
189+
190+
main "$@"

scripts/import_content.sh

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#!/usr/bin/env bash
2+
3+
# Script to import a single Stroom content pack ZIP file into Stroom.
4+
# Requires that the environment variable TOKEN is set with either a
5+
# valid API Key or an OAuth token.
6+
# Usage:
7+
# import_content.sh CONTENT_ZIP_FILE [URL_BASE]
8+
# e.g. import_content.sh /some/path/StroomConfig.zip
9+
# e.g. import_content.sh /some/path/StroomConfig.zip https://stroom.some.domain
10+
11+
set -e -o pipefail
12+
13+
showUsage() {
14+
echo -e "Usage: ${BLUE}$0 [OPTION]... FILE${NC}"
15+
echo -e "OPTIONs:"
16+
echo -e " ${GREEN}-d${NC} - The data file to read from (or '-' for stdin)"
17+
echo -e " ${GREEN}-u${NC} - The base URL to use. If not set, uses http://localhost:8080"
18+
echo -e " ${GREEN}-o${NC} - The file path to export to. If not set it will be written to the current directory with the resource name"
19+
echo -e "FILE: The file to import"
20+
echo -e "e.g.: ${BLUE}$0 content.zip${NC}"
21+
echo -e "e.g.: ${BLUE}$0 -u content.zip${NC}"
22+
echo
23+
}
24+
25+
main() {
26+
if [[ -z "${TOKEN}" ]]; then
27+
echo -e "${RED}Environment variable TOKEN must be set with an API key or an OAuth token${NC}" >&2
28+
exit 1
29+
fi
30+
31+
while getopts hu: option; do
32+
case ${option} in
33+
h)
34+
showUsage
35+
;;
36+
u)
37+
if [[ -z "${OPTARG}" ]]; then
38+
echo -e "${RED}-u argument requires a base URL to be specified${NC}" >&2
39+
echo
40+
showUsage
41+
exit 1
42+
fi
43+
url_base="${OPTARG}"
44+
;;
45+
esac
46+
done
47+
48+
# shellcheck disable=SC2124
49+
local content_zip_file="${@:$OPTIND:1}"; shift
50+
if [[ -z "${content_zip_file}" ]]; then
51+
echo -e "${RED}content_zip_file argument must be provided${NC}" >&2
52+
exit 1
53+
fi
54+
55+
if [[ -z "${url_base}" ]]; then
56+
url_base="http://localhost:8080"
57+
fi
58+
59+
echo -e "${GREEN}Uploading file '${BLUE}${content_zip_file}${GREEN}' to a temporary file${NC}"
60+
61+
local response1
62+
response1="$( \
63+
curl \
64+
--silent \
65+
--header "Authorization: Bearer ${TOKEN}" \
66+
--form "encoding=multipart/form-data" \
67+
--form fileUpload="@${content_zip_file}" \
68+
--request POST \
69+
"${url_base}/importfile.rpc" \
70+
)"
71+
72+
echo -e "${GREEN}File uploaded${NC}"
73+
74+
echo -e "${response1}"
75+
# response1 looks like
76+
# '#PM#success=true name=StroomConfig.zip key=e015e5d4-8a6a-4454-8d81-913e6c13cca5#PM#'
77+
78+
local key
79+
key="$( \
80+
grep \
81+
--only-matching \
82+
--perl-regexp \
83+
'(?<=key=)[^ #]+' \
84+
<<< "${response1}"
85+
)"
86+
87+
# name is only really used for logging purposes in stroom, but provide
88+
# it anyway
89+
local name
90+
name="$( \
91+
grep \
92+
--only-matching \
93+
--perl-regexp \
94+
'(?<=name=)[^ #]+' \
95+
<<< "${response1}"
96+
)"
97+
98+
local import_request
99+
import_request="{ \"confirmList\": [], \"importSettings\": { \"importMode\": \"IGNORE_CONFIRMATION\" }, \"resourceKey\": { \"key\": \"${key}\", \"name\": \"${name}\" } }"
100+
101+
echo "Importing content"
102+
103+
# Not interested in the response
104+
curl \
105+
--silent \
106+
--request POST \
107+
--header "Authorization:Bearer ${TOKEN}" \
108+
--header 'Content-Type: application/json' \
109+
--data "${import_request}" \
110+
"${url_base}/api/content/v1/import" \
111+
> /dev/null
112+
113+
echo "Content imported successfully"
114+
echo "Done!"
115+
}
116+
117+
main "$@"

stroom-activity/stroom-activity-impl/src/main/java/stroom/activity/impl/CurrentActivityImpl.java

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
import stroom.activity.api.CurrentActivity;
2020
import stroom.activity.shared.Activity;
2121
import stroom.security.api.SecurityContext;
22+
import stroom.util.servlet.SessionUtil;
2223

2324
import com.google.inject.Inject;
2425
import jakarta.inject.Provider;
2526
import jakarta.servlet.http.HttpServletRequest;
26-
import jakarta.servlet.http.HttpSession;
2727
import org.slf4j.Logger;
2828
import org.slf4j.LoggerFactory;
2929

@@ -49,17 +49,7 @@ public Activity getActivity() {
4949

5050
try {
5151
final HttpServletRequest request = httpServletRequestProvider.get();
52-
if (request != null) {
53-
final HttpSession session = request.getSession(false);
54-
if (session != null) {
55-
final Object object = session.getAttribute(NAME);
56-
if (object instanceof Activity) {
57-
activity = (Activity) object;
58-
}
59-
} else {
60-
LOGGER.debug("No Session");
61-
}
62-
}
52+
activity = SessionUtil.getAttribute(request, NAME, Activity.class, false);
6353
} catch (final RuntimeException e) {
6454
LOGGER.debug(e.getMessage(), e);
6555
}
@@ -72,14 +62,7 @@ public Activity getActivity() {
7262
public void setActivity(final Activity activity) {
7363
securityContext.secure(() -> {
7464
final HttpServletRequest request = httpServletRequestProvider.get();
75-
if (request != null) {
76-
final HttpSession session = request.getSession(false);
77-
if (session != null) {
78-
session.setAttribute(NAME, activity);
79-
} else {
80-
LOGGER.debug("No Session");
81-
}
82-
}
65+
SessionUtil.setAttribute(request, NAME, activity, false);
8366
});
8467
}
8568
}

0 commit comments

Comments
 (0)