Skip to content

Commit 8a412dc

Browse files
committed
Add CSRFProtectionSetting concept
1 parent 95f21b5 commit 8a412dc

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

ruby/ql/lib/codeql/ruby/Concepts.qll

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,31 @@ module OrmInstantiation {
584584
}
585585
}
586586

587+
/**
588+
* A data-flow node that may set or unset Cross-site request forgery protection.
589+
* `getVerificationSetting() = false` corresponds to disabling verification.
590+
*
591+
* Extend this class to refine existing API models. If you want to model new APIs,
592+
* extend `CSRFProtectionSetting::Range` instead.
593+
*/
594+
class CSRFProtectionSetting extends DataFlow::Node instanceof CSRFProtectionSetting::Range {
595+
boolean getVerificationSetting() { result = super.getVerificationSetting() }
596+
}
597+
598+
/** Provides a class for modeling new CSRF protection setting APIs. */
599+
module CSRFProtectionSetting {
600+
/**
601+
* A data-flow node that may set or unset Cross-site request forgery protection.
602+
* `getVerificationSetting() = false` corresponds to disabling verification.
603+
*
604+
* Extend this class to model new APIs. If you want to refine existing API models,
605+
* extend `CSRFProtectionSetting` instead.
606+
*/
607+
abstract class Range extends DataFlow::Node {
608+
abstract boolean getVerificationSetting();
609+
}
610+
}
611+
587612
/** Provides classes for modeling path-related APIs. */
588613
module Path {
589614
/**

0 commit comments

Comments
 (0)