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

SWC-6754 - Do not cache version check #5614

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

nickgros
Copy link
Contributor

@nickgros nickgros commented Jan 9, 2025

SWC-6754

  • Also add log to report instances where the servlet is not configured with a repo endpoint

- Also add log to report instances where the servlet is not configured with a repo endpoint
Comment on lines +101 to +109

logger.warning(
"No configuration found for " +
REPO_ENDPOINT_KEY +
", so servlet request will defer to the host header. Host: " +
host +
", endpointPrefix: " +
endpointPrefix
);
Copy link
Contributor Author

@nickgros nickgros Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the main problem is that our servlet may use the request header to pick a backend endpoint instead of a configuration parameter, if the configuration parameter is not present. The servlet may cache a response that depends on a header that could vary (or be spoofed!) by different users.

WDYT about opening a follow-up ticket to make the org.sagebionetworks.repositoryservice.endpoint (REPO_ENDPOINT_KEY) required?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up ticket to make this mandatory seems reasonable

@@ -35,11 +31,14 @@ public class VersionsServlet extends HttpServlet {
VersionsServlet.perThreadRequest.get()
);

private final Supplier<SynapseVersionInfo> synapseVersionCache =
Suppliers.memoizeWithExpiration(versionSupplier(), 5, TimeUnit.MINUTES);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was added because John identified the web client as performing a DOS attack with version checks. Would expiring this cache every 10 seconds be sufficient?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants