Skip to content

fix: deliver Islamic system prompt via system_instruction and harden against injection - #112

Open
samjay8 wants to merge 5 commits into
Deen-Bridge:devfrom
samjay8:fix/issue-5
Open

fix: deliver Islamic system prompt via system_instruction and harden against injection#112
samjay8 wants to merge 5 commits into
Deen-Bridge:devfrom
samjay8:fix/issue-5

Conversation

@samjay8

@samjay8 samjay8 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Closes #5

Summary

  • Pass ISLAMIC_CONTEXT as system_instruction in GenerativeModel so the Islamic persona is delivered server-side and cannot be overridden by user text
  • Add explicit injection-resistance directives to both ISLAMIC_CONTEXT and prompts/defaults.py to resist DAN, role-play, and prompt-extraction attacks
  • Remove per-request concatenation of ISLAMIC_CONTEXT into the user turn; wrap caller-supplied context in [CALLER_CONTEXT_START]/[CALLER_CONTEXT_END] delimiter tags so it is treated as data, not instructions
  • Add offline + live adversarial tests covering 10 known jailbreak patterns (DAN, ignore-instructions, system-prompt extraction, role-play bypass, hypothetical framing, developer mode, translation extraction, context injection, role reversal, markdown injection)

Testing

  • 4 offline tests verify get_model() carries system_instruction, injection-resistance directives exist, prompt-reveal refusal, and caller context delimiter tags
  • 10 live adversarial tests (gated behind @pytest.mark.live) exercise known jailbreak patterns against the deployed model
  • Full existing test suite passes with no regressions

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 08aa5381-df68-4c54-b8c7-2093c6a8c487


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@samjay8

samjay8 commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

Closing to re-trigger CI checks

@samjay8 samjay8 closed this Aug 23, 2026
@samjay8 samjay8 reopened this Aug 23, 2026
@samjay8 samjay8 closed this Aug 23, 2026
@samjay8 samjay8 reopened this Aug 23, 2026
@zeemscript

Copy link
Copy Markdown
Contributor

Strict review blocker: this branch conflicts with the base branch. Please rebase and resolve conflicts before requesting merge.

1 similar comment
@zeemscript

Copy link
Copy Markdown
Contributor

Strict review blocker: this branch conflicts with the base branch. Please rebase and resolve conflicts before requesting merge.

@zeemscript

Copy link
Copy Markdown
Contributor

Strict review blocker: this branch conflicts with the base branch and/or changes have been requested. Please rebase, resolve conflicts, and address requested changes before requesting merge.

@zeemscript

Copy link
Copy Markdown
Contributor

@samjay8 this PR has merge conflicts with the main branch. Please resolve the conflicts (merge main in or rebase) and push the fix so it can be merged. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants