Credential Shield: Securing Third-Party App Access in NetSuite

Jona Obrador • September 20, 2024

When I started out as a NetSuite developer, integrating with third-party applications like Amazon, Shopify, and WMS was a common aspect of my projects. One of my major concerns was securing the credentials used in these integrations, as they have the potential to manipulate data across these platforms.


Today, we’re discussing best practices to ensure that these credentials don’t fall into the wrong hands. With knowledge of the API and credentials, malicious actors could wreak havoc on a business.

Hard-Coding Practice

Risk: Hard-coding API keys directly into source code is a risky practice. If the code is exposed, the API keys can be easily copied and misused.


Mitigation: When deploying as part of a SuiteBundle or SuiteApp, ensure that files containing sensitive information are locked and hidden to prevent unauthorized access.

Risk: Hard-coding API keys directly into source code is a risky practice. If the code is exposed, the API keys can be easily copied and misused.


Mitigation: When deploying as part of a SuiteBundle or SuiteApp, ensure that files containing sensitive information are locked and hidden to prevent unauthorized access.


Storing Encrypted API Keys

To enhance security, consider encrypting your API keys before storing them. Here’s a basic example of encrypting an API key in a user event beforeLoad().


1. Encrypt: Encrypt the API key using an encryption key that only your application knows.

2. Store: Save the encrypted API key in a custom record.

An API key titled “AOL API Key”.  API key details, with a “Paste” button, and other options.

3. Retrieve: Decrypt the API key using your encryption key when needed, then use it for your request.

Demo video here: Get Giphy via Encrypted Key


Risk: The encryption key could be exposed in the source code, making it vulnerable to reverse engineering. If the decrypted API key is logged, it may be at risk of compromise.


Mitigation: When deploying a SuiteBundle or SuiteApp, make sure to secure and hide any files that contain encryption keys to safeguard against unauthorized access.


‍NetSuite API Secrets

NetSuite has introduced a feature to address security concerns regarding sensitive data: API Secrets.


1. Store API key via API Secret



  • Navigate to Setup > Company > API Secrets > New
  • Paste your API key into the Password field.
  • Check Allow for All Scripts and Allow for All Domains.
Screenshot of a secret management tool with details for a Giphy API key, including name, ID, and file upload options.


2. Retrieve the API Key: Use https.createSecureString() to access the API key securely.

Demo video hereGet Giphy via Secret


Limit Access to API Secret (Optional)

To ensure that API Secrets are only accessible to authorized scripts, follow these steps:


1. Navigate to the API Secret: Go to Setup > Company > API Secrets and select the API Secret you have created.


2. Set Restrictions:

  • Click on the Restrictions tab.
  • Enter the Script ID of the specific script that should have access to this API Secret. This ensures that only the designated script can retrieve the API Secret, enhancing security by limiting access.

Demo Video for Unauthorized: Get Giphy via Secret - Unauthorized Script

Risk: This approach appears to carry minimal risk. The API key is not easily accessible, and attempts to log the URL value return an empty object, adding an extra layer of security.


Final Thoughts

NetSuite API Secrets deliver a powerful means of securing sensitive information and enhance the NetSuite security toolkit. I highly recommend using this native feature, as it offers an easy and effective way to manage API credentials with less complexity than conventional encryption methods.


To see the complete SuiteScript code and implementation details discussed in this article, visit Jona's GitHub repository.


Jona Obrador Senior Netsuite Developer

Meet the Author

Jona has over a decade of experience in SuiteCloud Development on the NetSuite platform. She specializes in implementing advanced solutions and has led teams in creating high-quality software. Jona holds multiple certifications and has been recognized with awards like the Summit Award and Quality Champion Award.


Tags

Accelerate ERP Success with Expert Solutions

Ready to put what you've learned into practice? ATSOURCE delivers both the specialized talent and comprehensive NetSuite support you need to turn strategy into results.‍Connect with our experts today and move from planning to performance.

Silent killer of a developer's produtivity
By Jona Obrador October 1, 2025
Discover how excessive meetings disrupt developer focus and flow, and learn strategies to protect deep work for higher productivity and satisfaction.
The Quality Time &Resources Triangle in Software Development
By Jona Obrador September 23, 2025
Master the quality-time-resources triangle in software development. Learn strategic trade-offs to balance project constraints and deliver results.
Why Code Review matters
By Jona Obrador September 16, 2025
Transform code reviews from judgment to growth opportunities. Learn how to build positive review culture that improves code quality & team collaboration.