Skip to content
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

fix(query): false positive detections in "api_key_exposed" function #6757

Merged

Conversation

Tohar-orca
Copy link
Contributor

Closes #

Proposed Changes

  • add checks to the api_key_exposed function to verify the server is not using https

I submit this contribution under the Apache-2.0 license.

@github-actions github-actions bot added the community Community contribution label Oct 4, 2023
@Tohar-orca Tohar-orca changed the title Fix false positive detections in "api_key_exposed" function fix: false positive detections in "api_key_exposed" function Oct 4, 2023
@Tohar-orca Tohar-orca changed the title fix: false positive detections in "api_key_exposed" function fix(query): false positive detections in "api_key_exposed" function Oct 4, 2023
@github-actions github-actions bot added the query New query feature label Oct 4, 2023
Copy link
Contributor

@JoaoAtGit JoaoAtGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Tohar-orca,
how are you?
Can you give me more context about this false positive?
Can you tell which query was returning the result and a small code sample?

Thank you :)

@Tohar-orca
Copy link
Contributor Author

Hi @Tohar-orca, how are you? Can you give me more context about this false positive? Can you tell which query was returning the result and a small code sample?

Thank you :)

Hi @JoaoCxMartins :)
There are 2 queries which were returning false positives due to this issue:
openAPI/general/api_key_exposed_in_global_security and openAPI/general/api_key_exposed_in_operation_security
For example:

openapi: "3.0.1"
info:
  title: "test"
  version: "1.0"
servers:
  - url: "https://@API-GW-ID.execute-api.us-east-1.amazonaws.com/{basePath}"
    variables:
      basePath:
        default: "/api"
  
paths:
  /address:
    get:
      summary: test
      description: test
      security:
        - authorizer: [ ]

components:
  securitySchemes:
    authorizer:
      type: "apiKey"
      name: "authorization"
      in: "header"

@JoaoAtGit
Copy link
Contributor

Hi @Tohar-orca, how are you? Can you give me more context about this false positive? Can you tell which query was returning the result and a small code sample?
Thank you :)

Hi @JoaoCxMartins :) There are 2 queries which were returning false positives due to this issue: openAPI/general/api_key_exposed_in_global_security and openAPI/general/api_key_exposed_in_operation_security For example:

openapi: "3.0.1"
info:
  title: "test"
  version: "1.0"
servers:
  - url: "https://@API-GW-ID.execute-api.us-east-1.amazonaws.com/{basePath}"
    variables:
      basePath:
        default: "/api"
  
paths:
  /address:
    get:
      summary: test
      description: test
      security:
        - authorizer: [ ]

components:
  securitySchemes:
    authorizer:
      type: "apiKey"
      name: "authorization"
      in: "header"

Hi @Tohar-orca :)

To close this pr, can you implement a test for each one of the queries?
Using the same code sample that you put here, showing that we don't present results for the these queries.

Thank you :)

@Tohar-orca
Copy link
Contributor Author

Hi @Tohar-orca, how are you? Can you give me more context about this false positive? Can you tell which query was returning the result and a small code sample?
Thank you :)

Hi @JoaoCxMartins :) There are 2 queries which were returning false positives due to this issue: openAPI/general/api_key_exposed_in_global_security and openAPI/general/api_key_exposed_in_operation_security For example:

openapi: "3.0.1"
info:
  title: "test"
  version: "1.0"
servers:
  - url: "https://@API-GW-ID.execute-api.us-east-1.amazonaws.com/{basePath}"
    variables:
      basePath:
        default: "/api"
  
paths:
  /address:
    get:
      summary: test
      description: test
      security:
        - authorizer: [ ]

components:
  securitySchemes:
    authorizer:
      type: "apiKey"
      name: "authorization"
      in: "header"

Hi @Tohar-orca :)

To close this pr, can you implement a test for each one of the queries? Using the same code sample that you put here, showing that we don't present results for the these queries.

Thank you :)

Sure, done :)

@JoaoAtGit
Copy link
Contributor

Hi @Tohar-orca, how are you? Can you give me more context about this false positive? Can you tell which query was returning the result and a small code sample?
Thank you :)

Hi @JoaoCxMartins :) There are 2 queries which were returning false positives due to this issue: openAPI/general/api_key_exposed_in_global_security and openAPI/general/api_key_exposed_in_operation_security For example:

openapi: "3.0.1"
info:
  title: "test"
  version: "1.0"
servers:
  - url: "https://@API-GW-ID.execute-api.us-east-1.amazonaws.com/{basePath}"
    variables:
      basePath:
        default: "/api"
  
paths:
  /address:
    get:
      summary: test
      description: test
      security:
        - authorizer: [ ]

components:
  securitySchemes:
    authorizer:
      type: "apiKey"
      name: "authorization"
      in: "header"

Hi @Tohar-orca :)
To close this pr, can you implement a test for each one of the queries? Using the same code sample that you put here, showing that we don't present results for the these queries.
Thank you :)

Sure, done :)

TY for your help @Tohar-orca

@asofsilva asofsilva merged commit fe05f97 into Checkmarx:master Nov 6, 2023
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution query New query feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants