-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathservice1.js
More file actions
76 lines (66 loc) · 3.57 KB
/
service1.js
File metadata and controls
76 lines (66 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const cds = require("@sap/cds");
/* Emit a "Received1" event upon receiving a READ request on its entity. */
module.exports = class Service1 extends cds.ApplicationService {
init() {
this.on("send1", async (req) => {
const { messageToPass } = req.data; // UNSAFE: Taint source, Exposed service
const Service2 = await cds.connect.to("service-2");
Service2.send("send2", { messageToPass });
});
this.on("send2", async (req) => {
const [ messageToPass ] = req.params; // UNSAFE: Taint source, Exposed service
const Service2 = await cds.connect.to("service-2");
Service2.send("send2", { messageToPass });
});
this.on("send3", async (req) => {
const messageToPass = req.headers["user-agent"]; // UNSAFE: Taint source, Exposed service
const Service2 = await cds.connect.to("service-2");
Service2.send("send2", { messageToPass });
});
this.on("send4", async (req) => {
const messageToPass1 = req.http.req.query.someProp; // UNSAFE: Taint source, Exposed service
const messageToPass2 = req.http.req.body.someProp; // UNSAFE: Taint source, Exposed service
const messageToPass3 = req.http.req.params.someProp; // UNSAFE: Taint source, Exposed service
const messageToPass4 = req.http.req.headers.someProp; // UNSAFE: Taint source, Exposed service
const messageToPass5 = req.http.req.cookies.someProp; // UNSAFE: Taint source, Exposed service
const messageToPass6 = req.http.req.originalUrl; // UNSAFE: Taint source, Exposed service
const messageToPass7 = req.http.req.hostname; // UNSAFE: Taint source, Exposed service
const messageToPass8 = req.http.req.get("someProp"); // UNSAFE: Taint source, Exposed service
const messageToPass9 = req.http.req.is("someProp"); // UNSAFE: Taint source, Exposed service
const messageToPass10 = req.http.req.header("someProp"); // UNSAFE: Taint source, Exposed service
const messageToPass11 = req.http.req.param("someProp"); // UNSAFE: Taint source, Exposed service
const Service2 = await cds.connect.to("service-2"); // UNSAFE: Taint source, Exposed service
Service2.send("send2", { messageToPass1 });
});
this.on("send5", async (req) => {
const messageToPass = req.id; // UNSAFE: Taint source, Exposed service
const Service2 = await cds.connect.to("service-2");
Service2.send("send2", { messageToPass });
});
this.on("send6", async (req) => {
const messageToPass = req._queryOptions; // UNSAFE: Taint source, Exposed service
const Service2 = await cds.connect.to("service-2");
Service2.send("send2", { messageToPass });
});
this.on("send7", async (req) => {
const messageToPass = req.locale; // SAFE: Not a taint source, Exposed service
const Service2 = await cds.connect.to("service-2");
Service2.send("send2", { messageToPass });
});
this.on("send8", async (req) => {
const messageToPass = req.tenant; // SAFE: Not a taint source, Exposed service
const Service2 = await cds.connect.to("service-2");
Service2.send("send2", { messageToPass });
});
this.on("send9", async (req) => {
const messageToPass = req.timestamp; // SAFE: Not a taint source, Exposed service
const Service2 = await cds.connect.to("service-2");
Service2.send("send2", { messageToPass });
});
this.on("send10", async (req) => {
const messageToPass = req.user; // SAFE: Not a taint source, Exposed service
const Service2 = await cds.connect.to("service-2");
Service2.send("send2", { messageToPass });
});
}
};