Skip to content

JS: Add class harness to recover localFieldStep edges #19287

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions javascript/ql/test/library-tests/TripleDot/class.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import 'dummy';

class Foo {
constructor() {
this.size = 1024 * 1024 * 4;
this.buffer = null;
}

someSink() {
sink(this.buffer); // $ MISSING: hasTaintFlow=h1.1
}

setData2(data) {
this.buffer = Buffer.from(data);
}

setData() {
this.setData2(source("h1.1"));
}

allocate_buffers () {
this.buffer = new Buffer(this.size);
}
}

// Tests pass without allocate_buffers function present in the class
class Baz {
constructor() {
this.size = 1024 * 1024 * 4;
this.buffer = null;
}

someSink() {
sink(this.buffer); // $ hasTaintFlow=h1.2
}

setData2(data) {
this.buffer = Buffer.from(data);
}

setData() {
this.setData2(source("h1.2"));
}
}

// Tests pass with single setData instead of setData -> setData2
class Baz {
constructor() {
this.size = 1024 * 1024 * 4;
this.buffer = null;
}

someSink() {
sink(this.buffer); // $ hasTaintFlow=h1.3
}

setData() {
this.buffer = Buffer.from(source("h1.3"));
}

allocate_buffers () {
this.buffer = new Buffer(this.size);
}
}

// Tests pass taking hardcoded value instead of class member
class Foz {
constructor() {
this.buffer = null;
}

someSink() {
sink(this.buffer); // $ hasTaintFlow=h1.1
}

setData2(data) {
this.buffer = Buffer.from(data);
}

setData() {
this.setData2(source("h1.1"));
}

allocate_buffers () {
this.buffer = new Buffer(1024 * 1024 * 4);
}
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy