unbridled-41 commented on PR #6005:
URL:
https://github.com/apache/rocketmq-dashboard/pull/6005#issuecomment-6091381730
### Follow-up review of this fix: the bound was never applied, and it did
not fit the column
Two problems in the first commit, both found by re-reading the change
against the column it targets (`rmq_k8s_cert.issuer VARCHAR(256)`):
1. **The helper was dead code.** `boundedIssuer(...)` was added but the
derived DN was still assigned the unbounded principal name, so the long-DN case
this PR is about was unchanged.
2. **The bound was off by the marker.** The helper returned up to 256
characters and *then* appended `...`, producing 259 — three over the column,
i.e. a truncation that still failed the insert it was meant to save.
Commit `c5dcbe27` fixes both in this branch (the original commit `9d23c631`
is untouched, no force-push):
```java
issuer = boundedIssuer(parsed.getIssuerX500Principal().getName());
...
return TextBounds.truncate(issuer, ISSUER_MAX_LENGTH -
TRUNCATION_MARKER.length(),
TRUNCATION_MARKER);
```
`ISSUER_MAX_LENGTH` is 256 and `TRUNCATION_MARKER` is `"..."`, so the marker
is part of the budget — the same rule `InstanceService` applies to its bounded
remark. The test now asserts the truncated value is exactly 256 code points and
keeps the `CN=` prefix, instead of asserting the pre-fix length.
Verified at the current head (`c5dcbe27`):
```
cd server && mvn -o -B -ntp test
-Dtest='org.apache.rocketmq.studio.cluster.k8s.**'
```
(The module suite, including `K8sCertServiceTest`, is green; the same run is
recorded in the verification comment below.)
Branch `fix/k8s-issuer-bound`, HEAD `c5dcbe27` (on top of `9d23c631`).
--
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]