Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C#: Calling grant on a EncryptionKey throws Parameter count mismatch #2375

Closed
McDoit opened this issue Apr 25, 2019 · 7 comments
Closed

C#: Calling grant on a EncryptionKey throws Parameter count mismatch #2375

McDoit opened this issue Apr 25, 2019 · 7 comments
Assignees
Labels
bug This issue is a bug. language/dotnet Related to .NET bindings p1

Comments

@McDoit
Copy link
Contributor

McDoit commented Apr 25, 2019

Describe the bug
Calling testKey.GrantEncryptDecrypt(new Anyone()); throws System.Reflection.TargetParameterCountException: Parameter count mismatch.
on the GrantEncryptDecrypt or any Grant part

To Reproduce

var testKey = new EncryptionKey(this, "key", new EncryptionKeyProps
                {
                    Description = "test key",
                    EnableKeyRotation = false,
                    Enabled = true,
                    Retain = false
                });

                testKey.GrantEncryptDecrypt(new Anyone());

Expected behavior
The grant to happen, worked in 0.28

Version:

  • Windows 10
  • dotnet core 2.1, C#
  • 0.29
@McDoit McDoit added the bug This issue is a bug. label Apr 25, 2019
@matheusmaximo
Copy link

I'm having the same error message when trying to add a SqsEventSource. v0.31

@Kylia669
Copy link

Kylia669 commented Aug 8, 2019

Having save error when trying to addContainer to taskDefinition

@RomainMuller RomainMuller added the needs-reproduction This issue needs reproduction. label Aug 8, 2019
@assyadh
Copy link
Contributor

assyadh commented Aug 13, 2019

Was able to repro using:

            var testKey = new Key(stack, "key", new KeyProps()
            {
                Description = "test key",
                EnableKeyRotation = false,
                Enabled = true,
            });

            testKey.GrantEncryptDecrypt(new Anyone());

@RomainMuller RomainMuller removed the needs-reproduction This issue needs reproduction. label Aug 20, 2019
@assyadh
Copy link
Contributor

assyadh commented Aug 20, 2019

After some investigation:

relates aws/jsii#404

When deserializing callback arguments, the wrong number of arguments get passed to the callback method here:

https://github.com/aws/jsii/blob/2f40eeb7c60ffe205507891797885a9de9e9db65/packages/jsii-dotnet-runtime/src/Amazon.JSII.Runtime/CallbackExtensions.cs#L81

In the above GrantEncryptDecrypt() example, a callback to Grant() is created, with 5 arguments. The first is an IIGrantable and the other fives are strings. They should have been casted as an array of string[]

The signature for Grant() is:

Grant(IIGrantable grantee, params string[] actions)

Hence the blow up.

Original root cause:

https://github.com/aws/jsii/blob/2f40eeb7c60ffe205507891797885a9de9e9db65/packages/jsii-dotnet-runtime/src/Amazon.JSII.Runtime/CallbackExtensions.cs#L131

I am lacking background on the matter. Any idea @RomainMuller ?

@DavidChristiansen
Copy link
Contributor

Hitting this issue as well

@RomainMuller RomainMuller added the p1 label Nov 4, 2019
@RomainMuller
Copy link
Contributor

This might be fixed in the next version.

@RomainMuller
Copy link
Contributor

This should be fixed on the current release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. language/dotnet Related to .NET bindings p1
Projects
None yet
Development

No branches or pull requests

7 participants