-
Notifications
You must be signed in to change notification settings - Fork 50
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
FIX (GraphEngine): @W-13869734@: Fix crash on explicit access level specified in Database.query method #1154
Conversation
sfge/src/main/java/com/salesforce/rules/fls/apex/operations/ValidationConverter.java
Outdated
Show resolved
Hide resolved
bfdf195
to
38f0d95
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes these tests to only use a subset of the methods in the Database class. They were taking way too long. Full coverage of all methods is in SharingPolicySimpleTest.java
.
"Database.getQueryLocator('SELECT Id, NumberOfEmployees FROM account WHERE NumberOfEmployees = 3 LIMIT 1')", | ||
"Database.getQueryLocatorWithBinds('SELECT Id, NumberOfEmployees FROM account WHERE NumberOfEmployees = 3 LIMIT 1', new Map<String, Object>{'name' => 'KENSINGTON'})", | ||
"Database.getQueryLocator('SELECT Name, NumberOfEmployees FROM account WHERE NumberOfEmployees = 3 LIMIT 1')", | ||
"Database.getQueryLocatorWithBinds('SELECT Name, NumberOfEmployees FROM account WHERE NumberOfEmployees = :i LIMIT 1', new Map<String, Object>{'i' => 3})", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated these because Josh mentioned SELECT Id, ..
is not good to have, possibly an error. Also, I made the original binds when I didn't really know what they were, and they didn't make sense.
sfge/src/main/java/com/salesforce/graph/symbols/apex/ApexSoqlValueFactory.java
Outdated
Show resolved
Hide resolved
...java/com/salesforce/rules/usewithsharingondatabaseoperation/SharingPolicySubclassesTest.java
Show resolved
Hide resolved
sfge/src/test/java/com/salesforce/rules/fls/apex/ReadFlsScenariosTest.java
Show resolved
Hide resolved
sfge/src/test/java/com/salesforce/rules/fls/apex/ReadFlsScenariosTest.java
Show resolved
Hide resolved
sfge/src/main/java/com/salesforce/rules/fls/apex/operations/FlsValidationCentral.java
Outdated
Show resolved
Hide resolved
sfge/src/main/java/com/salesforce/rules/fls/apex/operations/ValidationConverter.java
Outdated
Show resolved
Hide resolved
sfge/src/test/java/com/salesforce/rules/fls/apex/ValidationConverterTest.java
Outdated
Show resolved
Hide resolved
sfge/src/main/java/com/salesforce/rules/fls/apex/operations/FlsValidationCentral.java
Outdated
Show resolved
Hide resolved
sfge/src/main/java/com/salesforce/rules/fls/apex/operations/ValidationConverter.java
Outdated
Show resolved
Hide resolved
sfge/src/main/java/com/salesforce/rules/fls/apex/operations/ValidationConverter.java
Outdated
Show resolved
Hide resolved
53ca55e
to
bd667f7
Compare
…h explicit AccessLevel @W-13869734@: clean up docs again @W-13869734@: clean up docs @W-13869734@: PR feedback, refactor boolean pass-down @W-13869734@: clean up @W-13869734@: fix unused test @W-13869734@: add disabled test for methods in Database class beyond basic 6 @W-13869734@: fix bug expecting validations & crashing when Database.query() and similar were executed in USER_MODE @W-13869734@: update UseWithSharingOnDatabaseOperation tests - limit subclasses tests to only a few select database operations, not all of them; significantly speeds up testing - update the list of DATABASE_METHODS to include Database.query(String, AccessLevel)
bd667f7
to
4dd9128
Compare
Database
class that include aSystem.AccessLevel
as their last parameter.AccessLevel.USER_MODE
is specified, prevents expected validations from being created on the vertex.Notes:
ValidationConverter#getHolder
thatchildApexValue instanceof ApexStringValue
is true IF AND ONLY IF the vertex we are inspecting is one of theDatabase.whatever
methods that could contain an explicit access level.convertSoqlQueryInfo(ValidationHolder, ProcessFields, HashSet<SoqlQueryInfo>, boolean)
, the last boolean (representing an override that makes any SOQL operation safe to perform without FLS validations) should betrue
?Additional notes:
UseWithSharingOnDatabaseOperation
to test theDatabase.query(String, AccessLevel)
method specifically when it has an access level specified.SharingPolicySubclassesTest
to use a select subset of possible database operations, not all of them. The tests were taking quite a long time. Testing all operations was not necessary since the full breadth of operations is tested inSharingPolicySimpleTest
.Known bugs/limiting behavior:
insert
,merge
,query
,undelete
,upsert
, andupdate
methods of theDatabase
class in Apex are checked for FLS violations. TODO: check all methods, likequeryWithBinds
, etc.