Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/refcell/protec
An Isolated Safe Environment to Execute Foundry Projects.
https://github.com/refcell/protec
ethereum evm foundry solidity
Last synced: about 2 months ago
JSON representation
An Isolated Safe Environment to Execute Foundry Projects.
- Host: GitHub
- URL: https://github.com/refcell/protec
- Owner: refcell
- License: apache-2.0
- Created: 2022-07-09T19:14:04.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-07-22T06:53:39.000Z (over 2 years ago)
- Last Synced: 2024-04-17T20:18:32.022Z (9 months ago)
- Topics: ethereum, evm, foundry, solidity
- Language: Solidity
- Homepage:
- Size: 1.18 MB
- Stars: 44
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# protec • [![ci](https://github.com/abigger87/protec/actions/workflows/ci.yaml/badge.svg?label=ci)](https://github.com/abigger87/protec/actions/workflows/ci.yaml) [![license](https://img.shields.io/badge/License-Apache_2.0-blue.svg?label=license)](https://opensource.org/licenses/Apache-2.0) [![size](https://img.shields.io/github/languages/code-size/abigger87/protec.svg?color=orange&label=size)](https://img.shields.io/github/languages/code-size/abigger87/protec?label=size)
Safely Execute Foreign Function Interface Commands.
> **Warning**
>
> This repo contains **highly** experimental code. Expect rapid iteration.
>
> The current implementation does not currently work since environment variables are not refreshed.## What?
**protec** is a wrapper to prevent library abuse of the [foundry](https://github.com/foundry-rs/foundry)'s [fii](https://book.getfoundry.sh/cheatcodes/ffi.html) command. It attempts to completely block any call by setting the `FOUNDRY_FFI` environment variable to `false`.
## Installation
```
forge install abigger87/protec
```## Usage
1. Add this import to your script or test:
```solidity
import {Protec} from "protec/Protec.sol";
```2. Inherit the Protec contract (eg in a test):
```solidity
contract MyContract is Test, Protec {
// ...
}
```3. That's it! Any call to `vm.ffi` that libraries perform will revert.
## Acknowledgements
- [Unix](https://github.com/abigger87/unix)
- [Shannon](https://github.com/abigger87/shannon) _SOON™_
- [Surl](https://github.com/memester-xyz/surl)
- [Solenv](https://github.com/memester-xyz/solenv)