Skip to content

Commit cdb096d

Browse files
committed
Add Bandit configuration file and implement poisoned document creation in RAG poisoning attack
1 parent 2511179 commit cdb096d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.bandit

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Bandit configuration file
2+
# Exclude directories that should not be scanned
3+
exclude_dirs:
4+
- './.venv'
5+
- './.git'
6+
- './build'
7+
- './dist'
8+
- './prompt_security_fuzzer.egg-info'
9+
- './.env'
10+
- './tests' # Exclude test files - pytest uses assertions which trigger B101 warnings

ps_fuzz/attacks/rag_poisoning.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ def _setup_poisoned_vector_database(self):
251251
self.vectorstore.add_documents(benign_docs)
252252

253253
# Add poisoned document
254+
poisoned_doc = self._create_poisoned_document()
254255
with _suppress_loggers(suppress_names):
255256
self.vectorstore.add_documents([poisoned_doc])
256257

0 commit comments

Comments
 (0)