Pesquisar

Artigo
· Ago. 1 3min de leitura

Evitar la inyección SQL en InterSystems IRIS: el caso a favor de prácticas seguras de consulta

La inyección SQL sigue siendo una de las vulnerabilidades más críticas en las aplicaciones basadas en bases de datos, ya que permite a los atacantes manipular consultas y, potencialmente, acceder o comprometer datos sensibles. En InterSystems IRIS, los desarrolladores tienen acceso tanto a SQL Dinámico como a SQL Embebido, cada uno con características distintas. Comprender cómo usarlos de forma segura es esencial para prevenir la inyección SQL.

El problema: SQL Dinámico y la inyección SQL

El SQL Dinámico construye consultas como cadenas durante la ejecución. Aunque esto ofrece flexibilidad, también crea una vulnerabilidad si no se maneja correctamente la entrada del usuario. Por ejemplo:

Set query = "SELECT Name, Age FROM Patients WHERE Age > "_age
Set statement = ##class(%SQL.Statement).%New()
Set status = statement.%Prepare(query)

Si la edad es proporcionada por el usuario, concatenarla directamente en la cadena de consulta expone la aplicación a una inyección. Un atacante podría proporcionar un valor malicioso como 0; DROP TABLE Patients, con resultados desastrosos.

La solución: consultas parametrizadas

Las consultas parametrizadas son la mejor defensa contra la inyección SQL. En lugar de concatenar entradas en la consulta, los valores del usuario se vinculan como parámetros. Aquí hay un enfoque seguro utilizando SQL Dinámico:

Set query = "SELECT Name, Age FROM Patients WHERE Age > ?"
Set statement = ##class(%SQL.Statement).%New()
Set status = statement.%Prepare(query)
If status {
    Set result = statement.%Execute(age)
    While result.%Next() {
        Write "Name: ", result.Name, ", Age: ", result.Age, !
    }
}

 

Aquí, el marcador de posición ? asegura que el valor de edad sea tratado estrictamente como dato y no como código ejecutable, lo que reduce significativamente el riesgo de inyección.

SQL Embebido: seguridad incorporada

El SQL Embebido integra SQL directamente en ObjectScript, protegiendo de forma inherente contra la inyección SQL. La sintaxis de variables anfitrión (:variable) vincula de forma segura los parámetros en tiempo de compilación:

&sql(SELECT Name, Age INTO :name, :age FROM Patients WHERE Age > :minAge)

Con SQL Embebido, no existe un mecanismo para concatenar directamente entradas sin procesar del usuario en la consulta, lo que previene la inyección.

Comparación entre SQL Embebido y SQL Dinámico

Característica SQL Embebido SQL Dinámico
Seguridad Seguro contra inyecciones gracias a las variables anfitrión Seguro si se incluyen parámetros; existe riesgo si no se hace
Flexibilidad Limitada (solo consultas estáticas)   Altamente flexible para escenarios dinámicos
Capacidad de búsqueda Fácil de ubicar en definiciones de clase Más difícil de analizar; las consultas están en cadenas
Rendimiento Compilado en 'tiempo de compilación de clase' Analizado y optimizado en tiempo de ejecución

Cuándo usar SQL Dinámico

El SQL Dinámico es útil cuando las estructuras de consulta deben determinarse en tiempo de ejecución, por ejemplo, al agregar filtros opcionales:

Set query = "SELECT Name, Age FROM Patients"
If includeGender {
    Set query = query_" WHERE Gender = ?"
}
Set statement = ##class(%SQL.Statement).%New()
Set status = statement.%Prepare(query)
If status {
    Set result = statement.%Execute("Male")
}

Recuerda siempre usar parametrización (?) para estas consultas construidas dinámicamente a fin de mantener la seguridad.

Conclusión

El SQL Dinámico permite una construcción flexible de consultas, pero requiere un uso responsable para evitar riesgos de inyección SQL. Las consultas parametrizadas abordan eficazmente este riesgo. Mientras tanto, el SQL Embebido incluye protecciones incorporadas, lo que lo convierte en una excelente opción para consultas estáticas. Al usar estos enfoques de manera adecuada, los desarrolladores pueden crear aplicaciones sólidas y seguras con InterSystems IRIS.

Discussão (0)1
Entre ou crie uma conta para continuar
Pergunta
· Ago. 1

How to Change Login Email Address?

Hello Community,

I’d like to know how I can update my login email address from the profile section.

When I click the "Edit" option in my profile, it redirects me to login.intersystems.com. However, even on that page, I don’t see an option to edit the login email address. [unable to edit]

Could someone please guide me on how to change my login email?

Thanks in advance!

8 Comments
Discussão (8)4
Entre ou crie uma conta para continuar
Resumo
· Ago. 1

InterSystems 开发者社区摘要,七月 2025

您好,欢迎阅读 七月 2025 开发人员社区通讯。
统计信息
✓ 七月发布了 9 篇新帖子:
 1 new article
 6个新公告
 2个新问题
