Skip to content

Secure NSW Point API key with Named Credential - #1

Draft
andrewwhitten wants to merge 1 commit into
mainfrom
cursor/protect-nsw-point-api-key-a658
Draft

Secure NSW Point API key with Named Credential#1
andrewwhitten wants to merge 1 commit into
mainfrom
cursor/protect-nsw-point-api-key-a658

Conversation

@andrewwhitten

Copy link
Copy Markdown
Owner

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

  • Added NSW_Point_Geocode External Credential + Named Credential (injects x-api-key header at callout time)
  • Added Vector_Map_NSW_Point_Geocode permission set granting External Credential principal access
  • Updated VectorMapGeocodeController to call NSW Point via callout:NSW_Point_Geocode/... instead of reading the key from custom settings
  • Removed NSW_Point_API_Key__c custom setting field
  • Changed Vector_Map_Geocoding__c visibility from Public to Protected
  • Updated deploy script (phase 1 now deploys credentials + permission set), README, and LWC setup hints

Post-deploy setup (required for NSW Point)

  1. Setup → Named Credentials → NSW Point Geocode → External Credentials → principal NSW Point API Key
  2. Set the ApiKey authentication parameter to your NSW Point API key
  3. Assign the Vector Map NSW Point Geocode permission set to users who need NSW Point geocoding

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).

Open in Web Open in Cursor 

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants