다음을 통해 공유


빠른 시작: 보안 분석기

GitHub Copilot는 개발자가 SQL 코드 및 애플리케이션 계층 쿼리에서 일반적인 보안 위험을 식별하고 해결하는 데 도움을 줍니다. 특히 개발 중에 실용적이고 컨텍스트 인식 권장 사항을 제공하여 강력한 보안 배경이 없는 개발자를 위해 SQL 삽입, 과다 노출된 데이터 및 안전하지 않은 패턴과 같은 취약성을 감지하는 데 도움이 될 수 있습니다.

시작하기

데이터베이스에 연결되어 있고 MSSQL 확장으로 활성 편집기 창이 열려 있는지 확인합니다. 이 연결을 사용하면 채팅 참가자가 @mssql 데이터베이스 환경의 컨텍스트를 이해할 수 있으므로 정확하고 컨텍스트 인식 제안을 사용할 수 있습니다. 데이터베이스 연결이 없으면 채팅 참가자는 의미 있는 응답을 제공하는 스키마 또는 데이터 컨텍스트가 없습니다.

다음 예제에서는 AdventureWorksLT2022 홈페이지에서 다운로드할 수 있는 샘플 데이터베이스를 사용합니다.

최상의 결과를 위해 사용자 고유의 환경에 맞게 테이블 및 스키마 이름을 조정합니다.

@mssql 접두사가 채팅에 포함되어 있는지 확인하세요. 예를 들어, @mssql을 입력한 후에 질문이나 프롬프트를 작성합니다. 이렇게 하면 채팅 참가자가 SQL 관련 지원을 요청하는 것을 이해할 수 있습니다.

GitHub Copilot를 사용하여 보안 위험 감지 및 수정

GitHub Copilot는 개발자가 프로덕션에 도달하기 전에 개발 프로세스 초기에 일반적인 보안 취약성을 감지하고 수정하는 데 도움이 됩니다. 원시 SQL, ORM 또는 저장 프로시저를 사용하든, GitHub Copilot는 안전하지 않은 패턴을 식별하고, 잠재적 위험을 설명하고, 데이터베이스 컨텍스트에 따라 더 안전한 대안을 제안할 수 있습니다. 이는 보안을 전문으로 하지 않지만 보안 코딩 방법을 따라야 하는 개발자에게 특히 유용합니다.

다음은 채팅 참가자를 통해 요청할 수 있는 일반적인 사용 사례 및 예제입니다.

SQL 인젝션 탐지

SQL 삽입은 데이터베이스 애플리케이션에서 가장 일반적이고 위험한 보안 취약성 중 하나입니다. GitHub Copilot는 매개 변수가 없는 쿼리, 문자열 보간 문제 및 동적 SQL의 오용을 식별하는 동시에 컨텍스트에 맞게 보다 안전하고 매개 변수가 있는 대안을 권장할 수 있습니다.

Python의 SQLAlchemy 예제

I'm working with SQLAlchemy in Python for my current database `SalesLT` schema. Check the following `SQLAlchemy` query for potential security risks, such as SQL injection, over-fetching, or performance issues. If applicable, suggest improvements using parameterized queries, connection pooling, and other secure `SQL Server` practices to ensure performance and security.

query = f"SELECT * FROM SalesLT.Customer WHERE LastName = '{user_input}'"
result = engine.execute(query).fetchall()

JavaScript SQL 예제

Analyze the following JavaScript SQL query for potential security vulnerabilities. Identify risks such as SQL injection, over-fetching, and poor authentication practices. Explain why this query is insecure and provide a secure alternative.

const query = `SELECT * FROM Users WHERE Username = '${username}' AND Password = '${password}'`;

SQL 삽입 공격 시뮬레이션

Using my current database, simulate a SQL injection attack for the `SalesLT.uspGetCustomerOrderHistory` stored procedure and suggest fixes.

저장 프로시저 예시 검토

Review the stored procedure `SalesLT.uspGetCustomerOrderHistory` in my current database for potential SQL injection vulnerabilities. Explain how unparameterized or improperly validated inputs could be exploited and recommend secure coding practices.

보안 문제 식별 예제

Review the `SalesLT.uspGetCustomerOrderHistory_Insecure` stored procedure. Identify any potential security issues in the implementation and then provide a revised version of the stored procedure that addresses these concerns without explicitly listing security best practices.

You can use the following T-SQL to create the stored procedure:

CREATE OR ALTER PROCEDURE [SalesLT].[uspGetCustomerOrderHistory_Insecure]
@CustomerID NVARCHAR (50)
AS
BEGIN
    DECLARE @SQL AS NVARCHAR (MAX) = N'SELECT *
    FROM SalesLT.SalesOrderHeader
    WHERE CustomerID = ' + @CustomerID + ';';
    EXECUTE (@SQL);
END
GO

일반 보안 제안

SQL 삽입 외에도 많은 데이터베이스 애플리케이션은 중요한 데이터를 노출하거나 기본적으로 안전하지 않은 구성을 사용합니다. GitHub Copilot는 연결을 암호화하고, 개인 데이터를 마스킹하거나 보호하고, 여러 개발 스택에서 보안 인증 및 권한 부여 모범 사례에 부합하는 지침을 제공합니다.

중요한 데이터 스토리지 예제

Recommend secure methods for storing sensitive data in the `SalesLT.Address` table.

개인 데이터 마스킹 예제

What are the best strategies or built-in features in my database for masking personal data in the `SalesLT.Customer` table?

Entity Framework Core 예제에서 암호화 적용

How can I configure my connection string in Entity Framework Core to enforce encryption and avoid exposing credentials?

Node.js 인증 예제의 Microsoft Entra ID

In a Prisma or Node.js environment, how can I securely use Microsoft Entra ID authentication or managed identity with SQL Server instead of storing passwords?

데이터 보안을 위한 SQL Server 옵션 권장 예제

What SQL Server options should I enable or verify (for example, Always Encrypted, Transparent Data Encryption) to protect customer data when using ORMs like Sequelize or EF Core?

사용자 경험 공유

MSSQL 확장에 대한 GitHub Copilot를 구체화하고 개선하는 데 도움이 되도록 다음 GitHub 문제 템플릿을 사용하여 피드백을 제출합니다. GitHub Copilot 피드백

피드백을 제출할 때 다음을 포함하는 것이 좋습니다.

  • 테스트된 시나리오 – 스키마 만들기, 쿼리 생성, 보안, 지역화와 같이 집중한 영역을 알려주세요.

  • 잘 작동하는 기능 – 원활하거나 도움이 되거나 예상을 초과한 모든 경험을 설명합니다.

  • 문제 또는 버그 – 문제, 불일치 또는 혼란스러운 동작을 포함합니다. 스크린샷 또는 화면 녹화는 특히 유용합니다.

  • 개선 제안 - 유용성 향상, 적용 범위 확장 또는 GitHub Copilot의 응답 향상을 위한 아이디어를 공유합니다.