Kentico macro signing question

jeff McDaniel asked on March 25, 2019 22:19

Hello,

I have a question about macro signatures. I have a part of a section in a template that will only be visible if there are child pages under a Solutions directory.

I use a macro to determine if this is valid.

{% Documents[NodeAliasPath + "/solutions"].Children.WithAllData.Count > 0 @%}

The works okay on one of my environment, but when I push to our QA environment it fails the signature.

Security check of the expression ' Documents[NodeAliasPath + "/solutions"].Children.WithAllData.Count > 0 ' didn't pass. The expression was signed by user 'public' which either does not exist or does not have permissions for the expression evaluation. Create the user and/or assign them proper permissions for the expression evaluation or remove the signature and re-save the expression by a user with proper permissions or proper macro identity assigned.

Both servers have the same CMSHashSaltString in the web.config, I have tried resigining the macros on the destination server, and have tried using a '#' instead of a '@', but nothing seems to work.

Why is this working on the source server but not the destination? I have checked the public user and it is the same for each environment. No permission level, and no macro signature.

Thanks Jeff

Correct Answer

jeff McDaniel answered on March 26, 2019 18:16

Not sure what happened but once I signed them with '#', re-signed the macros, cleared the cache and removed WithAllData, the errors went away and the sections showed up. Thanks for the help!

0 votesVote for this answer Unmark Correct answer

Recent Answers


Roman Hutnyk answered on March 26, 2019 08:32

First of all I'm not sure you need to do .WithAllData to take a count - if I'm not mistaken it joins coupled table, which is not needed in this particular case.

Does user account, that macro was signed by in source env, exists in destination env?

Public user definitely is not a good option to sign macro with - you need to sign it by a user that has appropriate permissions.

First think I'd try is removing the signature and saving the macro again in destination env, so system signs it once again and it seems you've already tried it.

Next thing I'd try to completely remove macro and type it in again in destination env.

0 votesVote for this answer Mark as a Correct answer

jeff McDaniel answered on March 26, 2019 17:25 (last edited on March 26, 2019 17:43)

Hey Roman,

Thanks for the suggestion I removed WithAllData and it was still working on the source.

However, I noticed something weird on both the source and the destination. I removed the '@' and it automatically signed it with a '#'.

Now something weird is happening. If I put the '#', the signing errors go away but the macro does not work and does not show that section.

If I put the '@', the signing errors come back and the macro works as it should. What is going on to cause that?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.