fix(urns): prevent corrupting whitespace trailing or leading urns to be created (#3348)

This commit is contained in:
Gabe Lyons 2021-10-08 11:55:03 -07:00 committed by GitHub
parent 03bbfd0b2a
commit a5926a5507
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -66,7 +66,7 @@ export default function CreateTagModal({
})
.catch((e) => {
message.destroy();
message.error({ content: `Failed to remove term: \n ${e.message || ''}`, duration: 3 });
message.error({ content: `Failed to create & add tag: \n ${e.message || ''}`, duration: 3 });
onClose();
});
};

View File

@ -202,6 +202,11 @@ public class EbeanEntityService extends EntityService {
@Nonnull final SystemMetadata systemMetadata) {
log.debug("Invoked ingestAspect with urn: {}, aspectName: {}, newValue: {}", urn, aspectName, newValue);
if (!urn.toString().trim().equals(urn.toString())) {
throw new IllegalArgumentException("Error: cannot provide an URN with leading or trailing whitespace");
}
Timer.Context ingestToLocalDBTimer = MetricUtils.timer(this.getClass(), "ingestAspectToLocalDB").time();
UpdateAspectResult result = ingestAspectToLocalDB(urn, aspectName, ignored -> newValue, auditStamp, systemMetadata,
DEFAULT_MAX_TRANSACTION_RETRY);