Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions force-app/main/default/classes/LFSSetupController.cls
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ public with sharing class LFSSetupController {
}

private static Flow_Scanner_OAuth_Config_Protected__mdt getConfig() {
if (!Schema.sObjectType.Flow_Scanner_OAuth_Config_Protected__mdt.fields.Consumer_Key__c.isAccessible()) {
return null;
}
// See ToolingAPI.getProductionAccessToken(): the protected custom metadata type is
// namespace-scoped, so no FLS gate is needed here. Gating on isAccessible() made
// getSetupStatus() report "not configured" to every non-admin.
List<Flow_Scanner_OAuth_Config_Protected__mdt> cfgs = [
SELECT Consumer_Key__c, Last_Updated__c
FROM Flow_Scanner_OAuth_Config_Protected__mdt
Expand Down
11 changes: 7 additions & 4 deletions force-app/main/default/classes/ToolingAPI.cls
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ public with sharing class ToolingAPI {

@TestVisible
private static String getProductionAccessToken() {
if (!Schema.sObjectType.Flow_Scanner_OAuth_Config_Protected__mdt.fields.Consumer_Key__c.isAccessible()) {
throw auraError('Insufficient permissions to access OAuth configuration');
}

// No FLS check here on purpose. Flow_Scanner_OAuth_Config_Protected__mdt is a
// *protected* custom metadata type, so its records are only readable by Apex inside
// this package's namespace — that namespace boundary is the security control, not
// the running user's field permissions. isAccessible() returns false for every
// non-admin subscriber user, which blocked anyone without Customize Application
// from authenticating at all. Setup actions that *write* this config stay
// admin-gated in LFSSetupController.requireAdmin().
List<Flow_Scanner_OAuth_Config_Protected__mdt> cfgs = [
SELECT Consumer_Key__c
FROM Flow_Scanner_OAuth_Config_Protected__mdt
Expand Down