Fix Base64 encoding mismatch for complex keys in OpenAPI endpoints #5506
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's the purpose of this PR
OpenAPI calls with complex configuration keys containing special characters (
@,/, etc.) fail with 404 errors due to inconsistent Base64 encoding between portal and admin service layers.Which issue(s) this PR fixes:
Fixes #5361
Brief changelog
Root cause: Mixed use of standard and URL-safe Base64 variants across the stack:
Base64.getEncoder())Base64.getUrlDecoder())Base64.getDecoder())Standard Base64 uses
+and/which break when passed in URL paths.Changes:
AdminServiceAPI.loadItemByEncodeKey(): UseBase64.getUrlEncoder().withoutPadding()ItemController(OpenAPI): UseBase64.getUrlDecoder()ingetItemByEncodedKey(),updateItemByEncodedKey(),deleteItemByEncodedKey()wonfu.soa.circuit-breaker.enable.gitea-svc@/api/v1/fetchWorkflowsExample:
Follow this checklist to help us incorporate your contribution quickly and easily:
mvn clean testto make sure this pull request doesn't break anything.mvn spotless:applyto format your code.CHANGESlog.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
central.sonatype.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -classpath /home/REDACTED/work/apollo/apollo/.mvn/wrapper/maven-wrapper.jar -Dmaven.home=/home/REDACTED/work/apollo -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/apollo/apollo org.apache.maven.wrapper.MavenWrapperMain dependency:tree -pl apollo-portal(dns block)/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -classpath /home/REDACTED/work/apollo/apollo/.mvn/wrapper/maven-wrapper.jar -Dmaven.home=/home/REDACTED/work/apollo -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/apollo/apollo org.apache.maven.wrapper.MavenWrapperMain clean compile -DskipTests -pl apollo-portal -am(dns block)/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -classpath /home/REDACTED/work/apollo/apollo/.mvn/wrapper/maven-wrapper.jar -Dmaven.home=/home/REDACTED/work/apollo -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/apollo/apollo org.apache.maven.wrapper.MavenWrapperMain test-compile -DskipTests -pl apollo-adminservice(dns block)www.puppycrawl.com/opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/apollo/.codeql-scratch/dbs/java/working/files-to-index9376146935169518576.list --sourceArchiveDir=/home/REDACTED/work/apollo/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/apollo/.codeql-scratch/dbs/java/trap/java(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.