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

Resolution for an outer parameter that is used in a subscription expression #10

Open
n1ckl0sk0rtge opened this issue Jun 11, 2024 · 0 comments
Labels
bug Something isn't working python plugin issues related to the python implementation

Comments

@n1ckl0sk0rtge
Copy link
Member

Example inspired by this code.

_curveTable = {
    b'ecdsa-sha2-nistp256': ec.SECP256R1(),
    b'ecdsa-sha2-nistp384': ec.SECP384R1(),
    b'ecdsa-sha2-nistp521': ec.SECP521R1(),
}

def _fromECComponents(cls, x, y, curve, privateValue=None):
        publicNumbers = ec.EllipticCurvePublicNumbers(
            x=x, y=y, curve=_curveTable[curve])
        #....

Key._fromECComponents(..., ..., ..., b'ecdsa-sha2-nistp256', ...) # Noncompliant {{SECP256R1}} (desired behaviour)

In this example, we want to resolve a curve value by looking into a dictionary. While this resolution is already implemented, this is a particular case where the subscription index curve is a parameter of the enclosing function.
Here, curve is correctly resolved (using outer scope resolution) to b'ecdsa-sha2-nistp256', but this resolved value is not later used to look into the dictionary.
Therefore, the captured value is currently b'ecdsa-sha2-nistp256' instead of SECP256R1.

@n1ckl0sk0rtge n1ckl0sk0rtge added good first issue Good for newcomers and removed good first issue Good for newcomers labels Jun 11, 2024
@n1ckl0sk0rtge n1ckl0sk0rtge added bug Something isn't working python plugin issues related to the python implementation labels Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python plugin issues related to the python implementation
Projects
None yet
Development

No branches or pull requests

1 participant