(http://alexei.ro/)"],
9 | "homepage": "https://github.com/alexei/sprintf.js",
10 | "repository": {
11 | "type": "git",
12 | "url": "git://github.com/alexei/sprintf.js.git"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/node_modules/sprintf-js/demo/angular.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{ "%+010d"|sprintf:-123 }}
10 | {{ "%+010d"|vsprintf:[-123] }}
11 | {{ "%+010d"|fmt:-123 }}
12 | {{ "%+010d"|vfmt:[-123] }}
13 | {{ "I've got %2$d apples and %1$d oranges."|fmt:4:2 }}
14 | {{ "I've got %(apples)d apples and %(oranges)d oranges."|fmt:{apples: 2, oranges: 4} }}
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/node_modules/sprintf-js/dist/angular-sprintf.min.js:
--------------------------------------------------------------------------------
1 | /*! sprintf-js | Alexandru Marasteanu (http://alexei.ro/) | BSD-3-Clause */
2 |
3 | angular.module("sprintf",[]).filter("sprintf",function(){return function(){return sprintf.apply(null,arguments)}}).filter("fmt",["$filter",function(a){return a("sprintf")}]).filter("vsprintf",function(){return function(a,b){return vsprintf(a,b)}}).filter("vfmt",["$filter",function(a){return a("vsprintf")}]);
4 | //# sourceMappingURL=angular-sprintf.min.map
--------------------------------------------------------------------------------
/node_modules/sprintf-js/dist/angular-sprintf.min.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"angular-sprintf.min.js","sources":["../src/angular-sprintf.js"],"names":["angular","module","filter","sprintf","apply","arguments","$filter","format","argv","vsprintf"],"mappings":";;AAAAA,QACIC,OAAO,cACPC,OAAO,UAAW,WACd,MAAO,YACH,MAAOC,SAAQC,MAAM,KAAMC,cAGnCH,OAAO,OAAQ,UAAW,SAASI,GAC/B,MAAOA,GAAQ,cAEnBJ,OAAO,WAAY,WACf,MAAO,UAASK,EAAQC,GACpB,MAAOC,UAASF,EAAQC,MAGhCN,OAAO,QAAS,UAAW,SAASI,GAChC,MAAOA,GAAQ"}
--------------------------------------------------------------------------------
/node_modules/sprintf-js/dist/angular-sprintf.min.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"angular-sprintf.min.js","sources":["../src/angular-sprintf.js"],"names":["angular","module","filter","sprintf","apply","arguments","$filter","format","argv","vsprintf"],"mappings":";;AAAAA,QACIC,OAAO,cACPC,OAAO,UAAW,WACd,MAAO,YACH,MAAOC,SAAQC,MAAM,KAAMC,cAGnCH,OAAO,OAAQ,UAAW,SAASI,GAC/B,MAAOA,GAAQ,cAEnBJ,OAAO,WAAY,WACf,MAAO,UAASK,EAAQC,GACpB,MAAOC,UAASF,EAAQC,MAGhCN,OAAO,QAAS,UAAW,SAASI,GAChC,MAAOA,GAAQ"}
--------------------------------------------------------------------------------
/node_modules/sprintf-js/dist/sprintf.min.js:
--------------------------------------------------------------------------------
1 | /*! sprintf-js | Alexandru Marasteanu (http://alexei.ro/) | BSD-3-Clause */
2 |
3 | !function(a){function b(){var a=arguments[0],c=b.cache;return c[a]&&c.hasOwnProperty(a)||(c[a]=b.parse(a)),b.format.call(null,c[a],arguments)}function c(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}function d(a,b){return Array(b+1).join(a)}var e={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};b.format=function(a,f){var g,h,i,j,k,l,m,n=1,o=a.length,p="",q=[],r=!0,s="";for(h=0;o>h;h++)if(p=c(a[h]),"string"===p)q[q.length]=a[h];else if("array"===p){if(j=a[h],j[2])for(g=f[n],i=0;i=0),j[8]){case"b":g=g.toString(2);break;case"c":g=String.fromCharCode(g);break;case"d":case"i":g=parseInt(g,10);break;case"j":g=JSON.stringify(g,null,j[6]?parseInt(j[6]):0);break;case"e":g=j[7]?g.toExponential(j[7]):g.toExponential();break;case"f":g=j[7]?parseFloat(g).toFixed(j[7]):parseFloat(g);break;case"g":g=j[7]?parseFloat(g).toPrecision(j[7]):parseFloat(g);break;case"o":g=g.toString(8);break;case"s":g=(g=String(g))&&j[7]?g.substring(0,j[7]):g;break;case"u":g>>>=0;break;case"x":g=g.toString(16);break;case"X":g=g.toString(16).toUpperCase()}e.json.test(j[8])?q[q.length]=g:(!e.number.test(j[8])||r&&!j[3]?s="":(s=r?"+":"-",g=g.toString().replace(e.sign,"")),l=j[4]?"0"===j[4]?"0":j[4].charAt(1):" ",m=j[6]-(s+g).length,k=j[6]&&m>0?d(l,m):"",q[q.length]=j[5]?s+g+k:"0"===l?s+k+g:k+s+g)}return q.join("")},b.cache={},b.parse=function(a){for(var b=a,c=[],d=[],f=0;b;){if(null!==(c=e.text.exec(b)))d[d.length]=c[0];else if(null!==(c=e.modulo.exec(b)))d[d.length]="%";else{if(null===(c=e.placeholder.exec(b)))throw new SyntaxError("[sprintf] unexpected placeholder");if(c[2]){f|=1;var g=[],h=c[2],i=[];if(null===(i=e.key.exec(h)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(g[g.length]=i[1];""!==(h=h.substring(i[0].length));)if(null!==(i=e.key_access.exec(h)))g[g.length]=i[1];else{if(null===(i=e.index_access.exec(h)))throw new SyntaxError("[sprintf] failed to parse named argument key");g[g.length]=i[1]}c[2]=g}else f|=2;if(3===f)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");d[d.length]=c}b=b.substring(c[0].length)}return d};var f=function(a,c,d){return d=(c||[]).slice(0),d.splice(0,0,a),b.apply(null,d)};"undefined"!=typeof exports?(exports.sprintf=b,exports.vsprintf=f):(a.sprintf=b,a.vsprintf=f,"function"==typeof define&&define.amd&&define(function(){return{sprintf:b,vsprintf:f}}))}("undefined"==typeof window?this:window);
4 | //# sourceMappingURL=sprintf.min.map
--------------------------------------------------------------------------------
/node_modules/sprintf-js/gruntfile.js:
--------------------------------------------------------------------------------
1 | module.exports = function(grunt) {
2 | grunt.initConfig({
3 | pkg: grunt.file.readJSON("package.json"),
4 |
5 | uglify: {
6 | options: {
7 | banner: "/*! <%= pkg.name %> | <%= pkg.author %> | <%= pkg.license %> */\n",
8 | sourceMap: true
9 | },
10 | build: {
11 | files: [
12 | {
13 | src: "src/sprintf.js",
14 | dest: "dist/sprintf.min.js"
15 | },
16 | {
17 | src: "src/angular-sprintf.js",
18 | dest: "dist/angular-sprintf.min.js"
19 | }
20 | ]
21 | }
22 | },
23 |
24 | watch: {
25 | js: {
26 | files: "src/*.js",
27 | tasks: ["uglify"]
28 | }
29 | }
30 | })
31 |
32 | grunt.loadNpmTasks("grunt-contrib-uglify")
33 | grunt.loadNpmTasks("grunt-contrib-watch")
34 |
35 | grunt.registerTask("default", ["uglify", "watch"])
36 | }
37 |
--------------------------------------------------------------------------------
/node_modules/sprintf-js/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "_args": [
3 | [
4 | "sprintf-js@1.0.3",
5 | "c:\\code-analysis-2"
6 | ]
7 | ],
8 | "_from": "sprintf-js@1.0.3",
9 | "_id": "sprintf-js@1.0.3",
10 | "_inBundle": false,
11 | "_integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
12 | "_location": "/sprintf-js",
13 | "_phantomChildren": {},
14 | "_requested": {
15 | "type": "version",
16 | "registry": true,
17 | "raw": "sprintf-js@1.0.3",
18 | "name": "sprintf-js",
19 | "escapedName": "sprintf-js",
20 | "rawSpec": "1.0.3",
21 | "saveSpec": null,
22 | "fetchSpec": "1.0.3"
23 | },
24 | "_requiredBy": [
25 | "/argparse"
26 | ],
27 | "_resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
28 | "_spec": "1.0.3",
29 | "_where": "c:\\code-analysis-2",
30 | "author": {
31 | "name": "Alexandru Marasteanu",
32 | "email": "hello@alexei.ro",
33 | "url": "http://alexei.ro/"
34 | },
35 | "bugs": {
36 | "url": "https://github.com/alexei/sprintf.js/issues"
37 | },
38 | "description": "JavaScript sprintf implementation",
39 | "devDependencies": {
40 | "grunt": "*",
41 | "grunt-contrib-uglify": "*",
42 | "grunt-contrib-watch": "*",
43 | "mocha": "*"
44 | },
45 | "homepage": "https://github.com/alexei/sprintf.js#readme",
46 | "license": "BSD-3-Clause",
47 | "main": "src/sprintf.js",
48 | "name": "sprintf-js",
49 | "repository": {
50 | "type": "git",
51 | "url": "git+https://github.com/alexei/sprintf.js.git"
52 | },
53 | "scripts": {
54 | "test": "mocha test/test.js"
55 | },
56 | "version": "1.0.3"
57 | }
58 |
--------------------------------------------------------------------------------
/node_modules/sprintf-js/src/angular-sprintf.js:
--------------------------------------------------------------------------------
1 | angular.
2 | module("sprintf", []).
3 | filter("sprintf", function() {
4 | return function() {
5 | return sprintf.apply(null, arguments)
6 | }
7 | }).
8 | filter("fmt", ["$filter", function($filter) {
9 | return $filter("sprintf")
10 | }]).
11 | filter("vsprintf", function() {
12 | return function(format, argv) {
13 | return vsprintf(format, argv)
14 | }
15 | }).
16 | filter("vfmt", ["$filter", function($filter) {
17 | return $filter("vsprintf")
18 | }])
19 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "code-analysis",
3 | "version": "1.0.0",
4 | "description": "Node dependencies for the .NET Code analysis action.",
5 | "scripts": {
6 | "test": "mocha"
7 | },
8 | "author": "Microsoft Corporation",
9 | "license": "",
10 | "dependencies": {
11 | "@actions/core": "1.2.6",
12 | "@actions/exec": "1.0.4",
13 | "js-yaml": "3.13.1",
14 | "@types/mocha": "^2.2.44",
15 | "@types/node": "^8.0.53",
16 | "@types/q": "^1.0.6",
17 | "@types/sinon": "^4.1.2"
18 | },
19 | "devDependencies": {
20 | "sinon": "^4.1.3",
21 | "typescript": "^3.7.5"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/policy/github.changelog.md:
--------------------------------------------------------------------------------
1 | # GitHub Policy Change Log
2 | All notable changes to this project will be documented in this file.
3 |
4 | The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
5 |
6 | ## v1.1.0 - 06/18/2020
7 | GitHub Policy Release - requiredTools
--------------------------------------------------------------------------------
/policy/github.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Microsoft.Security.CodeAnalysis.Policy.GitHub
5 | 1.1.0
6 | Microsoft Security Code Analysis Policy for GitHub.
7 | Microsoft
8 | https://aka.ms/mscadocs
9 | en-US
10 | MS-PL
11 | false
12 |
13 | © Microsoft Corporation. All rights reserved.
14 |
15 | ## v1.1.0 - 06/18/2020
16 | GitHub Policy Release - requiredTools
17 |
18 |
19 |
--------------------------------------------------------------------------------
/sample/ClassLibrary1.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30911.218
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "ClassLibrary1\ClassLibrary1.csproj", "{D93DCE72-417F-4F71-8BC5-03CDB1932B9D}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {D93DCE72-417F-4F71-8BC5-03CDB1932B9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {D93DCE72-417F-4F71-8BC5-03CDB1932B9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {D93DCE72-417F-4F71-8BC5-03CDB1932B9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {D93DCE72-417F-4F71-8BC5-03CDB1932B9D}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {F67E648A-4693-4494-8C38-B2735AC8DADE}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/sample/ClassLibrary1/Class1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Security.Cryptography;
3 | using System.Text;
4 |
5 | namespace ClassLibrary1
6 | {
7 | public class Class1
8 | {
9 | public void M()
10 | {
11 | Console.WriteLine("Hello World!");
12 |
13 | Console.WriteLine("Console App");
14 | MD5 md5 = MD5.Create();
15 |
16 | string contents = "Super secure data.";
17 | byte[] contentBytes = UTF8Encoding.UTF8.GetBytes(contents);
18 |
19 | byte[] hash = md5.ComputeHash(contentBytes);
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/sample/ClassLibrary1/ClassLibrary1.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/build.proj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/msca-toolkit/msca-toolkit.proj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 | Microsoft.Security.CodeAnalysis.Cli
6 | 0.*
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/msca-toolkit/msca-toolkit.ts:
--------------------------------------------------------------------------------
1 | import * as path from 'path';
2 | import * as process from 'process';
3 | import * as core from '@actions/core';
4 | import * as exec from '@actions/exec';
5 | import * as fs from 'fs';
6 | import * as yaml from 'js-yaml';
7 | import { MscaInstaller } from './msca-installer'
8 |
9 | export class MscaAction {
10 | cliVersion: string = '0.*';
11 | constructor() { }
12 |
13 | async setupEnvironment() {
14 |
15 | console.log('------------------------------------------------------------------------------');
16 |
17 | if (!process.env.MSCA_FILEPATH) {
18 | let cliVersion = this.resolveCliVersion();
19 | let mscaInstaller = new MscaInstaller();
20 | await mscaInstaller.install(cliVersion);
21 | }
22 |
23 | console.log('------------------------------------------------------------------------------');
24 | }
25 |
26 | resolveCliVersion() : string {
27 | let cliVersion = this.cliVersion;
28 |
29 | if (process.env.MSCA_VERSION) {
30 | cliVersion = process.env.MSCA_VERSION;
31 | }
32 |
33 | return cliVersion;
34 | }
35 |
36 | isNullOrWhiteSpace(value: string) : boolean {
37 | return !value || !value.trim();
38 | }
39 |
40 | async init() {
41 |
42 | let cliFilePath: string = process.env.MSCA_FILEPATH;
43 | core.debug(`cliFilePath = ${cliFilePath}`);
44 |
45 | try {
46 | await exec.exec(cliFilePath, ['init', '--force']);
47 | }
48 | catch (error) {
49 | core.debug(error.Message);
50 | }
51 | }
52 |
53 | async run(inputArgs: string[]) {
54 |
55 | await this.setupEnvironment();
56 |
57 | await this.init();
58 |
59 | let cliFilePath: string = process.env.MSCA_FILEPATH;
60 | core.debug(`cliFilePath = ${cliFilePath}`);
61 |
62 | let args = ['run'];
63 |
64 | if (inputArgs != null)
65 | {
66 | for (let i = 0; i < inputArgs.length; i++)
67 | {
68 | args.push(inputArgs[i]);
69 | }
70 | }
71 |
72 | if (core.isDebug()) {
73 | args.push('--logger-level');
74 | args.push('trace');
75 | }
76 |
77 | let sarifFile : string = path.join(process.env.GITHUB_WORKSPACE, '.gdn', 'analysis_results.sarif');
78 | core.debug(`sarifFile = ${sarifFile}`);
79 |
80 | // Write it as a GitHub Action variable for follow up tasks to consume
81 | core.exportVariable('ANALYSIS_RESULTS_SARIF_FILE', sarifFile);
82 | core.setOutput('sarifFile', sarifFile);
83 |
84 | args.push('--export-breaking-results-to-file');
85 | args.push(`${sarifFile}`);
86 |
87 | core.debug('Running Microsoft Security Code Analysis...');
88 |
89 | try {
90 | await exec.exec(cliFilePath, args);
91 | }
92 | catch (error) {
93 | core.setFailed(error.Message);
94 | }
95 | }
96 | }
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es6",
4 | "module": "commonjs",
5 | "lib": [
6 | "es6"
7 | ],
8 | "outDir": "./lib",
9 | "rootDir": "./src",
10 | "strict": false,
11 | "noImplicitAny": false,
12 | "esModuleInterop": true
13 | },
14 | "include": [
15 | "src/**/*"
16 | ],
17 | "exclude": [
18 | "node_modules",
19 | "**/*.test.ts"
20 | ]
21 | }
--------------------------------------------------------------------------------