nzw921rx opened a new issue, #10590:
URL: https://github.com/apache/seatunnel/issues/10590

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   
   
   ### What happened
   
   When submitting a job via REST API with `shade.identifier` configured in the 
`env` section, `ConfigShadeUtils.decryptConfig()` is **only invoked for JSON 
format** submissions. HOCON format, SQL format, and the upload-file endpoint 
(`/submit-job/upload`) all skip the decryption step, causing `shade.identifier` 
and `shade.options` to be silently ignored.
   **Root Cause:**
   In `JobInfoService.submitJob(Map, byte[])`, the HOCON and SQL branches 
directly call `ConfigFactory.parseString()` / `SqlConfigBuilder.of()` without 
calling `ConfigShadeUtils.decryptConfig()`:
   
   ```java
   switch (configFormat) {
       case HOCON:
           config = ConfigFactory.parseString(new String(requestBody, 
StandardCharsets.UTF_8));
           // ❌ Missing: ConfigShadeUtils.decryptConfig(config)
           break;
       case SQL:
           config = SqlConfigBuilder.of(new String(requestBody, 
StandardCharsets.UTF_8));
           // ❌ Missing: ConfigShadeUtils.decryptConfig(config)
           break;
       case JSON:
       default:
           config = RestUtil.buildConfig(requestHandle(requestBody), false);
           // ✅ Decrypt happens inside ConfigBuilder.of(objectMap, false)
           break;
   }
   ```
   
   The JSON branch works because `RestUtil.buildConfig()` → 
`ConfigBuilder.of(Map, boolean)` internally calls 
`ConfigShadeUtils.decryptConfig()`.
   Similarly, `SubmitJobByUploadFileServlet` never calls decrypt for **any** 
format, and it uses the `submitJob(Map, Config)` overload which also has no 
decrypt logic.
   **Summary of affected endpoints:**
   | Endpoint | Format | Decryption Applied? |
   |----------|--------|:---:|
   | `POST /submit-job` | JSON (default) | ✅ Yes |
   | `POST /submit-job?config_format=hocon` | HOCON | ❌ No |
   | `POST /submit-job?config_format=sql` | SQL | ❌ No |
   | `POST /submit-job/upload` | ALL formats | ❌ No |
   | `POST /submit-jobs` | JSON | ✅ Yes |
   | CLI `seatunnel.sh` | ALL formats | ✅ Yes |
   
   
   ### SeaTunnel Version
   
   2.3.12
   2.3.13
   
   ### SeaTunnel Config
   
   ```conf
   env {
     job.mode = "BATCH"
     shade.identifier = "base64"
   }
   
   source {
     FakeSource {
       row.num = 10
       username = "c2VhdHVubmVs"
       password = "c2VhdHVubmVsX3Bhc3N3b3Jk"
       schema {
         fields {
           name = "string"
         }
       }
     }
   }
   
   transform {
   }
   
   sink {
     Console {}
   }
   ```
   
   ### Running Command
   
   ```shell
   # Submit with HOCON format — shade decryption is NOT applied (bug)
   curl -X POST 
'http://localhost:5801/hazelcast/rest/maps/submit-job?config_format=hocon' \
     -H 'Content-Type: text/plain' \
     -d 'env {
     job.mode = "BATCH"
     shade.identifier = "base64"
   }
   source {
     FakeSource {
       row.num = 10
       username = "c2VhdHVubmVs"
       password = "c2VhdHVubmVsX3Bhc3N3b3Jk"
       schema { fields { name = "string" } }
     }
   }
   transform {}
   sink { Console {} }'
   
   # Submit with JSON format — shade decryption IS applied (works correctly)
   curl -X POST 'http://localhost:5801/hazelcast/rest/maps/submit-job' \
     -H 'Content-Type: application/json' \
     -d '{
     "env": {"job.mode":"BATCH","shade.identifier":"base64"},
     "source": 
[{"plugin_name":"FakeSource","row.num":10,"username":"c2VhdHVubmVs","password":"c2VhdHVubmVsX3Bhc3N3b3Jk","schema":{"fields":{"name":"string"}}}],
     "transform": [],
     "sink": [{"plugin_name":"Console"}]
   }'
   ```
   
   ### Error Exception
   
   ```log
   No exception is thrown. The encrypted values (e.g. `c2VhdHVubmVs`) are 
passed through to the connector without being decrypted, causing authentication 
failures or incorrect data at the connector level.
   With HOCON format, the `shade.identifier = "base64"` in the env section is 
completely ignored — `ConfigShadeUtils.decryptConfig()` is never called.
   ```
   
   ### Zeta or Flink or Spark Version
   
   _No response_
   
   ### Java or Scala Version
   
   _No response_
   
   ### Screenshots
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to