-
Notifications
You must be signed in to change notification settings - Fork 12
feat(security): Enhance Web Application Security #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(security): Enhance Web Application Security #20
Conversation
…on and frame protection - Add middleware to validate request origins based on configuration - Implement Content Security Policy (CSP) for frame ancestors - Update backend routes to support new security middleware - Add configuration options for allowed origins and frame domains - Modify delete message route from GET to POST for better security - Update frontend admin service to use POST for message deletion - Add SameSite cookie policy configuration in session management - Update sample environment configuration with new security settings Improves application security by providing more granular control over request origins, frame embedding, and cookie policies.
| if r.TLS != nil { | ||
| scheme = "https" | ||
| } | ||
| appHostOrigin := scheme + "://" + r.Host |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ואם התוקף משנה גם את זה?
לכאורה צריך להעביר באמצעות משתנה סביבה את הדומיין ברירת מחדל שמאושר, אחרת גם יש מצב שמוגדרת הבדיקה הזאת ובפועל אין דומיין מוגדר ונשארים נעולים מחוץ למערכת.
https://www.calhoun.io/csrf-protection-via-headers-in-go-125/?utm_source=chatgpt.com
תראה גם את זה.
https://github.com/NetFree-Community/TheChannel/blob/master/backend/main.go#L19
בכל אופן, עדיף לשלב את הבדיקה הזאת כאן, בלי לעשות פונקציה נפרדת על זה.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
את מה התוקף ישנה? את הHost?
זה נשלח ע"י הדפדפן, אי אפשר לשנות את זה.
אין שום אפשרות להינעל מחוץ למערכת, כי הדומיין של האתר עצמו תמיד מאושר בצורה קשיחה בקוד
ההגנה שביצעתי היא כמו מה שמופיע במדריך שקישרת, ומה שיש שם בגירסה 1.25 לא רלוונטי.
הפונקציה הנפרדת זה כיון שזה בדיקה נוספת ומיותרת בעיקרון, שמופעלת רק אם הפעילו אותה בהגדרות, ואין צורך לבלגן את הפונקצית התחברות הרגילה.
.... |
ראה עריכה בתגובה הקודמת. הדומיין של האתר עצמו תמיד מאושר. |
|
למה צריך אופציה בכלל לבצע בקשות מדומיין אחר? |
|
על מנת לאפשר טעינה של הערוצים בi frame שהוא חוצה דומיינים. |
|
לא, כיון שצריך לאפשר התחברות ע"י גוגל, שזה אפשרי רק ע"י שיתוף העוגיות. |
|
צריך להבהיר שאם אתה נותן הרשאות לדומיין הוא יכול לעשות כל פעולה באתר שלך |
אמנם אי אפשר לעשות כל פעולה באופן ישיר אבל בשילוב XSS אפשר לקבל שליטה מלאה |
|
לעשות פעולות ישירות באתר אי אפשר כמובן בגלל CROS. וכמובן גם הענין ניתן להגדרה בקובץ המשתני סביבה. |
|
הי מי אתם????????
בתאריך יום ב׳, 29 בדצמ׳ 2025 ב-16:45 מאת Click&Go <
***@***.***>:
… *ClickAndGoScript* left a comment (NetFree-Community/TheChannel#20)
<#20 (comment)>
לעשות פעולות ישירות באתר אי אפשר כמובן בגלל CROS.
וגם כל הסיכון הוא נמוך מאוד בהתחשב בכך שמדובר באתר שלרוב המשתמשים אין בו
כלל הרשאות, והעוגיות שלהם משמשות לזיהוי בלבד.
הסיכון לחדירה לחשבון מנהל ע"י XSS הוא אפסי.
וכמובן גם הענין ניתן להגדרה בקובץ המשתני סביבה.
מבירור עם מנהלי ערוצים כולם מעוניינים בזה למרות הסיכון המזערי שבענין.
—
Reply to this email directly, view it on GitHub
<#20 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BWVEHMMD36T56WZ5PZ4UHDL4EE47FAVCNFSM6AAAAACKO4HG32VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMOJWG4ZDAOBZHA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
This pull request introduces several critical security enhancements to the application's backend and frontend.
The primary goal is to harden the platform against common web vulnerabilities, specifically Cross-Site
Request Forgery (CSRF) and Clickjacking, while also improving cookie management policies.
Key Changes
Origin Validation Middleware:
requests to protected admin routes (/api/admin).
from the application's own domain or a configurable list of whitelisted domains (allowed_origins) are
processed. This is a fundamental defense against CSRF attacks.
Clickjacking Protection with Content-Security-Policy (CSP):
responses.
that are permitted to embed the application within an <iframe>. This effectively prevents Clickjacking
attacks.
Secure HTTP Method for Message Deletion:
POST.
performed via GET requests.
action.
Enhanced Cookie Security:
environment variable.
flag when None is used, as required by modern browsers. This provides granular control over when
cookies are sent, mitigating cross-site information leakage.
Updated Documentation and Configuration:
How to Test
Origin Validation:
header. The request should be rejected with a 403 Forbidden error.
Iframe (Clickjacking) Protection:
successfully.
inside the frame.
Message Deletion: