A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/3321 below:

[apex] New rule to detect inaccessible AuraEnabled getters (summer '21 security update) · Issue #3321 · pmd/pmd · GitHub

Proposed Rule Name:
InaccessibleAuraEnabledGetter

Proposed Category:
Error Prone

Description:
In the Summer '21 release, a mandatory security update enforces access modifiers on Apex properties in Lightning component markup. The update prevents access to private or protected Apex getters from Aura and Lightning Web Components.

Code Sample:

// Violating
public class Foo {
    @AuraEnabled
    public Integer counter { private get; set; }

    @AuraEnabled
    public static Foo bar()
    {
        Foo foo = new Foo();
        foo.counter = 2; 
        return foo;
    }
}

public class Foo {
    @AuraEnabled
    public static Baz bar()
    {
    	Baz baz = new Baz();
        baz.counter = 2; 
        return baz;
    }
    
    private class Baz {
        @AuraEnabled
        public Integer counter { protected get; set; }
    }
}

// Compliant
public class Foo {
    @AuraEnabled
    public Integer counter { get; set; }

    @AuraEnabled
    public static Foo bar()
    {
        Foo foo = new Foo();
        foo.counter = 2; 
        return foo;
    }
}

public class Foo {
    @AuraEnabled
    public static Baz bar()
    {
    	Baz baz = new Baz();
        baz.counter = 2; 
        return baz;
    }
    
    private class Baz {
        @AuraEnabled
        public Integer counter { get; set; }
    }
}

Possible Properties:

None.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4