✓ 七月有 25 位新成员加入
✓ 所有时间发布了 2,397 篇帖子
✓ 所有时间有 2,256 位成员加入
最高职位
本月最佳作家
文章
#InterSystems IRIS for Health
公告
问题
#InterSystems IRIS
IRIS HTML 标签
按Alan Zheng
#Caché
七月, 2025Month at a GlanceInterSystems Developer Community
Discussão
· Ago. 1

Dark Mode for HealthShare Management Portal - Visual Accessibility Need

Hello InterSystems Community,

I hope you're all doing well. I'm reaching out to ask if there's any way to enable a dark theme or dark mode for the HealthShare Management Portal.

Background

I have a visual impairment (amblyopia/lazy eye) which means I'm nearly blind in one eye. Like many people with visual difficulties, I find that bright white backgrounds and interfaces cause significant eye strain and fatigue. This makes it challenging to work with the Management Portal for extended periods.

What I've Found So Far

I've searched through the community forums and documentation, but I've only found discussions about dark mode for InterSystems Studio. However, I specifically need to know about dark mode options for the HealthShare Management Portal (the web-based interface).

My Questions

  1. Is there a built-in dark mode or theme option for the HealthShare Management Portal?
  2. Are there any configuration settings or CSS customizations that could achieve a darker interface? (I can enable dark theme in Web Browser, for example Mozilla Firefox but it does not let me see the Management Portal in dark theme).
  3. Has anyone in the community found workarounds or third-party solutions for this accessibility need?
  4. Are there any plans from InterSystems to add dark mode support to the Management Portal in future releases?

Why This Matters

Visual accessibility isn't just about personal preference—it's about making these powerful tools usable for people with various visual impairments. A dark mode option would significantly improve the user experience for those of us who struggle with bright interfaces.

I'd greatly appreciate any insights, suggestions, or experiences you might have with this issue. Even if there's no official dark mode, I'd be interested in hearing about any CSS modifications or browser extensions that might help.

Thank you in advance for your time and assistance!

Best regards,

Yone

8 Comments
Discussão (8)5
Entre ou crie uma conta para continuar
Resumo
· Ago. 1

InterSystems開発者コミュニティのダイジェスト、7月 2025

7月 2025開発者コミュニティ ニュースレターへようこそ。
全体統計
24 件の新しい投稿が公開 (7月 月):
 15件の新着記事
 8の新しい発表
  – 新規質問1
6 人の新メンバーが参加 (7月 月)
1,545 件の投稿が公開 (全期間)
329 人のメンバーが参加 (全期間)
トップ記事
今月のトップ作家
記事
#InterSystems IRIS
文字コードが不明なファイルや文字列を正しく処理する方法
Mihoko Iijima順
サポートOSはどこを見て確認したらよいか?サポートされているプラットフォームについて
Megumi Kakechi順
503 Service Unavailable エラーが出る原因
Mihoko Iijima順
文字列を全部大文字/小文字にしたり、指定文字コードに変換したり、HTML内の記号やURLのクエリパラメータをエスケープする方法
Mihoko Iijima順
Windows に Apache Web サーバをインストールし Web ゲートウェイを構成する方法
Mihoko Iijima順
IRISのプロセス(処理)を停止させる方法
Megumi Kakechi順
IRIS 2025.2 から導入される IRISSECURITY データベースについて
Seisuke Nakahashi順
監視用常駐プロセスを作成する方法
Megumi Kakechi順
WEBGatewayのサーバー設定項目で、Minimum Server Connections、Maximum Server Connectionsの項目が表示されない
Hiroshi Sato順
ODBCログの取得方法(Windows)
Hiroshi Sato順
JSON形式のファイルを読み書きするサンプル
Hiroshi Sato順
ODBCログの取得方法(UNIX)
Hiroshi Sato順
JDBCログの取得方法
Hiroshi Sato順
データベースのジャーナルを無効にした場合の影響について
Megumi Kakechi順
#InterSystems IRIS for Health
お知らせ
#InterSystems IRIS
Red Hat Enterprise Linux 10 の InterSystems IRIS 製品でのサポートのお知らせ
Masahito Miura順
InterSystems Developer Tool コンテスト 2025(USコミュニティ)
Mihoko Iijima順
インターシステムズ第4回ソリューションウェビナー「ホスピタルショウ注目技術をざっくり解説!インターシステムズの最新情報」のご案内
Rie Tokue順
インターシステムズ第5回ソリューションウェビナー「~FHIR×OMOP CDMで広がる医療データの価値~InterSystems OMOPのご紹介」
Rie Tokue順
VS Code - ObjectScript 拡張機能の利用状況データ収集について
Seisuke Nakahashi順
インターシステムズ製品 2025.1.1 のご案内
Ayumu Tanaka順
インターシステムズ 第23回 開発者向けウェビナー「RAG+生成AIであそぼう!」のご案内
Rie Tokue順
InterSystems IRIS 2025.2 のリリースのご案内
Masahito Miura順
質問
#Caché
Webアプリケーション開発
kenichiro sameshima順
7月, 2025Month at a GlanceInterSystems Developer Community