|
1 | | -# OpenCRE readme |
| 1 | +# OpenCRE |
2 | 2 |
|
3 | | -Go to https://www.opencre.org to see OpenCRE working and more explanation. |
4 | | -OpenCRE stands for Open Common Requirement enumeration. It is an interactive content linking platform for uniting security standards and guidelines. It offers easy and robust access to relevant information when designing, developing, testing and procuring secure software. |
| 3 | +Go to [https://www.opencre.org](https://www.opencre.org) to see OpenCRE working and more explanation. |
| 4 | +OpenCRE stands for Open Common Requirement enumeration. It is an interactive content linking platform for uniting security standards and guidelines. It offers easy and robust access to relevant information when designing, developing, testing and procuring secure software. |
5 | 5 |
|
6 | 6 | OpenCRE consists of: |
7 | | -- The application: a python web and cli application to access the data, running publicly at opencre.org |
8 | | -- The catalog data: a catalog of Common Requirements (CREs) |
9 | | -- The mapping data: links from each CRE to relevant sections in a range of standards |
10 | | -- Tools and guidelines to contribute to the data and to run the application locally |
| 7 | + |
| 8 | +* The application: a python web and cli application to access the data, running publicly at opencre.org |
| 9 | +* The catalog data: a catalog of Common Requirements (CREs) |
| 10 | +* The mapping data: links from each CRE to relevant sections in a range of standards |
| 11 | +* Tools and guidelines to contribute to the data and to run the application locally |
11 | 12 |
|
12 | 13 | # Contribute code or mappings |
13 | | -To see how you can contribute to the application or to the data (catalog or standard mappings), see [Contributing](docs/CONTRIBUTING.md). |
| 14 | + |
| 15 | +To see how you can contribute to the application or to the data (catalog or standard mappings), see [Contributing](docs/CONTRIBUTING.md). |
14 | 16 | We really welcome you! |
15 | 17 |
|
16 | 18 | # Roadmap |
| 19 | + |
17 | 20 | For a roadmap please see the [issues](https://github.com/OWASP/OpenCRE/issues). |
18 | 21 |
|
19 | 22 | # Running your own OpenCRE |
20 | 23 |
|
21 | 24 | You are free to use the public opencre application at opencre.org. Apart from that, you can run your own if you want to include your own security standards and guidelines for example. We call that myOpenCRE. |
22 | 25 |
|
23 | | -### Locally |
| 26 | +## Locally |
| 27 | + |
| 28 | +### Docker |
24 | 29 |
|
25 | | -#### Docker |
26 | 30 | The easiest way to run OpenCRE locally is by running the published docker container. |
27 | 31 | You can do so by running: |
28 | | -`docker run -p 5000:5000 ghcr.io/owasp/opencre/opencre:latest` |
29 | | -After the container has finished downloading the remote information you can access it in [localhost](http://127.0.0.1:5000) |
30 | | -If you want to develop on OpenCRE or docker is not available in your environment, you can alternatively run it via CLI |
31 | 32 |
|
32 | | -#### Command Line |
| 33 | +```bash |
| 34 | +docker run -p 5000:5000 ghcr.io/owasp/opencre/opencre:latest |
| 35 | +``` |
| 36 | + |
| 37 | +After the container has finished downloading the remote information you can access it in [http://127.0.0.1:5000](http://127.0.0.1:5000). |
| 38 | + |
| 39 | +If you want to develop on OpenCRE or docker is not available in your environment, you can alternatively run it via CLI. |
| 40 | + |
| 41 | +### Command Line |
33 | 42 |
|
34 | 43 | To run outside of Docker you need to install OpenCRE. |
35 | 44 | To install this application you need python3, yarn and virtualenv. |
36 | | -* Clone the repository: |
37 | | -<pre>git clone https://github.com/OWASP/common-requirement-enumeration </pre> |
38 | 45 |
|
39 | | -* (Recommend) Create and activate a Python virtual environment: |
40 | | -<pre>python3 -m venv venv |
41 | | -source venv/bin/activate </pre> |
| 46 | +Clone the repository: |
| 47 | + |
| 48 | +```bash |
| 49 | +git clone https://github.com/OWASP/common-requirement-enumeration |
| 50 | +``` |
| 51 | + |
| 52 | +(Recommended) Create and activate a Python virtual environment: |
| 53 | + |
| 54 | +```bash |
| 55 | +python3 -m venv venv |
| 56 | +source venv/bin/activate |
| 57 | +``` |
| 58 | + |
| 59 | +Install dependencies: |
| 60 | + |
| 61 | +```bash |
| 62 | +make install |
| 63 | +``` |
| 64 | + |
| 65 | +Download the latest CRE graph from upstream by running: |
| 66 | + |
| 67 | +```bash |
| 68 | +make upstream-sync |
| 69 | +``` |
| 70 | + |
| 71 | +Keep in mind that until [Issue #534](https://github.com/OWASP/OpenCRE/issues/534) is fixed you won't have access to gap analysis results locally. |
| 72 | + |
| 73 | +To run CRE locally then you can do: |
| 74 | + |
| 75 | +```bash |
| 76 | +make dev-flask |
| 77 | +``` |
| 78 | + |
| 79 | +To run the CLI application, you can run: |
| 80 | + |
| 81 | +```bash |
| 82 | +python cre.py --help |
| 83 | +``` |
| 84 | + |
| 85 | +To download a remote CRE spreadsheet locally you can run: |
| 86 | + |
| 87 | +```bash |
| 88 | +python cre.py --review --from_spreadsheet <google sheets url> |
| 89 | +``` |
| 90 | + |
| 91 | +To add a remote spreadsheet to your local database you can run: |
| 92 | + |
| 93 | +```bash |
| 94 | +python cre.py --add --from_spreadsheet <google sheets url> |
| 95 | +``` |
| 96 | + |
| 97 | +To run the web application for development you can run: |
| 98 | + |
| 99 | +```bash |
| 100 | +make start-containers |
| 101 | +make start-worker |
| 102 | + |
| 103 | +# in a separate shell |
| 104 | +make dev-flask |
| 105 | +``` |
| 106 | + |
| 107 | +Alternatively, you can use the dockerfile with: |
| 108 | + |
| 109 | +```bash |
| 110 | +make docker && make docker-run |
| 111 | +``` |
| 112 | + |
| 113 | +Some features like Gap Analysis require a neo4j DB running, you can start this with: |
| 114 | + |
| 115 | +```bash |
| 116 | +make docker-neo4j |
| 117 | +``` |
| 118 | + |
| 119 | +Environment variables for app to connect to neo4jDB (default): |
| 120 | + |
| 121 | +* `NEO4J_URL` (neo4j//neo4j:password@localhost:7687) |
| 122 | + |
| 123 | +To run the web application for production you need gunicorn and you can run from within the cre_sync dir: |
42 | 124 |
|
43 | | -* Install dependencies |
44 | | -<pre> make install </pre> |
| 125 | +```bash |
| 126 | +make prod-run |
| 127 | +``` |
| 128 | + |
| 129 | +--- |
| 130 | + |
| 131 | +### macOS Notes (Apple Silicon & Intel) |
| 132 | + |
| 133 | +OpenCRE is fully supported on macOS. The following notes are optional and intended to help contributors running OpenCRE locally on macOS systems. |
| 134 | + |
| 135 | +#### Prerequisites |
| 136 | + |
| 137 | +Install required tools using Homebrew: |
45 | 138 |
|
46 | | -* Download the latest CRE graph from upstream by running |
47 | | -<pre>make upstream-sync </pre> |
48 | | -Keep in mind that until [Issue #534](https://github.com/OWASP/OpenCRE/issues/534) is fixed you won't have access to gap analysis results locally |
| 139 | +```bash |
| 140 | +brew install python@3.11 yarn make |
| 141 | +``` |
49 | 142 |
|
50 | | -* To run CRE locally then you can do: |
51 | | -<pre> make dev-flask </pre> |
| 143 | +> Note: Python 3.11 is recommended. Newer Python versions may cause dependency incompatibilities. |
52 | 144 |
|
53 | | -To run the CLI application, you can run |
54 | | -<pre>python cre.py --help</pre> |
| 145 | +Verify Python version: |
55 | 146 |
|
56 | | -To download a remote cre spreadsheet locally you can run |
57 | | -<pre>python cre.py --review --from_spreadsheet < google sheets url></pre> |
| 147 | +```bash |
| 148 | +python3 --version |
| 149 | +``` |
58 | 150 |
|
59 | | -To add a remote spreadsheet to your local database you can run |
60 | | -<pre>python cre.py --add --from_spreadsheet < google sheets url></pre> |
| 151 | +#### Virtual Environment Setup |
61 | 152 |
|
62 | | -To run the web application for development you can run |
63 | | -<pre> |
64 | | -$ make start-containers |
65 | | -$ make start-worker |
| 153 | +Create and activate a virtual environment explicitly using Python 3: |
66 | 154 |
|
67 | | -# in a seperate shell |
68 | | -$ make dev-flask |
69 | | -</pre> |
| 155 | +```bash |
| 156 | +python3 -m venv venv |
| 157 | +source venv/bin/activate |
| 158 | +``` |
70 | 159 |
|
71 | | -Alternatively, you can use the dockerfile with |
72 | | -<pre>make docker && make docker-run</pre> |
| 160 | +Upgrade pip: |
73 | 161 |
|
74 | | -Some features like Gap Analysis require a neo4j DB running, you can start this with |
75 | | -<pre>make docker-neo4j</pre> |
76 | | -enviroment varaibles for app to connect to neo4jDB (default): |
77 | | -- NEO4J_URL (neo4j//neo4j:password@localhost:7687) |
| 162 | +```bash |
| 163 | +pip install --upgrade pip |
| 164 | +``` |
78 | 165 |
|
79 | | -To run the web application for production you need gunicorn and you can run from within the cre_sync dir |
80 | | -<pre>make prod-run</pre> |
| 166 | +#### Dependency Installation |
81 | 167 |
|
| 168 | +Install dependencies using the standard workflow: |
82 | 169 |
|
83 | | -### Using the OpenCRE API |
84 | | -See [the myOpenCRE user guide](docs/my-opencre-user-guide.md) on using the OpenCRE API to for example add your own security guidelines and standards. |
| 170 | +```bash |
| 171 | +make install |
| 172 | +``` |
85 | 173 |
|
| 174 | +If you encounter build issues, ensure Xcode Command Line Tools are installed: |
| 175 | + |
| 176 | +```bash |
| 177 | +xcode-select --install |
| 178 | +``` |
| 179 | + |
| 180 | +#### Running Locally |
| 181 | + |
| 182 | +Sync upstream CRE data (requires internet access): |
| 183 | + |
| 184 | +```bash |
| 185 | +make upstream-sync |
| 186 | +``` |
| 187 | + |
| 188 | +Then start the local server: |
| 189 | + |
| 190 | +```bash |
| 191 | +make dev-flask |
| 192 | +``` |
| 193 | + |
| 194 | +The application will be available at: |
| 195 | + |
| 196 | +``` |
| 197 | +http://127.0.0.1:5000 |
| 198 | +``` |
| 199 | + |
| 200 | +> Tip: For most macOS users, running via Docker is the simplest and most reliable approach. |
| 201 | +
|
| 202 | +--- |
| 203 | + |
| 204 | +## Using the OpenCRE API |
| 205 | + |
| 206 | +See [the myOpenCRE user guide](docs/my-opencre-user-guide.md) on using the OpenCRE API to, for example, add your own security guidelines and standards. |
| 207 | + |
| 208 | +## Docker building and running |
| 209 | + |
| 210 | +You can build the production or the development docker images with: |
| 211 | + |
| 212 | +```bash |
| 213 | +make docker-prod |
| 214 | +make docker-dev |
| 215 | +``` |
86 | 216 |
|
87 | | -### Docker building and running |
88 | | -You can build the production or the development docker images with |
89 | | -`make docker-prod` and `make docker-dev` respectively |
90 | 217 | The environment variables used by OpenCRE are: |
| 218 | + |
| 219 | +``` |
| 220 | +- NEO4J_URL |
| 221 | +- NO_GEN_EMBEDDINGS |
| 222 | +- FLASK_CONFIG |
| 223 | +- DEV_DATABASE_URL |
| 224 | +- INSECURE_REQUESTS |
| 225 | +- REDIS_HOST |
| 226 | +- REDIS_PORT |
| 227 | +- REDIS_NO_SSL |
| 228 | +- REDIS_URL |
| 229 | +- GCP_NATIVE |
| 230 | +- GOOGLE_SECRET_JSON |
| 231 | +- GOOGLE_CLIENT_ID |
| 232 | +- GOOGLE_CLIENT_SECRET |
| 233 | +- LOGIN_ALLOWED_DOMAINS |
| 234 | +- OpenCRE_gspread_Auth |
91 | 235 | ``` |
92 | | - - name: NEO4J_URL |
93 | | - - name: NO_GEN_EMBEDDINGS |
94 | | - - name: FLASK_CONFIG |
95 | | - - name: DEV_DATABASE_URL |
96 | | - - name: INSECURE_REQUESTS # development or TLS terminated environments only |
97 | | - - name: REDIS_HOST |
98 | | - - name: REDIS_PORT |
99 | | - - name: REDIS_NO_SSL |
100 | | - - name: REDIS_URL # in case REDIS_HOST and REDIS_PORT are unavailable |
101 | | - - name: GCP_NATIVE # if there are ambient GCP credentials, only useful for VERTEX chatbot |
102 | | - - name: GOOGLE_SECRET_JSON # if not running on GCP |
103 | | - - name: GOOGLE_CLIENT_ID # useful for login only |
104 | | - - name: GOOGLE_CLIENT_SECRET # useful for login only |
105 | | - - name: LOGIN_ALLOWED_DOMAINS # useful for login only |
106 | | - - name: OpenCRE_gspread_Auth # useful only when importing data, possible values 'oauth' or 'service_account' |
107 | | -``` |
108 | | -You can run the containers with `make docker-prod-run` and `make-docker-dev-run` |
109 | | - |
110 | | -### Developing |
111 | | - |
112 | | -You can run backend tests with |
113 | | -<pre>make test</pre> |
114 | | -You can run get a coverage report with |
115 | | -<pre>make cover</pre> |
116 | | -Try to keep the coverage above 70% |
117 | 236 |
|
| 237 | +You can run the containers with: |
| 238 | + |
| 239 | +```bash |
| 240 | +make docker-prod-run |
| 241 | +make docker-dev-run |
| 242 | +``` |
| 243 | + |
| 244 | +## Developing |
| 245 | + |
| 246 | +You can run backend tests with: |
| 247 | + |
| 248 | +```bash |
| 249 | +make test |
| 250 | +``` |
| 251 | + |
| 252 | +You can get a coverage report with: |
| 253 | + |
| 254 | +```bash |
| 255 | +make cover |
| 256 | +``` |
| 257 | + |
| 258 | +Try to keep the coverage above 70%. |
| 259 | + |
| 260 | +--- |
118 | 261 |
|
119 | 262 | [](https://github.com/psf/black) |
120 | 263 | [](https://github.com/marketplace/actions/super-linter) |
121 | | -[](https://github.com/OWASP/OWASP/common-requirement-enumeration/workflows/Test) |
| 264 | +[](https://github.com/OWASP/common-requirement-enumeration/workflows/Test) |
122 | 265 |
|
123 | | -[](https://github.com/OWASP/common-requirement-enumeration/issues) |
| 266 | +[](https://github.com/OWASP/common-requirement-enumeration/issues) |
124 | 267 | [](http://makeapullrequest.com) |
125 | 268 |  |
126 | 269 |  |
|
0 commit comments