0xpolygon / chain-indexer-framework Goto Github PK
View Code? Open in Web Editor NEWChain-indexer-framework
License: MIT License
Chain-indexer-framework
License: MIT License
The library inserts the X-XSRF-TOKEN header using the secret XSRF-TOKEN cookie value in all requests to any server when the XSRF-TOKEN cookie is available, and the withCredentials setting is turned on. If a malicious user manages to obtain this value, it can potentially lead to the XSRF defence mechanism bypass.
Create an Axios instance with the following configuration, which enables cross-site request forgery (CSRF) protection by including credentials in requests:
const instance = axios.create({
withCredentials: true,
});
Install the XSRF-TOKEN cookie with specific attributes. Set the cookie value "whatever" and configuring it for the "localhost" domain with strict same-site policy:
const cookies = new Cookies();
cookies.set("XSRF-TOKEN", "whatever", {
domain: "localhost",
sameSite: "strict",
});
Initiate a cross-domain request using your Axios instance. In this example, we're making a GET request to "https://127.0.0.1/," and we handle the response and potential errors:
instance
.get("https://127.0.0.1")
.then((res) => console.log(res.data))
.catch((err) => console.error(err.message));
Code snippet
lib/adapters/xhr.js:191
const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
CWE-359: Exposure of Private Personal Information to an Unauthorized Actor
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
When saving data, is it possible to support postgresql instead of mongodb, mongodb database is expensive, I hope postgresql can be supported.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.