tanishqgandhi1908 opened a new pull request, #8547:
URL: https://github.com/apache/texera/pull/8547

   ### What changes were proposed in this PR?
   
   The validation job prints the image's own start command before it prints the 
digest it resolved, and the digest was read from the **first** marker line in 
the log:
   
   ```
   echo "Start command: $START_CMD"      <- the image's Config.Cmd, its 
author's to choose
   ...
   echo "TEXERA_SOURCE_DIGEST=$DIGEST"   <- what the check actually resolved
   ```
   
   ```scala
   log.linesIterator.map(_.trim).find(_.startsWith(DigestMarker))
   ```
   
   So an image whose `Cmd` carries a newline and a marker of its own passes the 
check — its `Cmd` still contains `computing-unit-master` — while naming the 
digest every unit is then pinned to. That defeats what the pin is for: the row 
is supposed to record the bytes the check approved.
   
   Closed at both ends:
   
   - the start command is echoed through `tr`, so an image cannot put a line 
into the log at all;
   - the digest is read from the **last** marker line, which is the one the job 
writes last.
   
   Either alone would do. Both, because the first depends on a shell pipeline 
and the second on the script's ordering, and neither is obvious to a later 
reader.
   
   ### Any related issues, documentation, discussions?
   
   Follow-up to #8475, found while reviewing #8546.
   
   ### How was this PR tested?
   
   A test with a log in the shape the attack produces — a `Cmd` containing 
`computing-unit-master`, a newline, and a marker naming a different digest — 
asserting the digest the job resolved is the one returned.
   
   ```
   sbt "ComputingUnitManagingService/test" "Config/test" scalafmtCheckAll
     185 passed, 0 failed
     72 passed, 0 failed
     clean
   ```
   
   Mutation-checked: restoring the first-match read fails exactly that test.
   
   The `tr` half was checked against a real shell rather than assumed, since a 
Scala triple-quoted string passes backslashes through untouched:
   
   ```
   $ START_CMD='[computing-unit-master
   TEXERA_SOURCE_DIGEST=sha256:evil]'
   $ echo "Start command: $(printf '%s' "$START_CMD" | tr '\n' ' ')"
   Start command: [computing-unit-master TEXERA_SOURCE_DIGEST=sha256:evil]
   ```
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 5)
   


-- 
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