Secure NSW Point API key with Named Credential - #1
Draft
andrewwhitten wants to merge 1 commit into
Draft
Conversation
Move the NSW Point API key out of the Public hierarchy custom setting into an External Credential + Named Credential so the secret is no longer readable via Vector_Map_Geocoding__c.getOrgDefaults(). - Add NSW_Point_Geocode external/named credentials and permission set - Update VectorMapGeocodeController to call out via Named Credential - Remove NSW_Point_API_Key__c custom setting field - Set Vector_Map_Geocoding__c visibility to Protected - Update deploy script, README, and LWC setup hints Co-authored-by: andrewwhitten <andrewwhitten@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the high-severity security issue where the NSW Point API key was stored in a Public hierarchy custom setting (
NSW_Point_API_Key__c), making it readable by any user via Apex (Vector_Map_Geocoding__c.getOrgDefaults()).This PR moves API key storage to Salesforce Named Credentials / External Credentials, which is the platform-recommended pattern for secrets.
Changes
NSW_Point_GeocodeExternal Credential + Named Credential (injectsx-api-keyheader at callout time)Vector_Map_NSW_Point_Geocodepermission set granting External Credential principal accessVectorMapGeocodeControllerto call NSW Point viacallout:NSW_Point_Geocode/...instead of reading the key from custom settingsNSW_Point_API_Key__ccustom setting fieldVector_Map_Geocoding__cvisibility fromPublictoProtectedPost-deploy setup (required for NSW Point)
Migration note
Orgs upgrading from a previous version should copy the API key from the old NSW Point API Key custom setting field into the Named Credential principal, then redeploy (the custom setting field is removed by this change).