Skip to content

Add sensitive information exposure query #126

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

Merged
merged 9 commits into from
Jul 30, 2024
Merged

Conversation

knewbury01
Copy link
Contributor

currently this query only covers the case of a PropRead (ie entity field) being the exact match for the annotated sensitive element. Technically also the entire entity (see entity level labels) can be labelled as @PersonalData but I am considering to define the first iteration of this with the heuristic that fields in that case are still what also get annotated additionally and exposed.

happy to reconsider based on other's thoughts! :)

@knewbury01 knewbury01 self-assigned this Jul 19, 2024
init() {
/* A sensitive info log sink. */

LOG.info("Received: ", Sample.name); // CAP log exposure alert

Check failure

Code scanning / CodeQL

Insertion of sensitive information into log files High test

Log entry depends on a potentially sensitive piece of information.
Copy link
Contributor

@jeongsoolee09 jeongsoolee09 left a comment

Choose a reason for hiding this comment

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

I left some thoughts on improving the structure of the query.

@knewbury01 knewbury01 requested a review from jeongsoolee09 July 23, 2024 00:23
Copy link
Contributor

@jeongsoolee09 jeongsoolee09 left a comment

Choose a reason for hiding this comment

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

Superb!

@knewbury01 knewbury01 merged commit 867fba8 into main Jul 30, 2024
4 of 5 checks passed
@knewbury01 knewbury01 deleted the knewbury01/e2-pii-cap branch July 30, 2024 16:01

class SensitiveExposureSource extends DataFlow::Node {
SensitiveExposureSource() {
exists(PropRead p, SensitiveAnnotatedElement c |
Copy link
Contributor

@mbaluda mbaluda Jul 31, 2024

Choose a reason for hiding this comment

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

I see a problem here as you are only comparing on the property name (name in the test vs Sample.name)
There can be multiple entities with the same names as well as multiple applications in the same repo...
I think you can use getCdsDeclaration()

* @problem.severity warning
* @security-severity 7.5
* @precision medium
* @id javascript/sensitive-log
Copy link
Contributor

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants