Giter VIP home page Giter VIP logo

Comments (17)

andikrueger avatar andikrueger commented on June 11, 2024 1

Thank you for the resource snippets. There is something wrong with the escaping of quotes. Your strings contain quotes and these are breaking the resource’s configuration

from microsoft365dsc.

ricmestre avatar ricmestre commented on June 11, 2024 1

Please write down which properties you had to modify in order to escape those extra quotes in the code.

from microsoft365dsc.

andikrueger avatar andikrueger commented on June 11, 2024 1

We need to modify this function in ReverseDSC for this matter:

https://github.com/microsoft/ReverseDSC/blob/32199ce3a3a9376631b6257f23a71ee3a54362f7/ReverseDSC.Core.psm1#L90

In this function there is already some handling present for invalid string characters like `. We should extend this handling to properly escaping double quotes. In the generated DSC blocks we always use double quotes to define string.

from microsoft365dsc.

andikrueger avatar andikrueger commented on June 11, 2024 1

I guess we also need to look into the Array processing then for SubjectOrBodyMatchesPatterns. The json should still be fine with proper escaping of the quotes. As soon as the quotes are escaped the brackets will no longer matter.

from microsoft365dsc.

jagatjb avatar jagatjb commented on June 11, 2024

Any help on this?

from microsoft365dsc.

andikrueger avatar andikrueger commented on June 11, 2024

Could you share the resources configuration for this case? This looks like either an issue in DSCParser or in the export method of EXOTransportRule. Thanks!

from microsoft365dsc.

jagatjb avatar jagatjb commented on June 11, 2024

As the Resource config is a very large file with 300+ transport rules, I am sharing you snippets of the config from where I can find the errors from VS Code. The html report is totally broken.
PowerShell Version - 5.1

from microsoft365dsc.

jagatjb avatar jagatjb commented on June 11, 2024

There is an incomplete property assignment block in the instance definition.
Unexpected token 'BCC” Field. Thank You."' in expression or statement.

EXOTransportRule "EXOTransportRule-redacted"
{
ApplicationId = $ConfigurationData.NonNodeData.ApplicationId;
ApplyOME = $False;
AttachmentHasExecutableContent = $False;
AttachmentIsPasswordProtected = $False;
AttachmentIsUnsupported = $False;
AttachmentProcessingLimitExceeded = $False;
CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
Comments = "redacted";
DeleteMessage = $False;
Enabled = $True;
Ensure = "Present";
ExceptIfAttachmentHasExecutableContent = $False;
ExceptIfAttachmentIsPasswordProtected = $False;
ExceptIfAttachmentIsUnsupported = $False;
ExceptIfAttachmentProcessingLimitExceeded = $False;
ExceptIfHasNoClassification = $False;
From = @("redacted");
FromScope = "InOrganization";
HasNoClassification = $False;
HeaderContainsMessageHeader = "To";
HeaderContainsWords = @("redacted","redacted");
Mode = "Enforce";
ModerateMessageByManager = $False;
Name = "redacted";
Priority = 124;
Quarantine = $False;
RecipientAddressType = "Resolved";
RejectMessageEnhancedStatusCode = "5.7.1";
RejectMessageReasonText = "This email has been blocked as the recipient marked in the mail is not in “BCC” Field. Thank You.";
RemoveOME = $False;
RemoveOMEv2 = $False;
RemoveRMSAttachmentEncryption = $False;
RouteMessageOutboundRequireTls = $False;
RuleErrorAction = "Ignore";
RuleSubType = "None";
SenderAddressLocation = "HeaderOrEnvelope";
SentToScope = "InOrganization";
SetAuditSeverity = "Medium";
StopRuleProcessing = $True;
TenantId = $OrganizationName;
}

The above error is same for multiple transport rules where the transport rule looks same.

The 'from' keyword is not supported in this version of the language. For this error, I am sharing few transport rules from resource config. Few transport rules with from parameter has no error.
EXOTransportRule "EXOTransportRule-redacted"
{
ApplicationId = $ConfigurationData.NonNodeData.ApplicationId;
ApplyOME = $False;
AttachmentHasExecutableContent = $False;
AttachmentIsPasswordProtected = $False;
AttachmentIsUnsupported = $False;
AttachmentProcessingLimitExceeded = $False;
CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
Comments = "redacted";
DeleteMessage = $False;
Enabled = $True;
Ensure = "Present";
ExceptIfAttachmentHasExecutableContent = $False;
ExceptIfAttachmentIsPasswordProtected = $False;
ExceptIfAttachmentIsUnsupported = $False;
ExceptIfAttachmentProcessingLimitExceeded = $False;
ExceptIfHasNoClassification = $False;
From = @(redacted); # more then 50 senders
FromScope = "NotInOrganization";
HasNoClassification = $False;
Mode = "Enforce";
ModerateMessageByManager = $False;
Name = "redacted";
Priority = 140;
Quarantine = $False;
RecipientAddressType = "Resolved";
RemoveOME = $False;
RemoveOMEv2 = $False;
RemoveRMSAttachmentEncryption = $False;
RouteMessageOutboundRequireTls = $False;
RuleErrorAction = "Ignore";
RuleSubType = "None";
SenderAddressLocation = "HeaderOrEnvelope";
SetSCL = "redacted";
StopRuleProcessing = $True;
TenantId = $OrganizationName;
}

image

EXOTransportRule "EXOTransportRule-redacted"
{
ApplicationId = $ConfigurationData.NonNodeData.ApplicationId;
ApplyOME = $False;
AttachmentHasExecutableContent = $False;
AttachmentIsPasswordProtected = $False;
AttachmentIsUnsupported = $False;
AttachmentProcessingLimitExceeded = $False;
CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
Comments = "redacted
";
DeleteMessage = $False;
Enabled = $True;
Ensure = "Present";
ExceptIfAttachmentHasExecutableContent = $False;
ExceptIfAttachmentIsPasswordProtected = $False;
ExceptIfAttachmentIsUnsupported = $False;
ExceptIfAttachmentProcessingLimitExceeded = $False;
ExceptIfHasNoClassification = $False;
From = @("redacted");
HasNoClassification = $False;
HeaderContainsMessageHeader = "redacted";
HeaderContainsWords = @("yes");
Mode = "Enforce";
ModerateMessageByManager = $False;
Name = "redacted";
Priority = 221;
Quarantine = $False;
RecipientAddressType = "Resolved";
RedirectMessageTo = @("redacted");
RemoveOME = $False;
RemoveOMEv2 = $False;
RemoveRMSAttachmentEncryption = $False;
RouteMessageOutboundRequireTls = $False;
RuleErrorAction = "Ignore";
RuleSubType = "None";
SenderAddressLocation = "Header";
SentTo = @("redacted");
SetAuditSeverity = "High";
StopRuleProcessing = $True;
TenantId = $OrganizationName;
}

Unexpected token 'application/adaptivecard+json">"' in expression or statement.
EXOTransportRule "EXOTransportRule-redacted"
{
ApplicationId = $ConfigurationData.NonNodeData.ApplicationId;
ApplyOME = $False;
AttachmentHasExecutableContent = $False;
AttachmentIsPasswordProtected = $False;
AttachmentIsUnsupported = $False;
AttachmentProcessingLimitExceeded = $False;
CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
Comments = "redacted";
DeleteMessage = $False;
Enabled = $True;
Ensure = "Present";
ExceptIfAttachmentHasExecutableContent = $False;
ExceptIfAttachmentIsPasswordProtected = $False;
ExceptIfAttachmentIsUnsupported = $False;
ExceptIfAttachmentProcessingLimitExceeded = $False;
ExceptIfHasNoClassification = $False;
HasNoClassification = $False;
Mode = "Enforce";
ModerateMessageByManager = $False;
Name = "redacted";
Priority = 280;
Quarantine = $False;
RecipientAddressType = "Resolved";
RemoveOME = $False;
RemoveOMEv2 = $False;
RemoveRMSAttachmentEncryption = $False;
RouteMessageOutboundRequireTls = $False;
RuleErrorAction = "Ignore";
RuleSubType = "None";
SenderAddressLocation = "Header";
SetHeaderName = "redacted";
SetHeaderValue = "any";
StopRuleProcessing = $False;
SubjectOrBodyMatchesPatterns = @("<script type="application/adaptivecard\+json">");
TenantId = $OrganizationName;
}

Unexpected token '}' in expression or statement.
image

In the html report we are seeing like these for all the rules where the "from" error started.
image

from microsoft365dsc.

jagatjb avatar jagatjb commented on June 11, 2024

Could you share the resources configuration for this case? This looks like either an issue in DSCParser or in the export method of EXOTransportRule. Thanks!

@andikrueger @NikCharlebois please help us here.

from microsoft365dsc.

jagatjb avatar jagatjb commented on June 11, 2024

Thank you for the resource snippets. There is something wrong with the escaping of quotes. Your strings contain quotes and these are breaking the resource’s configuration

These quotes are opened and closed as well. The transport rules does not contain such quotes in the comment section or any string value which are part of the transport rule. Is there anyhow you can help us with this. We have a lot of transport rules and monitoring is essential.

from microsoft365dsc.

andikrueger avatar andikrueger commented on June 11, 2024

Just to clarify: The resources and their configurations were created using Export-M365DSCConfiguration?

from microsoft365dsc.

jagatjb avatar jagatjb commented on June 11, 2024

Just to clarify: The resources and their configurations were created using Export-M365DSCConfiguration?

Yes, I am working on removing the quotes"" where the errors are occurring. I will update if the issue is fixed permanently. The errors are getting reduced as of now. I am thoroughly checking the configuration.

from microsoft365dsc.

andikrueger avatar andikrueger commented on June 11, 2024

@ricmestre Shouldn't we run escaping on all string properties regardless of the name before pushing them into the output stream

from microsoft365dsc.

ricmestre avatar ricmestre commented on June 11, 2024

If it doesn't impact anything else sure, it's better than doing it one by one.

from microsoft365dsc.

jagatjb avatar jagatjb commented on June 11, 2024

Please write down which properties you had to modify in order to escape those extra quotes in the code.

I have removed the double quotes from some parameters such as comments and RejectMessageReasonText and now I do not see the error. I will test this over the weekend and coming monday to know for sure. As of now the html is also being generated fine.
Still there are few errors for
SubjectOrBodyMatchesPatterns : {"type":"AdaptiveCard","originator":"[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}"}

I think removing the double quotes and [] can impact the transport rule.

Can we accept the double quotes, brackets in coming releases for transport rules ?

from microsoft365dsc.

jagatjb avatar jagatjb commented on June 11, 2024

We need to modify this function in ReverseDSC for this matter:

https://github.com/microsoft/ReverseDSC/blob/32199ce3a3a9376631b6257f23a71ee3a54362f7/ReverseDSC.Core.psm1#L90

In this function there is already some handling present for invalid string characters like `. We should extend this handling to properly escaping double quotes. In the generated DSC blocks we always use double quotes to define string.

This would be really great once done. I am a newbie to scripts, otherwise I would have done myself, still learning. Apart from quotes, it would be great if it was extended to brackets as well.

from microsoft365dsc.

jagatjb avatar jagatjb commented on June 11, 2024

I guess we also need to look into the Array processing then for SubjectOrBodyMatchesPatterns. The json should still be fine with proper escaping of the quotes. As soon as the quotes are escaped the brackets will no longer matter.

@andikrueger will the fix be available in the upcoming release ?

from microsoft365dsc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.