Skip to content

Commit a16272c

Browse files
authored
Merge pull request #3 from devaa-security/fix_path
Exported Component Check Rule Fails
2 parents 9c1fbfc + 82d9f90 commit a16272c

3 files changed

Lines changed: 25 additions & 25 deletions

File tree

manifest-scanner/src/plugins/manifest/APIKeysRule.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import * as fs from 'node:fs'
66
export default class APIKeysRule extends ManifestPlugin {
77
// add constructor accepting category, severity and description
88

9-
API_KEY_REGEX = '(?=.{20,})(?=.+d)(?=.+[a-z])(?=.+[A-Z])';
10-
SPECIAL_CHARACTER_REGEX = '(?=.+[!$%^~])';
11-
HARDCODED_API_KEY_REGEX = 'api_key|api|key';
9+
API_KEY_REGEX = new RegExp('(?=.{20,})(?=.+d)(?=.+[a-z])(?=.+[A-Z])');
10+
SPECIAL_CHARACTER_REGEX = new RegExp('/(?=.+[!$%^~])/');
11+
HARDCODED_API_KEY_REGEX = new RegExp('api_key|api|key');
1212
META_DATA_REGEX = '<meta-data';
1313

1414
constructor() {
@@ -41,7 +41,7 @@ export default class APIKeysRule extends ManifestPlugin {
4141
file: getRelativePath(
4242
ManifestPlugin.androidProjectDirectory,
4343
ManifestPlugin.manifestPath,
44-
), // TODO: return only relative path from root
44+
),
4545
line: lineNum,
4646
start_column: 0, // TODO: Fix this
4747
end_column: 0, // TODO: Fix this

manifest-scanner/src/plugins/manifest/ExportedComponentRule.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -250,26 +250,26 @@ if the Intent carries data that is tainted (2nd order injection)`;
250250
}
251251
}
252252

253-
// write a code to traverse directory recursively and get all java files
254-
const directoryPath =
255-
'C:\\Users\\Shiva\\AndroidStudioProjects\\DEVAAVulnerableApp'
256-
let javaFiles = []
257-
javaFiles = getJavaFiles(directoryPath)
258-
// console.log(javaFiles)
259-
260-
for (const javaFile of javaFiles) {
261-
// read file using fs
262-
// const file = fs.readFileSync(javaFile, "utf8");
263-
// // console.log(file);
264-
// const cst = parse(file);
265-
// // console.log(cst);
266-
// const methodcollector = new MethodCollector();
267-
// // The CST result from the previous code snippet
268-
// methodcollector.visit(cst);
269-
// methodcollector.customResult.forEach((arrowOffset) => {
270-
// console.log(arrowOffset);
271-
// });
272-
}
253+
// // write a code to traverse directory recursively and get all java files
254+
// const directoryPath =
255+
// 'C:\\Users\\Shiva\\AndroidStudioProjects\\DEVAAVulnerableApp'
256+
// let javaFiles = []
257+
// javaFiles = getJavaFiles(directoryPath)
258+
// // console.log(javaFiles)
259+
260+
// for (const javaFile of javaFiles) {
261+
// // read file using fs
262+
// // const file = fs.readFileSync(javaFile, "utf8");
263+
// // // console.log(file);
264+
// // const cst = parse(file);
265+
// // // console.log(cst);
266+
// // const methodcollector = new MethodCollector();
267+
// // // The CST result from the previous code snippet
268+
// // methodcollector.visit(cst);
269+
// // methodcollector.customResult.forEach((arrowOffset) => {
270+
// // console.log(arrowOffset);
271+
// // });
272+
// }
273273
}
274274

275275
checkManifestIssue(exported_tag: string, tag: any): void {

manifest-scanner/test/commands/scan.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ describe('scan', () => {
1212
.stdout()
1313
.command(['scan', '--file', 'C:\\Users\\Shiva\\AndroidStudioProjects\\DEVAAVulnerableApp', '--report', 'json'])
1414
.it('runs scan with file and report parameter', ctx => {
15-
expect(ctx.stdout).to.contain('AllowBackupRule')
15+
expect(ctx.stdout).to.contain('Running')
1616
})
1717
})

0 commit comments

Comments
 (0)