Latest Sails Version having some issues for 1.4.1

Hi Team I am trying to upgrade sails version but for some how my application is getting cors issues. It was asking our application to enable allowAnyOriginWithCredentialsUnsafe to true and that makes our application less secure. Kindly please suggest.

Sample :
origin: ‘*’,
credentials: true,

Terminal:
error:
error: Invalid global CORS settings: if allowOrigins is ‘*’, allowCredentials cannot also be true (unless you enable the allowAnyOriginWithCredentialsUnsafe flag). For more info, see sails.config.security.

error: Could not load Sails app.
error:
error: Tips:
error: • First, take a look at the error message above.
error: • Make sure you’ve installed dependencies with npm install.
error: • Check that this app was built for a compatible version of Sails.
error: • Have a question or need help? (http://sailsjs.com/support)