Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

False Positive SCS0015: Hardcoded value in 'byte[] SymmetricAlgorithm.Key' #197

Copy link
Copy link
@watfordgnf

Description

@watfordgnf
Issue body actions

Environment (please complete the following information):

  • Version: 5.1.0
  • Branch: SecurityCodeScan 2019
  • Microsoft Visual Studio Enterprise 2019 Preview Version 16.10.0 Preview 1.0
  • OS: Windows

Describe the bug
I am receiving a false positive SCS0015: Hardcoded value in 'byte[] SymmetricAlgorithm.Key'.

Repro

            using (Aes aes = Aes.Create())
            {
                byte[] key = _ecdh.DeriveKeyFromHash(publicKey, hashAlgorithm, encryptedData.Nonce, fixedInfo);
                try
                {
                    aes.IV = encryptedData.IV;
                    aes.Key = key; // SCS0015: Hardcoded value in byte[] SymmetricAlgorithm.Key
                    ...

Where:

  • _ecdh is an instance of ECDiffieHellman
  • publicKey is an ECDiffieHellmanPublicKey instance
  • hashAlgorithm is HashAlgorithmName.SHA256
  • encryptedData.Nonce is a byte[] property on a DTO class
  • encryptedData.IV is a byte[] property on a DTO class
  • fixedInfo is a byte[]? parameter to the decrypt method

I've tried recreating this in a standalone project but cannot get SCS0015 to fire on that line, so I'm not quite sure which of the arguments to DeriveKeyFromHash is causing it to fail yet.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.