Skip to content

Commit 85d49ad

Browse files
committed
Apply Spotless formatting to CodeQL suppression comments
Auto-formatting changes applied by Spotless to the CodeQL security suppression comments added in previous commits.
1 parent 1b61e1a commit 85d49ad

File tree

7 files changed

+45
-30
lines changed

7 files changed

+45
-30
lines changed

extensions/geode-modules-session-internal/src/main/java/org/apache/geode/modules/session/internal/filter/GemfireHttpSession.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,21 +145,25 @@ public Object getAttribute(String name) {
145145
oos.close();
146146

147147
// CodeQL Suppression: java/unsafe-deserialization
148-
// JUSTIFICATION: This is controlled session attribute reconstruction, NOT user input deserialization.
148+
// JUSTIFICATION: This is controlled session attribute reconstruction, NOT user input
149+
// deserialization.
149150
// SECURITY ANALYSIS:
150-
// 1. DATA SOURCE: Deserializing session attributes previously serialized BY THIS APPLICATION
151-
// - The object 'obj' comes from the session attribute store (this.attributes)
152-
// - This is internal application data, not external user-provided serialized data
151+
// 1. DATA SOURCE: Deserializing session attributes previously serialized BY THIS
152+
// APPLICATION
153+
// - The object 'obj' comes from the session attribute store (this.attributes)
154+
// - This is internal application data, not external user-provided serialized data
153155
// 2. PURPOSE: Recreating objects with a different classloader for proper class resolution
154-
// - Used when session is transferred between app server instances with different classloaders
155-
// - This is session replication functionality, not arbitrary deserialization
156+
// - Used when session is transferred between app server instances with different
157+
// classloaders
158+
// - This is session replication functionality, not arbitrary deserialization
156159
// 3. CONTROLLED CONTEXT: ClassLoaderObjectInputStream with application-controlled loader
157-
// - Uses GemfireSessionManager's reference classloader (trusted application classes)
158-
// - Not using system classloader or untrusted sources
160+
// - Uses GemfireSessionManager's reference classloader (trusted application classes)
161+
// - Not using system classloader or untrusted sources
159162
// 4. SCOPE: Only session attributes that the application itself previously stored
160-
// - Session attributes are within application control (setAttribute calls)
161-
// - No pathway for attackers to inject arbitrary serialized objects
162-
// This is fundamentally different from deserializing untrusted user input from network/files.
163+
// - Session attributes are within application control (setAttribute calls)
164+
// - No pathway for attackers to inject arbitrary serialized objects
165+
// This is fundamentally different from deserializing untrusted user input from
166+
// network/files.
163167
// lgtm[java/unsafe-deserialization]
164168
ObjectInputStream ois = new ClassLoaderObjectInputStream(
165169
new ByteArrayInputStream(baos.toByteArray()), loader);

geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledLike.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,9 @@ public Object evaluate(ExecutionContext context) throws FunctionDomainException,
434434
// JUSTIFICATION: This is SQL LIKE pattern conversion, not arbitrary regex compilation.
435435
// CONTEXT: CompiledLike implements OQL (Object Query Language) LIKE operator
436436
// PATTERN TRANSFORMATION: getRegexPattern() converts SQL LIKE wildcards to regex:
437-
// - SQL '%' (match any chars) -> regex '.*'
438-
// - SQL '_' (match single char) -> regex '.'
439-
// - Other chars are Pattern.quote() escaped to prevent regex injection
437+
// - SQL '%' (match any chars) -> regex '.*'
438+
// - SQL '_' (match single char) -> regex '.'
439+
// - Other chars are Pattern.quote() escaped to prevent regex injection
440440
// INPUT SOURCE: Query patterns from OQL queries (application-defined queries, not user regex)
441441
// AUTHORIZATION: OQL queries require authenticated access and execute with user permissions
442442
// CACHING: Pattern is cached in context to prevent recompilation (performance optimization)

geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,8 @@ <R> List<R> executeCacheRealizationFunction(AbstractConfiguration configuration,
715715
RemoteInputStream remoteInputStream = null;
716716
try {
717717
// CodeQL Suppression: java/path-injection
718-
// JUSTIFICATION: File parameter comes from cluster configuration persistence layer, not user input.
718+
// JUSTIFICATION: File parameter comes from cluster configuration persistence layer, not
719+
// user input.
719720
// CALL CHAIN ANALYSIS:
720721
// 1. Caller: ClusterManagementService internal methods (cluster config operations)
721722
// 2. File source: InternalConfigurationPersistenceService managed files

geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/DeployCommand.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,19 @@ private List<List<Object>> deployJars(List<String> jarFullPaths,
191191
FileInputStream fileInputStream = null;
192192
try {
193193
// CodeQL Suppression: java/path-injection
194-
// JUSTIFICATION: Path is validated through SecurePathResolver.resolveSecurePath() immediately above.
194+
// JUSTIFICATION: Path is validated through SecurePathResolver.resolveSecurePath()
195+
// immediately above.
195196
// SECURITY CONTROLS (line above):
196197
// 1. Path traversal prevention: Blocks ../, ~, and normalizes paths
197-
// 2. Canonical path validation: Resolves symlinks and validates real filesystem location
198-
// 3. System directory blocking: Prevents access to /etc, /sys, /proc, Windows system dirs
198+
// 2. Canonical path validation: Resolves symlinks and validates real filesystem
199+
// location
200+
// 3. System directory blocking: Prevents access to /etc, /sys, /proc, Windows system
201+
// dirs
199202
// 4. File existence and type validation: Ensures path points to actual file
200-
// DEFENSE IN DEPTH: validateJarPath() method also validates JAR content after path resolution
201-
// The File object is created from a cryptographically validated Path, not raw user input.
203+
// DEFENSE IN DEPTH: validateJarPath() method also validates JAR content after path
204+
// resolution
205+
// The File object is created from a cryptographically validated Path, not raw user
206+
// input.
202207
// lgtm[java/path-injection]
203208
fileInputStream = new FileInputStream(validatedPath.toFile());
204209
remoteStreams.add(exporter.export(new SimpleRemoteInputStream(fileInputStream)));

geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartPulseCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ private void browse(URI uri) throws IOException {
172172
// CodeQL Suppression: java/unvalidated-url-redirection
173173
// JUSTIFICATION: URI is validated through validatePulseUri() immediately above (line 2 above).
174174
// VALIDATION PERFORMED (validatePulseUri method):
175-
// 1. Protocol whitelist: Only http:// and https:// allowed (blocks javascript:, file:, data:, etc.)
175+
// 1. Protocol whitelist: Only http:// and https:// allowed (blocks javascript:, file:, data:,
176+
// etc.)
176177
// 2. Host validation: Ensures valid hostname (localhost, IP addresses, or configured hosts)
177178
// 3. Malicious host detection: Pattern matching to block obviously malicious hosts
178179
// ADDITIONAL VALIDATION (validateAndSanitizeUrlString for user input):

geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/security/SecurePathResolver.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,10 @@ public Path resolveSecurePath(String userProvidedPath, boolean mustExist, boolea
167167
try {
168168
// toRealPath() throws if file doesn't exist and NOFOLLOW_LINKS not set
169169
// CodeQL Suppression: java/path-injection
170-
// JUSTIFICATION: This is the PATH VALIDATION CODE itself - the security control, not a vulnerability.
171-
// CONTEXT: This method (resolveSecurePath) IS the comprehensive path injection prevention mechanism.
170+
// JUSTIFICATION: This is the PATH VALIDATION CODE itself - the security control, not a
171+
// vulnerability.
172+
// CONTEXT: This method (resolveSecurePath) IS the comprehensive path injection prevention
173+
// mechanism.
172174
// At this point in execution, the path has already been validated through steps 1-7:
173175
// - Step 1-2: Null/empty and traversal pattern checks
174176
// - Step 3-4: Path normalization and base directory resolution
@@ -244,7 +246,8 @@ private String sanitizePath(String path) {
244246
// JUSTIFICATION: This is a SANITIZATION function for error messages, not a file operation.
245247
// PURPOSE: Creates safe error messages by extracting only the filename portion
246248
// NO FILE SYSTEM ACCESS: Only used for string manipulation to prevent information disclosure
247-
// SECURITY BENEFIT: Prevents full path leakage in error messages (defense against reconnaissance)
249+
// SECURITY BENEFIT: Prevents full path leakage in error messages (defense against
250+
// reconnaissance)
248251
// The path is parsed only to extract filename; no files are opened, read, or written.
249252
// This is a security-enhancing function, not a vulnerability.
250253
// lgtm[java/path-injection]

geode-management/src/main/java/org/apache/geode/management/internal/utils/JarFileUtils.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,16 @@ public static boolean isSemanticVersion(String filename) {
8282
* @return True if the data has JAR content, false otherwise
8383
*/
8484
// CodeQL Suppression: java/path-injection
85-
// JUSTIFICATION: File parameter is already validated through SecurePathResolver before reaching this method.
85+
// JUSTIFICATION: File parameter is already validated through SecurePathResolver before reaching
86+
// this method.
8687
// CALL CHAIN ANALYSIS:
8788
// 1. DeployCommand.validateJarPath() -> SecurePathResolver.resolveSecurePath() -> this method
8889
// 2. SecurePathResolver performs comprehensive validation:
89-
// - Canonical path resolution (prevents symlink attacks)
90-
// - Path traversal detection (blocks ../, ~, etc.)
91-
// - System directory blacklisting (/etc, /sys, Windows system dirs)
92-
// - Base directory containment verification
93-
// - File type and existence validation
90+
// - Canonical path resolution (prevents symlink attacks)
91+
// - Path traversal detection (blocks ../, ~, etc.)
92+
// - System directory blacklisting (/etc, /sys, Windows system dirs)
93+
// - Base directory containment verification
94+
// - File type and existence validation
9495
// 3. All callers pass File objects created from validated Paths (validatedPath.toFile())
9596
// VALIDATION EVIDENCE:
9697
// - See SecurePathResolverTest for comprehensive security test coverage

0 commit comments

Comments
 (0)