-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[hack] Add an example taint flow with shapes
Summary: This used to be a FN but with dictionary models from D45741308 the flow is properly identified. Reviewed By: geralt-encore Differential Revision: D45986709 fbshipit-source-id: ad1c0eb50fa8d1910e849f04b793b75def3ce9b8
- Loading branch information
1 parent
98c79c4
commit 9bfc837
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) Facebook, Inc. and its affiliates. | ||
// | ||
// This source code is licensed under the MIT license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
namespace Shapes; | ||
|
||
class ShapeLogger { | ||
const type TSchemaShape = shape( | ||
?'msg' => ?string, | ||
?'debug_data' => ?string, | ||
); | ||
|
||
public static function logData(this::TSchemaShape $data) { | ||
\Level1\taintSink($data); | ||
} | ||
} | ||
|
||
class C1 { | ||
public function passViaShapeBad(SensitiveClass $sc) { | ||
ShapeLogger::logData(shape('msg' => 'Oh-oh', 'debug_data' => $sc->sensitiveField)); | ||
} | ||
} |