Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
78 changes: 12 additions & 66 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -578,20 +578,9 @@ jobs:
# --workers=2 lets 2 spec files in a shard run concurrently;
# resource_class large (4 vCPU/8GB) is shared with the mysql +
# cbioportal + keycloak + clickhouse containers, so we cap at 2.
# Most of tests/local is a remote-database visual regression
# suite. Those snapshots intentionally are not part of this
# isolated ClickHouse migration gate: they depend on the shared
# staging dataset and its historical UI baselines. Keep the
# tests that exercise this stack's backend revision, SAML study
# authorization, and virtual-study lifecycle here; the complete
# backend and WSI API suites run in their own required jobs.
npx playwright test \
tests/local/version.spec.ts \
tests/local/coad-study-access.spec.ts \
tests/local/virtual-study.spec.ts \
npx playwright test tests/local \
--shard="${SHARD_NUM}/${CIRCLE_NODE_TOTAL}" \
--workers=2 \
--pass-with-no-tests \
--reporter=list,junit,blob
EXIT=$?
set -e
Expand Down Expand Up @@ -807,46 +796,20 @@ jobs:
command: |
export DOCKER_TAG=$CIRCLE_SHA1
docker load -i $DOCKER_TAG-web-shenandoah.tar
# Fork builds cannot receive the private staging context. Keep
# a fully local fallback available so the API suite still runs
# against the complete ClickHouse seed instead of failing before
# the application starts.
docker load -i $DOCKER_TAG.tar
- run:
name: Instantiate a cbioportal instance
environment:
APP_CLICKHOUSE_MODE: "true"
APP_CUSTOM_ARGS: << pipeline.parameters.custom_springboot_args >>
command: |
cd cbioportal-test
if [ -n "${CLICKHOUSE_URL:-}" ]; then
# Trusted builds use the migrated, read-only staging clone
# supplied by the CircleCI context. Never put these values in
# repository files or logs.
: "${CLICKHOUSE_USER:?CLICKHOUSE_USER must come from the migrated 3.1 CI context}"
: "${CLICKHOUSE_PASSWORD:?CLICKHOUSE_PASSWORD must come from the migrated 3.1 CI context}"
export DOCKER_IMAGE_CBIOPORTAL="cbioportal/cbioportal-dev:${CIRCLE_SHA1:?CIRCLE_SHA1 is required}-web-shenandoah"
echo "Starting API tests against the migrated ClickHouse staging clone"
nohup ./scripts/docker-compose.sh \
--compose_extensions='-f addon/clickhouse/docker-compose.remote.clickhouse.yml' \
>> /tmp/repos/docker-compose-logs.txt 2>&1 &
else
# Forked PRs do not receive organization contexts. Exercise
# the same suite against the image's complete local seed so
# this gate remains meaningful without distributing a
# credential or weakening the assertions.
export DOCKER_IMAGE_CBIOPORTAL="cbioportal/cbioportal-dev:${CIRCLE_SHA1:?CIRCLE_SHA1 is required}"
export CBIOPORTAL_SOURCE_DIR=/tmp/repos/cbioportal
docker image inspect "$DOCKER_IMAGE_CBIOPORTAL" >/dev/null
echo "CLICKHOUSE staging context unavailable; using the complete local ClickHouse seed"
# The web-and-data image is intentionally exploded (it does
# not contain app.jar), while docker-compose's default web
# profile launches that jar. Use the checked-in override with
# the exploded classpath and authentication disabled.
nohup ./scripts/docker-compose.sh \
--compose_extensions='-f /tmp/repos/cbioportal/.circleci/api-local-compose.yml' \
>> /tmp/repos/docker-compose-logs.txt 2>&1 &
fi
: "${CLICKHOUSE_URL:?CLICKHOUSE_URL must come from the clickhouse-public-staging-ro-user context}"
: "${CLICKHOUSE_USER:?CLICKHOUSE_USER must come from the clickhouse-public-staging-ro-user context}"
: "${CLICKHOUSE_PASSWORD:?CLICKHOUSE_PASSWORD must come from the clickhouse-public-staging-ro-user context}"
export DOCKER_IMAGE_CBIOPORTAL="cbioportal/cbioportal-dev:${CIRCLE_SHA1:?CIRCLE_SHA1 is required}-web-shenandoah"
nohup ./scripts/docker-compose.sh \
--compose_extensions='-f addon/clickhouse/docker-compose.remote.clickhouse.yml' \
>> /tmp/repos/docker-compose-logs.txt 2>&1 &
- run:
name: Wait for cbioportal to be live at localhost
command: |
Expand Down Expand Up @@ -885,24 +848,7 @@ jobs:
corepack enable
corepack prepare yarn@1.22.22 --activate
yarn install --frozen-lockfile
if [ -n "${CLICKHOUSE_URL:-}" ]; then
# The migrated staging context contains the complete API-test
# fixture set, so trusted runs execute the full suite.
yarn test -- --reporter mocha-junit-reporter
else
# Fork jobs cannot receive the private staging context. The
# public seed is intentionally schema/reference data only and
# cannot satisfy tests that assert on hundreds of staging
# studies. Keep this gate meaningful with deterministic smoke
# checks instead of reporting misleading data-test failures.
echo "CLICKHOUSE staging context unavailable; running local API smoke checks"
curl -fsS http://localhost:8080/api/health | jq -e '.status == "UP"'
curl -fsS http://localhost:8080/api/info | jq -e --arg sha "$CIRCLE_SHA1" '.gitCommitId == $sha'
docker exec cbioportal-database-container sh -lc \
'clickhouse-client --user "$CLICKHOUSE_USER" --password "$CLICKHOUSE_PASSWORD" \
--database "$CLICKHOUSE_DB" --query="SELECT count() FROM info WHERE db_schema_version IS NOT NULL"' \
| grep -q '^[1-9]'
fi
yarn test -- --reporter mocha-junit-reporter

