Skip to content

Commit

Permalink
[FIX] Fixed migration of IOC and cors
Browse files Browse the repository at this point in the history
  • Loading branch information
whikernel committed Jan 7, 2025
1 parent 702b797 commit bd5bd95
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
13 changes: 6 additions & 7 deletions source/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class AlertsNamespace(Namespace):

app = Flask(__name__, static_folder='../static')

CORS(app, supports_credentials=True, origins="*", resources={r"/*": {"origins": "*"}})
CORS(app, supports_credentials=True, origins=["http://localhost:5173", "http://localhost:8000"])


def ac_current_user_has_permission(*permissions):
Expand Down Expand Up @@ -102,7 +102,7 @@ def ac_current_user_has_manage_perms():
app.config.update(
SESSION_COOKIE_SECURE=True,
SESSION_COOKIE_HTTPONLY=True,
SESSION_COOKIE_SAMESITE='Lax'
SESSION_COOKIE_SAMESITE='None'
)

cache = Cache(app)
Expand Down Expand Up @@ -146,11 +146,10 @@ def ac_current_user_has_manage_perms():
def shutdown_session(exception=None):
db.session.remove()

# @app.after_request
# def after_request(response):
# response.headers.add('Access-Control-Allow-Origin', '*')
#
# return response
@app.after_request
def after_request(response):

return response


from app import views
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def upgrade():
"ioc_misp": ioc.ioc_misp,
"ioc_tlp_id": ioc.ioc_tlp_id,
"custom_attributes": json.dumps(ioc.custom_attributes),
"ioc_enrichment": ioc.ioc_enrichment,
"ioc_enrichment": json.dumps(ioc.ioc_enrichment),
"modification_history": ioc.modification_history,
"case_id": ioc_link.case_id
}).fetchone()
Expand Down Expand Up @@ -138,10 +138,10 @@ def upgrade():
# Inserting the new case_event_ioc links
for case_event_link in case_event_links:
conn.execute(text(
"INSERT INTO case_events_ioc(case_event_id, ioc_id, case_id)"
"VALUES (:case_event_id, :ioc_id, :case_id)"),
"INSERT INTO case_events_ioc(event_id, ioc_id, case_id)"
"VALUES (:event_id, :ioc_id, :case_id)"),
{
"case_event_id": case_event_link.case_event_id,
"event_id": case_event_link.event_id,
"ioc_id": new_ioc_id,
"case_id": ioc_link.case_id
})
Expand Down

0 comments on commit bd5bd95

Please sign in to comment.