cdk-validator-cfnguard icon indicating copy to clipboard operation
cdk-validator-cfnguard copied to clipboard

Validation failure

Open amouly opened this issue 1 year ago • 5 comments

Hello,

I'm having issues to run the Validator when running cdk synth.

Here is the output:

Validation Report
-----------------

╔════════════════════════════════════╗
║           Plugin Report            ║
║   Plugin: cdk-validator-cfnguard   ║
║   Version: 0.0.54                  ║
║   Status: failure                  ║
╚════════════════════════════════════╝


Metadata: 
        error: Validation plugin 'cdk-validator-cfnguard' failed: 
        CfnGuardValidator plugin failed processing cfn-guard results.
        Please create an issue https://github.com/cdklabs/cdk-validator-cfnguard/issues/new
        Error: Error: spawnSync /Users/myuser/Projects/my-infra/node_modules/@cdklabs/cdk-validator-cfnguard/bin/macos/cfn-guard ENOBUFS

Policy Validation Report Summary

╔════════════════════════╤═════════╗
║ Plugin                 │ Status  ║
╟────────────────────────┼─────────╢
║ cdk-validator-cfnguard │ failure ║
╚════════════════════════╧═════════╝

Validation failed. See the validation report above for details

amouly avatar Sep 05 '23 17:09 amouly

@amouly Exactly the same error at my end too. Did you manage to resolve this?

waseem-uddin avatar Sep 26 '23 13:09 waseem-uddin

@waseem-uddin no, and can't find anybody willing to help neither.

amouly avatar Sep 26 '23 16:09 amouly

I got this same error this morning. Is anyone out there watching these issues? @andywick-aws perhaps?

climbertjh2 avatar Oct 27 '23 13:10 climbertjh2

Additional information.

I was able to run cfn-guard standalone against the cdk synthed CloudFormation template.

So this seems more like a problem with how the validator is trying to invoke the cfn-guard program from within the cdk synth operation (Node program scope) than a problem with the rules itself.

climbertjh2 avatar Oct 27 '23 13:10 climbertjh2

Looks like it might be a limitation of spawnSync ... with a suggested fix to use child_process instead - with async handling of stdout: https://stackoverflow.com/questions/63796633/spawnsync-bin-sh-enobufs .

climbertjh2 avatar Oct 27 '23 13:10 climbertjh2