- store_test_results:
path: /tmp/repos/api-test-results
Expand Down Expand Up @@ -942,7 +888,7 @@ jobs:
export WSI_CORE_REPOSITORY=raylim/cbioportal-core
# Pin the exact core PR commit so this test is reproducible and
# cannot silently follow a mutable personal-fork branch.
export WSI_CORE_REF=7316bd05542dbbf57bf29a6a74dfc4b600876b84
export WSI_CORE_REF=03b4f1d4463d80b3c3b28808822435c7c5ab9e5e
: > /tmp/repos/wsi-image-build.log
docker build \
--build-arg CORE_REPOSITORY="$WSI_CORE_REPOSITORY" \
Expand Down Expand Up @@ -1087,9 +1033,9 @@ jobs:
# This immutable fork commit keeps WSI hierarchy assertions in
# sync with the timeline-event timing contract in this PR.
git -C /tmp/repos/cbioportal-frontend-wsi fetch --depth 1 origin \
87039beae4bad5028e62096c6439bdcc3e7f21b7
79d9d604ebb547f728c98a5bce77a35375e1c9c9
git -C /tmp/repos/cbioportal-frontend-wsi checkout --detach \
87039beae4bad5028e62096c6439bdcc3e7f21b7
79d9d604ebb547f728c98a5bce77a35375e1c9c9
cd /tmp/repos/cbioportal-frontend-wsi
pnpm install --frozen-lockfile
- run:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.cbioportal.application.security.config;

import static org.springframework.security.config.Customizer.withDefaults;

import org.cbioportal.application.security.token.RestAuthenticationEntryPoint;
import org.cbioportal.application.security.token.TokenAuthenticationFilter;
import org.cbioportal.application.security.token.TokenAuthenticationSuccessHandler;
Expand Down Expand Up @@ -42,7 +40,6 @@ public class ApiSecurityConfig {
public SecurityFilterChain securityFilterChain(
HttpSecurity http, @Nullable DataAccessTokenService tokenService) throws Exception {
http.csrf(AbstractHttpConfigurer::disable)
.cors(withDefaults())
// This filter chain only grabs requests to the '/api' path.
.securityMatcher("/api/**", "/webservice.do")
.authorizeHttpRequests(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.cbioportal.application.security.config;

import jakarta.servlet.http.HttpServletRequest;
import java.util.List;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
Expand All @@ -13,8 +12,6 @@
@Configuration
@EnableWebSecurity
public class CorsConfig {
private static final String SAML_RESPONSE_PATH_PREFIX = "/login/saml2/sso/";

@Value("${security.cors.allowed-origins:}")
private String allowedOrigins;

Expand All @@ -28,10 +25,6 @@ CorsConfigurationSource corsConfigurationSource() {

CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(parsedAllowedOrigins);
// Spring rejects allowCredentials=true with the wildcard origin used by
// the public deployments. Enable credentials only for explicit origins
// such as the beta Netlify preview.
configuration.setAllowCredentials(!parsedAllowedOrigins.contains("*"));
configuration.setAllowedMethods(List.of("GET", "POST", "HEAD", "OPTIONS"));
configuration.setAllowedHeaders(
List.of(
Expand All @@ -40,23 +33,13 @@ CorsConfigurationSource corsConfigurationSource() {
"Accept",
"X-Requested-With",
"Content-Type",
"Authorization",
"Access-Control-Request-Method",
"Access-Control-Request-Headers",
"Content-Encoding",
"X-Proxy-User-Agreement",
"x-current-url"));
configuration.setExposedHeaders(List.of("total-count", "sample-count", "elapsed-time"));
source.registerCorsConfiguration("/**", configuration);
return request -> isSamlResponseRequest(request) ? null : source.getCorsConfiguration(request);
}

private static boolean isSamlResponseRequest(HttpServletRequest request) {
String requestPath = request.getRequestURI();
String contextPath = request.getContextPath();
if (!contextPath.isEmpty() && requestPath.startsWith(contextPath)) {
requestPath = requestPath.substring(contextPath.length());
}
return requestPath.startsWith(SAML_RESPONSE_PATH_PREFIX);
return source;
}
}

This file was deleted.

Loading