Dave67350 commited on
Commit
b918a23
·
verified ·
1 Parent(s): 264d35f

Create dora_remote_access_policy.py

Browse files
Files changed (1) hide show
  1. tools/dora_remote_access_policy.py +10 -9
tools/dora_remote_access_policy.py CHANGED
@@ -18,7 +18,7 @@ def export_text_to_pdf(text, metadata=None, output_path=None, language="en"):
18
 
19
  pdf.set_font("Arial", 'B', 16)
20
  pdf.set_text_color(0, 51, 102)
21
- title = "Remote Access Policy - DORA (Optional)" if language == "en" else "Politique d'accès à distance - DORA"
22
  pdf.cell(0, 15, title, ln=True, align='C')
23
  pdf.ln(10)
24
 
@@ -60,12 +60,13 @@ def export_text_to_pdf(text, metadata=None, output_path=None, language="en"):
60
 
61
  # === Questions ===
62
  QUESTIONS = prepend_metadata_questions([
63
- ("remote_access_usage", "What roles or functions require remote access?"),
64
- ("authentication_mechanisms", "What authentication methods are used for remote access?"),
65
- ("vpn_usage", "Do you use VPNs or secure tunnels? If so, describe them."),
66
- ("access_logging", "Is remote access monitored and logged? How?"),
67
- ("third_party_access", "How is remote access granted to third parties?"),
68
- ("incident_handling", "How are remote access-related incidents detected and handled?")
 
69
  ])
70
 
71
 
@@ -99,10 +100,10 @@ def run_tool():
99
  content = "\n".join([f"- **{label}**: {answers.get(key, '')}" for key, label in QUESTIONS])
100
  lang = detect(content if len(content.strip()) > 3 else "Placeholder content")
101
  pdf_path = export_text_to_pdf(content, metadata=metadata, language=lang)
102
- return "✅ Policy generated. Download your file below.", {"done": True}, pdf_path
103
 
104
  with gr.Blocks(title="DORA Remote Access Policy") as demo:
105
- chatbot = gr.Chatbot(label="🔐 Remote Access Assistant", value=[{"role": "assistant", "content": QUESTIONS[0][1]}], type="messages")
106
  msg = gr.Textbox(label="Your answer")
107
  state_var = gr.State(state)
108
  file_output = gr.File(label="Download PDF")
 
18
 
19
  pdf.set_font("Arial", 'B', 16)
20
  pdf.set_text_color(0, 51, 102)
21
+ title = "Remote Access Policy - DORA (Optional)" if language == "en" else "Politique d'Accès à Distance - DORA"
22
  pdf.cell(0, 15, title, ln=True, align='C')
23
  pdf.ln(10)
24
 
 
60
 
61
  # === Questions ===
62
  QUESTIONS = prepend_metadata_questions([
63
+ ("policy_scope", "What is the scope of the remote access policy?"),
64
+ ("authentication_measures", "What authentication measures are required for remote access?"),
65
+ ("device_requirements", "What are the requirements for devices used for remote access?"),
66
+ ("data_protection_measures", "How is data protected during remote access?"),
67
+ ("user_responsibilities", "What responsibilities do users have under this policy?"),
68
+ ("access_monitoring", "How is remote access monitored and logged?"),
69
+ ("incident_response", "What actions are taken in case of policy violations or security incidents?")
70
  ])
71
 
72
 
 
100
  content = "\n".join([f"- **{label}**: {answers.get(key, '')}" for key, label in QUESTIONS])
101
  lang = detect(content if len(content.strip()) > 3 else "Placeholder content")
102
  pdf_path = export_text_to_pdf(content, metadata=metadata, language=lang)
103
+ return "✅ Remote Access Policy generated. Download your file below.", {"done": True}, pdf_path
104
 
105
  with gr.Blocks(title="DORA Remote Access Policy") as demo:
106
+ chatbot = gr.Chatbot(label="🌐 Remote Access Policy Assistant", value=[{"role": "assistant", "content": QUESTIONS[0][1]}], type="messages")
107
  msg = gr.Textbox(label="Your answer")
108
  state_var = gr.State(state)
109
  file_output = gr.File(label="Download PDF")