Skip to content

Commit

Permalink
Refactors node compatibility test to improve base URL validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ralexmatthews committed Jan 2, 2025
1 parent 33fea3b commit 7fe32f8
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions test/node_compatibility/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
const dotenv = require('dotenv');

dotenv.config();

const EasyPostClient = require('../..');

const test = async () => {
const apiKey = process.env.EASYPOST_TEST_API_KEY;
const client = new EasyPostClient(apiKey);
const client = new EasyPostClient('apiKey');

if (!client.baseUrl.includes('easypost.com')) {
if (!client.baseUrl.match(/^(http|https):\/\/api.easypost.com/gm)) {

Check failure

Code scanning / CodeQL

Incomplete regular expression for hostnames High test

This regular expression has an unescaped '.' before 'easypost.com', so it might match more hosts than expected.
process.exit(1);
}
};
Expand Down

0 comments on commit 7fe32f8

Please sign in to comment.