Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@sassoftware/af-axios
Advanced tools
Minimal Axios HTTP client wrapper with SAS authentication support
af-axios
is a library used by afcli
and Create SAS® App for handling and configuring axios
for App Factory Cloud.
// Auth.js
import axios from 'axios';
import { useNavigate } from 'react-router';
import { MsalAuth } from '@sassoftware/af-axios/react';
import { MsalProvider } from '@azure/msal-react';
const clientId = 'myClientId'
const axiosInstance = axios.create({ baseUrl: 'https://myServer.com' })
const Auth = ({ children }) => {
const navigate = useNavigate();
const navigationClient = new CustomNavigationClient(navigate);
msalInstance.setNavigationClient(navigationClient);
return (
<MsalProvider instance={msalInstance}>
<MsalAuth
axiosInstance={axiosInstance}
authenticationRequest={{
scopes: [`${clientId}/.default`],
}}
>
{children}
</MsalAuth>
</MsalProvider>
);
};
export default Auth;
You should be able to wrap your app (or specific routes) in Auth
component and use useAxios
hook to get an axios instance with Authorization header and 401 response handler.
For more information on how to provide msalInstance
and CustomNavigationClient
please see https://www.npmjs.com/package/@azure/msal-react
// index.js or app.js
import { AfAuthProvider } from '@sassoftware/af-axios/react';
// Or any other source for given variables
const { MSAL_CLIENT_ID, MSAL_ENVIRONMENT, MSAL_TENANT_ID, AF_URL } = import.meta.env;
export const RootApp = () => (
<ErrorBoundary>
<Router>
<AfAuthProvider
url={AF_URL}
clientId={MSAL_CLIENT_ID}
environment={MSAL_ENVIRONMENT}
tenantId={MSAL_TENANT_ID}
>
<App />
</AfAuthProvider>
</Router>
</ErrorBoundary>
);
// index.js or app.js
import { AfAuthProvider } from '@sassoftware/af-axios/react';
// Or any other souce for given variables
const { MSAL_CLIENT_ID, AF_URL } = import.meta.env;
const msalInstance = new PublicClientApplication({
auth: {
clientId: 'your client id',
authority: `https://${your evironemnt}/${your tenant id}`,
},
});
// any other msal configurations you may need
export const RootApp = () => (
<ErrorBoundary>
<Router>
<AfAuthProvider
url={AF_URL}
clientId={MSAL_CLIENT_ID}
msalInstance={msalInstance}
>
<App />
</AfAuthProvider>
</Router>
</ErrorBoundary>
);
npm run build:release
to create a build releasenpm pack
to create a TAR archive file (.tgz). You should see the name of newly created file at the end of the output.npm install [.tgz path]
. Make sure to replace [.tgz path]
with a correct local path of a file created by npm pack
command.Previous set of commands will create a lot of files in the root of the project.
To clean the files run git clean -d -f
. Note that this command will remove all untracked files so a good idea might be a dry run with git clean -d -n
before the actual cleanup.
This project is currently intended for use by participants in the SAS Hackathon. During this event, the repository will refrain from accepting external contributions. However, we have plans to open source the project in the near future, at which point we will welcome contributions from the community.
Please note that after the SAS Hackathon concludes, this notice will be removed, and we will provide updated guidelines for contributing to the project once it becomes open source. We appreciate your understanding and look forward to collaborating with you in the future.
FAQs
Minimal Axios HTTP client wrapper with SAS authentication support
We found that @sassoftware/af-axios demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 13 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.