Sitelet https://web.archive.org/web/20260416060501/https://github.com/github/codeql/pull/5286
Skip to content

Python/JS: Share modeling of crypto algorithms#5286

Merged
tausbn merged 5 commits intogithub:mainfrom
RasmusWL:share-crypto-algorithms
Mar 3, 2021
Merged

Python/JS: Share modeling of crypto algorithms#5286
tausbn merged 5 commits intogithub:mainfrom
RasmusWL:share-crypto-algorithms

Conversation

@RasmusWL
Copy link
Copy Markdown
Member

I didn't quite know where to place it for JS, so I tried my best 😊 let me know if it should be placed somewhere else 👍

Now to be shared accross both languages, with sync-identical-files
I didn't quite know where to place it for JS, so I tried my best :)

The canonical Python version might be changed in the future, but I wanted to
keep this change small.
@RasmusWL RasmusWL requested review from a team as code owners February 27, 2021 10:40
@RasmusWL RasmusWL added the no-change-note-required This PR does not need a change note label Feb 27, 2021
Copy link
Copy Markdown
Contributor

@asgerf asgerf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Definitely a good idea to keep the files in sync, just want to make sure we're also in sync about filenames.

],
"CryptoAlgorithms Python/JS": [
"javascript/ql/src/semmle/javascript/security/CryptoAlgorithms.qll",
"python/ql/src/semmle/crypto/Crypto.qll"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have a bit more consistency between the languages here?

Either of these is fine with me:

semmle/<language>/security/CryptoAlgorithms.qll
semmle/crypto/CryptoAlgorithms.qll

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could have elaborated on that a bit more. As part of an other PR I'm currently working on, I want to place this somewhere else for Python. Due to our deprecation rules, we can't just remove python/ql/src/semmle/crypto/Crypto.qll (at least not for a year to come), but nothing stops us from putting it in a nice place for JS.

My plan of action is to add a CryptoAlgorithms.qll somewhere, and make the existing semmle/crypto/Crypto.qll a dummy module only containing import <new-parent>.CryptoAlgorithms.

Does this sound good enough for you? (File will have same name CryptoAlgorithms.qll, but might be placed in a slightly differently folder-structure)

A more detailed explanation of where it will go for Python: I want to expose the content of CryptoAlgorithms.qll as part of our crypto concepts (defined in python/ql/src/semmle/python/Concepts.qll), so my initial plan was to move it to python/ql/src/semmle/python/concepts/CryptoAlgorithms.qll. That still leaves us with the file in 2 different locations, but I guess that our modeling is still so far from each other that it's difficult to get things matched perfectly. Let me know what you think 😊


While semmle/crypto/CryptoAlgorithms.qll isn't necessarily a bad idea (based on the fact that which crypto algorithms are safe/unsafe is language agnostic I assume), Python seems to be the only language placing significant code outside of semmle/<language>/. I certainly don't want to be accountable for starting to do that, so I would recommend we don't do this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I wasn't aware of the situation in Pythonland. This looks fine then. 👍

asgerf
asgerf previously approved these changes Mar 1, 2021
RasmusWL added a commit to RasmusWL/codeql that referenced this pull request Mar 3, 2021
While waiting for github#5286 to be approved and
merged :)
Copy link
Copy Markdown
Contributor

@tausbn tausbn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment and a suggestion, otherwise this looks ready to merge.

Comment thread python/ql/src/semmle/crypto/Crypto.qll
Comment thread python/ql/src/semmle/crypto/Crypto.qll Outdated
@RasmusWL RasmusWL dismissed stale reviews from asgerf and ghost via dd75ea3 March 3, 2021 13:17
@RasmusWL RasmusWL requested a review from tausbn March 3, 2021 13:22
@tausbn tausbn merged commit c1fd484 into github:main Mar 3, 2021
@RasmusWL RasmusWL deleted the share-crypto-algorithms branch March 3, 2021 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

JS no-change-note-required This PR does not need a change note Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants